Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit UBullet;
- interface
- uses
- Types;
- const
- bfrDestroying = 0;
- bfrHit = 1;
- bfrLifetime = 2;
- bfrOutside = 3;
- afrDestroying = 0;
- afrEmpty = 1;
- afrLifetime = 2;
- type
- PAttackClass = ^TAttackClass;
- PBulletClass = ^TBulletClass;
- PPosition = ^TPosition;
- PAttack = ^TAttack;
- PBullet = ^TBullet;
- PAPI = ^TAPI;
- TBulletConstructorProc = procedure (Bullet: PBullet; API: PAPI; Data: Pointer); stdcall;
- TBulletUpdateProc = procedure (Bullet: PBullet; API: PAPI; DeltaTime: Integer); stdcall;
- TBulletDestructorProc = procedure (Bullet: PBullet; API: PAPI); stdcall;
- TBulletFinalizingProc = procedure (Bullet: PBullet; API: PAPI; Reason: Integer; var ShouldRemove: Boolean); stdcall;
- TBulletHitCheckingProc = procedure (Bullet: PBullet; API: PAPI; PlayerPosition: TPoint; var Hit: Boolean); stdcall;
- TAttackConstructorProc = procedure (Attack: PAttack; API: PAPI; Data: Pointer); stdcall;
- TAttackDestructorProc = procedure (Attack: PAttack; API: PAPI); stdcall;
- TAttackUpdateProc = procedure (Attack: PAttack; API: PAPI; DeltaTime: Integer); stdcall;
- TAttackFinalizingProc = procedure (Attack: PAttack; API: PAPI; Reason: Integer; var ShouldRemove: Boolean); stdcall;
- TAttackClass = record
- DefaultBulletCount: Integer;
- BulletCountIncrease: Integer;
- MinLifetime: Integer;
- MaxLifeTime: Integer;
- AttackConstructorProc: TAttackConstructorProc;
- AttackDestructorProc: TAttackDestructorProc;
- AttackUpdateProc: TAttackUpdateProc;
- AttackFinalizingProc: TAttackFinalizingProc;
- end;
- TBulletClass = record
- Sprite: PWideChar;
- MinLifeTime: Integer;
- MaxLifeTime: Integer;
- HitboxExtent: TPoint;
- BulletConstructorProc: TBulletConstructorProc;
- BulletDestructorProc: TBulletDestructorProc;
- BulletUpdateProc: TBulletUpdateProc;
- BulletFinalizingProc: TBulletFinalizingProc;
- BulletHitCheckingProc: TBulletHitCheckingProc;
- end;
- TPosition = record
- X,Y: Integer;
- Angle: Integer;
- end;
- TAttack = record
- Data: Pointer;
- AttackClass: PAttackClass;
- Bullets: array of PBullet;
- BulletCount: Integer;
- Lifetime: Integer;
- end;
- TBullet = record
- Data: Pointer;
- Attack: PAttack;
- BulletClass: PBulletClass;
- Position: TPosition;
- Lifetime: Integer;
- Index: Integer;
- Sprite: PPWideChar;
- Shader: Pointer;
- end;
- TAPI = record
- SpawnBullet: function (Attack: PAttack; BulletClass: PBulletClass; Position: TPosition; Data: Pointer): PBullet of object; stdcall;
- RemoveBullet: function (Bullet: PBullet; Reason: Integer; Force: Boolean): Boolean of object; stdcall;
- GetPlayerPosition: function: TPoint of object; stdcall;
- CompareDist: function (X,Y: Integer; DistSquaredLo, DistSquaredHi: Cardinal): Boolean of object; stdcall;
- end;
- implementation
- end.
Advertisement
Add Comment
Please, Sign In to add comment