diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index c94282d7b9c3ee1c71a89316b26324b1031f3370..fb89fcc3a1f6b09871823aedd1d0183abc827243 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
uses
SysUtils, Classes, mempool,
- g_textures, g_basic, e_graphics, g_phys, xprofiler;
+ g_textures, g_basic, g_phys, xprofiler;
type
SpawnerUID: Word;
Triggers: DWArray;
Obj: TObj;
- Animation: TAnimation;
- TextureID: DWORD;
+ Animation: TAnimationState;
Timeout: DWORD;
Stopped: Byte;
WP_FIRST = WEAPON_KASTET;
WP_LAST = WEAPON_FLAMETHROWER;
-
var
gwep_debug_fast_trace: Boolean = true;
implementation
uses
- Math, g_map, g_player, g_gfx, g_sound, g_main, g_panel,
- g_console, g_options, g_game,
+ Math, g_map, g_player, g_gfx, g_sound, g_panel,
+ g_console, g_options, g_game, r_textures, r_animations,
g_triggers, MAPDEF, e_log, g_monsters, g_saveload,
g_language, g_netmsg, g_grid,
geom, binheap, hashtable, utils, xstreams;
function g_Weapon_CreateShot(I: Integer; ShotType: Byte; Spawner, TargetUID: Word; X, Y, XV, YV: Integer): LongWord;
var
find_id: DWord;
- FramesID: DWORD = 0;
begin
if I < 0 then
find_id := FindShot()
Animation := nil;
Triggers := nil;
ShotType := WEAPON_ROCKETLAUNCHER;
- g_Texture_Get('TEXTURE_WEAPON_ROCKET', TextureID);
end;
end;
Triggers := nil;
ShotType := WEAPON_PLASMA;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_PLASMA');
- Animation := TAnimation.Create(FramesID, True, 5);
+ Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table
end;
end;
Triggers := nil;
ShotType := WEAPON_BFG;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_BFG');
- Animation := TAnimation.Create(FramesID, True, 6);
+ Animation := TAnimationState.Create(True, 6, 2); // !!! put values into table
end;
end;
Triggers := nil;
ShotType := WEAPON_FLAMETHROWER;
- Animation := nil;
- TextureID := 0;
- g_Frames_Get(TextureID, 'FRAMES_FLAME');
+ // Animation := TAnimationState.Create(True, 6, 0); // drawed as gfx
end;
end;
Triggers := nil;
ShotType := WEAPON_IMP_FIRE;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_IMPFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
end;
Triggers := nil;
ShotType := WEAPON_CACO_FIRE;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_CACOFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
end;
Triggers := nil;
ShotType := WEAPON_MANCUB_FIRE;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_MANCUBFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
end;
Triggers := nil;
ShotType := WEAPON_BARON_FIRE;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_BARONFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
end;
Triggers := nil;
ShotType := WEAPON_BSP_FIRE;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_BSPFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
end;
Triggers := nil;
ShotType := WEAPON_SKEL_FIRE;
target := TargetUID;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_SKELFIRE');
- Animation := TAnimation.Create(FramesID, True, 5);
+ Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table
end;
end;
end;
g_Sound_CreateWADEx('SOUND_PLAYER_SHELL1', GameWAD+':SOUNDS\SHELL1');
g_Sound_CreateWADEx('SOUND_PLAYER_SHELL2', GameWAD+':SOUNDS\SHELL2');
- g_Texture_CreateWADEx('TEXTURE_WEAPON_ROCKET', GameWAD+':TEXTURES\BROCKET');
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_SKELFIRE', GameWAD+':TEXTURES\BSKELFIRE', 64, 16, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_BFG', GameWAD+':TEXTURES\BBFG', 64, 64, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_PLASMA', GameWAD+':TEXTURES\BPLASMA', 16, 16, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_IMPFIRE', GameWAD+':TEXTURES\BIMPFIRE', 16, 16, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_BSPFIRE', GameWAD+':TEXTURES\BBSPFIRE', 16, 16, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_CACOFIRE', GameWAD+':TEXTURES\BCACOFIRE', 16, 16, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_BARONFIRE', GameWAD+':TEXTURES\BBARONFIRE', 64, 16, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_WEAPON_MANCUBFIRE', GameWAD+':TEXTURES\BMANCUBFIRE', 64, 32, 2);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_ROCKET', GameWAD+':TEXTURES\EROCKET', 128, 128, 6);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_SKELFIRE', GameWAD+':TEXTURES\ESKELFIRE', 64, 64, 3);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_BFG', GameWAD+':TEXTURES\EBFG', 128, 128, 6);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_IMPFIRE', GameWAD+':TEXTURES\EIMPFIRE', 64, 64, 3);
- g_Frames_CreateWAD(nil, 'FRAMES_BFGHIT', GameWAD+':TEXTURES\BFGHIT', 64, 64, 4);
- g_Frames_CreateWAD(nil, 'FRAMES_FIRE', GameWAD+':TEXTURES\FIRE', 64, 128, 8);
- g_Frames_CreateWAD(nil, 'FRAMES_FLAME', GameWAD+':TEXTURES\FLAME', 32, 32, 11);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_PLASMA', GameWAD+':TEXTURES\EPLASMA', 32, 32, 4, True);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_BSPFIRE', GameWAD+':TEXTURES\EBSPFIRE', 32, 32, 5);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_CACOFIRE', GameWAD+':TEXTURES\ECACOFIRE', 64, 64, 3);
- g_Frames_CreateWAD(nil, 'FRAMES_EXPLODE_BARONFIRE', GameWAD+':TEXTURES\EBARONFIRE', 64, 64, 3);
- g_Frames_CreateWAD(nil, 'FRAMES_SMOKE', GameWAD+':TEXTURES\SMOKE', 32, 32, 10, False);
-
g_Texture_CreateWADEx('TEXTURE_SHELL_BULLET', GameWAD+':TEXTURES\EBULLET');
g_Texture_CreateWADEx('TEXTURE_SHELL_SHELL', GameWAD+':TEXTURES\ESHELL');
g_Sound_Delete('SOUND_PLAYER_CASING2');
g_Sound_Delete('SOUND_PLAYER_SHELL1');
g_Sound_Delete('SOUND_PLAYER_SHELL2');
-
- g_Texture_Delete('TEXTURE_WEAPON_ROCKET');
- g_Frames_DeleteByName('FRAMES_WEAPON_BFG');
- g_Frames_DeleteByName('FRAMES_WEAPON_PLASMA');
- g_Frames_DeleteByName('FRAMES_WEAPON_IMPFIRE');
- g_Frames_DeleteByName('FRAMES_WEAPON_BSPFIRE');
- g_Frames_DeleteByName('FRAMES_WEAPON_CACOFIRE');
- g_Frames_DeleteByName('FRAMES_WEAPON_MANCUBFIRE');
- g_Frames_DeleteByName('FRAMES_EXPLODE_ROCKET');
- g_Frames_DeleteByName('FRAMES_EXPLODE_BFG');
- g_Frames_DeleteByName('FRAMES_EXPLODE_IMPFIRE');
- g_Frames_DeleteByName('FRAMES_BFGHIT');
- g_Frames_DeleteByName('FRAMES_FIRE');
- g_Frames_DeleteByName('FRAMES_EXPLODE_PLASMA');
- g_Frames_DeleteByName('FRAMES_EXPLODE_BSPFIRE');
- g_Frames_DeleteByName('FRAMES_EXPLODE_CACOFIRE');
- g_Frames_DeleteByName('FRAMES_SMOKE');
- g_Frames_DeleteByName('FRAMES_WEAPON_BARONFIRE');
- g_Frames_DeleteByName('FRAMES_EXPLODE_BARONFIRE');
end;
Animation := nil;
triggers := nil;
- g_Texture_Get('TEXTURE_WEAPON_ROCKET', TextureID);
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_revf(x, y, xd, yd: Integer; SpawnerUID, TargetUID: Word;
WID: Integer = -1; Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
triggers := nil;
target := TargetUID;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_SKELFIRE');
- Animation := TAnimation.Create(FramesID, True, 5);
+ Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_plasma(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1;
Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
triggers := nil;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_PLASMA');
- Animation := TAnimation.Create(FramesID, True, 5);
+ Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
triggers := nil;
Animation := nil;
- TextureID := 0;
- g_Frames_Get(TextureID, 'FRAMES_FLAME');
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_ball1(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1;
Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
triggers := nil;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_IMPFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_ball2(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1;
Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
triggers := nil;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_CACOFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_ball7(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1;
Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
triggers := nil;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_BARONFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_aplasma(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1;
Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
triggers := nil;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_BSPFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_manfire(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1;
Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
triggers := nil;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_MANCUBFIRE');
- Animation := TAnimation.Create(FramesID, True, 4);
+ Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
procedure g_Weapon_bfgshot(x, y, xd, yd: Integer; SpawnerUID: Word; WID: Integer = -1;
Silent: Boolean = False);
var
- find_id, FramesID: DWORD;
+ find_id: DWORD;
dx, dy: Integer;
begin
if WID < 0 then
throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16);
triggers := nil;
- g_Frames_Get(FramesID, 'FRAMES_WEAPON_BFG');
- Animation := TAnimation.Create(FramesID, True, 6);
+ Animation := TAnimationState.Create(True, 6, 2); // !!! put values into table
end;
Shots[find_id].SpawnerUID := SpawnerUID;
Anim: TAnimation;
t: DWArray;
st: Word;
+ TextureID: DWORD = DWORD(-1);
s: String;
o: TObj;
spl: Boolean;
cx := Obj.X + (Obj.Rect.Width div 2);
cy := Obj.Y + (Obj.Rect.Height div 2);
+ TextureID := DWORD(-1); // !!!
+
case ShotType of
WEAPON_ROCKETLAUNCHER, WEAPON_SKEL_FIRE: // Ðàêåòû è ñíàðÿäû Ñêåëåòà
begin
if (gTime mod LongWord(tf) = 0) then
begin
+ g_Frames_Get(TextureID, 'FRAMES_FLAME');
Anim := TAnimation.Create(TextureID, False, 2 + Random(2));
Anim.Alpha := 0;
case Stopped of
procedure g_Weapon_LoadState (st: TStream);
var
count, tc, i, j: Integer;
- dw: LongWord;
begin
if (st = nil) then exit;
Shots[i].Stopped := utils.readByte(st);
// Óñòàíîâêà òåêñòóðû èëè àíèìàöèè
- Shots[i].TextureID := DWORD(-1);
Shots[i].Animation := nil;
case Shots[i].ShotType of
WEAPON_ROCKETLAUNCHER, WEAPON_SKEL_FIRE:
begin
- g_Texture_Get('TEXTURE_WEAPON_ROCKET', Shots[i].TextureID);
end;
WEAPON_PLASMA:
begin
- g_Frames_Get(dw, 'FRAMES_WEAPON_PLASMA');
- Shots[i].Animation := TAnimation.Create(dw, True, 5);
+ Shots[i].Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table
end;
WEAPON_BFG:
begin
- g_Frames_Get(dw, 'FRAMES_WEAPON_BFG');
- Shots[i].Animation := TAnimation.Create(dw, True, 6);
+ Shots[i].Animation := TAnimationState.Create(True, 6, 2); // !!! put values into table
end;
WEAPON_IMP_FIRE:
begin
- g_Frames_Get(dw, 'FRAMES_WEAPON_IMPFIRE');
- Shots[i].Animation := TAnimation.Create(dw, True, 4);
+ Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
WEAPON_BSP_FIRE:
begin
- g_Frames_Get(dw, 'FRAMES_WEAPON_BSPFIRE');
- Shots[i].Animation := TAnimation.Create(dw, True, 4);
+ Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
WEAPON_CACO_FIRE:
begin
- g_Frames_Get(dw, 'FRAMES_WEAPON_CACOFIRE');
- Shots[i].Animation := TAnimation.Create(dw, True, 4);
+ Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
WEAPON_BARON_FIRE:
begin
- g_Frames_Get(dw, 'FRAMES_WEAPON_BARONFIRE');
- Shots[i].Animation := TAnimation.Create(dw, True, 4);
+ Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
WEAPON_MANCUB_FIRE:
begin
- g_Frames_Get(dw, 'FRAMES_WEAPON_MANCUBFIRE');
- Shots[i].Animation := TAnimation.Create(dw, True, 4);
+ Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table
end;
end;
end;
cx, cy: Integer;
Anim: TAnimation;
s: string;
+ TextureID: DWORD = DWORD(-1);
begin
if Shots = nil then
Exit;