Guest User

Untitled

a guest
Jan 24th, 2013
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.84 KB | None | 0 0
  1. unit UBullet;
  2.  
  3. interface
  4.  
  5. uses
  6.   Types;
  7.  
  8. const
  9.   bfrDestroying = 0;
  10.   bfrHit = 1;
  11.   bfrLifetime = 2;
  12.   bfrOutside = 3;
  13.  
  14.   afrDestroying = 0;
  15.   afrEmpty = 1;
  16.   afrLifetime = 2;
  17.  
  18. type
  19.   PAttackClass = ^TAttackClass;
  20.   PBulletClass = ^TBulletClass;
  21.   PPosition = ^TPosition;
  22.   PAttack = ^TAttack;
  23.   PBullet = ^TBullet;
  24.   PAPI = ^TAPI;
  25.  
  26.   TBulletConstructorProc = procedure (Bullet: PBullet; API: PAPI; Data: Pointer); stdcall;
  27.   TBulletUpdateProc = procedure (Bullet: PBullet; API: PAPI; DeltaTime: Integer); stdcall;
  28.   TBulletDestructorProc = procedure (Bullet: PBullet; API: PAPI); stdcall;
  29.   TBulletFinalizingProc = procedure (Bullet: PBullet; API: PAPI; Reason: Integer; var ShouldRemove: Boolean); stdcall;
  30.   TBulletHitCheckingProc = procedure (Bullet: PBullet; API: PAPI; PlayerPosition: TPoint; var Hit: Boolean); stdcall;
  31.  
  32.   TAttackConstructorProc = procedure (Attack: PAttack; API: PAPI; Data: Pointer); stdcall;
  33.   TAttackDestructorProc = procedure (Attack: PAttack; API: PAPI); stdcall;
  34.   TAttackUpdateProc = procedure (Attack: PAttack; API: PAPI; DeltaTime: Integer); stdcall;
  35.   TAttackFinalizingProc = procedure (Attack: PAttack; API: PAPI; Reason: Integer; var ShouldRemove: Boolean); stdcall;
  36.  
  37.   TAttackClass = record
  38.     DefaultBulletCount: Integer;
  39.     BulletCountIncrease: Integer;
  40.     MinLifetime: Integer;
  41.     MaxLifeTime: Integer;
  42.     AttackConstructorProc: TAttackConstructorProc;
  43.     AttackDestructorProc: TAttackDestructorProc;
  44.     AttackUpdateProc: TAttackUpdateProc;
  45.     AttackFinalizingProc: TAttackFinalizingProc;
  46.   end;
  47.  
  48.   TBulletClass = record
  49.     Sprite: PWideChar;
  50.     MinLifeTime: Integer;
  51.     MaxLifeTime: Integer;
  52.     HitboxExtent: TPoint;
  53.     BulletConstructorProc: TBulletConstructorProc;
  54.     BulletDestructorProc: TBulletDestructorProc;
  55.     BulletUpdateProc: TBulletUpdateProc;
  56.     BulletFinalizingProc: TBulletFinalizingProc;
  57.     BulletHitCheckingProc: TBulletHitCheckingProc;
  58.   end;
  59.  
  60.   TPosition = record
  61.     X,Y: Integer;
  62.     Angle: Integer;
  63.   end;
  64.  
  65.   TAttack = record
  66.     Data: Pointer;
  67.     AttackClass: PAttackClass;
  68.     Bullets: array of PBullet;
  69.     BulletCount: Integer;
  70.     Lifetime: Integer;
  71.   end;
  72.  
  73.   TBullet = record
  74.     Data: Pointer;
  75.     Attack: PAttack;
  76.     BulletClass: PBulletClass;
  77.     Position: TPosition;
  78.     Lifetime: Integer;
  79.     Index: Integer;
  80.     Sprite: PPWideChar;
  81.     Shader: Pointer;
  82.   end;
  83.  
  84.   TAPI = record
  85.     SpawnBullet: function (Attack: PAttack; BulletClass: PBulletClass; Position: TPosition; Data: Pointer): PBullet of object; stdcall;
  86.     RemoveBullet: function (Bullet: PBullet; Reason: Integer; Force: Boolean): Boolean of object; stdcall;
  87.     GetPlayerPosition: function: TPoint of object; stdcall;
  88.     CompareDist: function (X,Y: Integer; DistSquaredLo, DistSquaredHi: Cardinal): Boolean of object; stdcall;
  89.   end;
  90.  
  91. implementation
  92.  
  93. end.
Advertisement
Add Comment
Please, Sign In to add comment