X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_weapons.pas;h=8fdde869c0bcda1b9a175a3805bc0c2bc528be53;hb=b36923c380a9760c74967bc8c850517c386747db;hp=95137cdf456c88c61a4a800f93efae210b53e6b8;hpb=0361545117c9f1e9c4e719f2250c48f69879de4a;p=d2df-sdl.git diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas index 95137cd..8fdde86 100644 --- a/src/game/g_weapons.pas +++ b/src/game/g_weapons.pas @@ -20,7 +20,7 @@ interface uses SysUtils, Classes, mempool, - g_textures, g_basic, g_phys, xprofiler; + g_basic, g_phys, xprofiler; type @@ -30,7 +30,7 @@ type SpawnerUID: Word; Triggers: DWArray; Obj: TObj; - Animation: TAnimationState; + time: LongWord; Timeout: DWORD; Stopped: Byte; @@ -100,6 +100,7 @@ const WEAPON_BARON_FIRE = 24; WEAPON_MANCUB_FIRE = 25; WEAPON_SKEL_FIRE = 26; + WEAPON_LAST = WEAPON_SKEL_FIRE; WP_FIRST = WEAPON_KASTET; WP_LAST = WEAPON_FLAMETHROWER; @@ -588,6 +589,8 @@ begin SetLength(Shots, find_id + 64) end; + shots[find_id].time := gTime; + case ShotType of WEAPON_ROCKETLAUNCHER: begin @@ -598,7 +601,6 @@ begin Obj.Rect.Width := SHOT_ROCKETLAUNCHER_WIDTH; Obj.Rect.Height := SHOT_ROCKETLAUNCHER_HEIGHT; - Animation := nil; Triggers := nil; ShotType := WEAPON_ROCKETLAUNCHER; end; @@ -615,7 +617,6 @@ begin Triggers := nil; ShotType := WEAPON_PLASMA; - Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table end; end; @@ -630,7 +631,6 @@ begin Triggers := nil; ShotType := WEAPON_BFG; - Animation := TAnimationState.Create(True, 6, 2); // !!! put values into table end; end; @@ -645,7 +645,6 @@ begin Triggers := nil; ShotType := WEAPON_FLAMETHROWER; - // Animation := TAnimationState.Create(True, 6, 0); // drawed as gfx end; end; @@ -660,7 +659,6 @@ begin Triggers := nil; ShotType := WEAPON_IMP_FIRE; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table end; end; @@ -675,7 +673,6 @@ begin Triggers := nil; ShotType := WEAPON_CACO_FIRE; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table end; end; @@ -690,7 +687,6 @@ begin Triggers := nil; ShotType := WEAPON_MANCUB_FIRE; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table end; end; @@ -705,7 +701,6 @@ begin Triggers := nil; ShotType := WEAPON_BARON_FIRE; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table end; end; @@ -720,7 +715,6 @@ begin Triggers := nil; ShotType := WEAPON_BSP_FIRE; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table end; end; @@ -736,7 +730,6 @@ begin Triggers := nil; ShotType := WEAPON_SKEL_FIRE; target := TargetUID; - Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table end; end; end; @@ -1111,18 +1104,8 @@ begin end; procedure g_Weapon_Free(); -var - i: Integer; begin - if Shots <> nil then - begin - for i := 0 to High(Shots) do - if Shots[i].ShotType <> 0 then - Shots[i].Animation.Free(); - - Shots := nil; - end; - + Shots := nil; WaterMap := nil; end; @@ -1662,8 +1645,8 @@ begin ShotType := WEAPON_ROCKETLAUNCHER; throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 12); - Animation := nil; triggers := nil; + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1702,7 +1685,7 @@ begin triggers := nil; target := TargetUID; - Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1743,7 +1726,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1784,7 +1767,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - Animation := nil; + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1825,7 +1808,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1866,7 +1849,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1907,7 +1890,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1948,8 +1931,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -1990,8 +1972,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - - Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -2032,7 +2013,7 @@ begin throw(find_id, x+dx, y+dy, xd+dx, yd+dy, 16); triggers := nil; - Animation := TAnimationState.Create(True, 6, 2); // !!! put values into table + time := gTime; end; Shots[find_id].SpawnerUID := SpawnerUID; @@ -2191,10 +2172,6 @@ begin end; end; - // Àíèìàöèÿ ñíàðÿäà: - if Animation <> nil then - Animation.Update(); - // Äâèæåíèå: spl := (ShotType <> WEAPON_PLASMA) and (ShotType <> WEAPON_BFG) and @@ -2216,7 +2193,7 @@ begin begin // Íà êëèåíòå ñêîðåå âñåãî è òàê óæå âûïàë. ShotType := 0; - Animation.Free(); + time := 0; Continue; end; @@ -2490,11 +2467,7 @@ begin begin if gGameSettings.GameType = GT_SERVER then MH_SEND_DeleteShot(i, Obj.X, Obj.Y, Loud); - if Animation <> nil then - begin - Animation.Free(); - Animation := nil; - end; + time := 0; end else if (ShotType <> WEAPON_FLAMETHROWER) and ((oldvx <> Obj.Vel.X) or (oldvy <> Obj.Vel.Y)) then if gGameSettings.GameType = GT_SERVER then @@ -2600,42 +2573,7 @@ begin // Êîñòûëèíà åáàíàÿ Shots[i].Stopped := utils.readByte(st); - // Óñòàíîâêà òåêñòóðû èëè àíèìàöèè - Shots[i].Animation := nil; - - case Shots[i].ShotType of - WEAPON_ROCKETLAUNCHER, WEAPON_SKEL_FIRE: - begin - end; - WEAPON_PLASMA: - begin - Shots[i].Animation := TAnimationState.Create(True, 5, 2); // !!! put values into table - end; - WEAPON_BFG: - begin - Shots[i].Animation := TAnimationState.Create(True, 6, 2); // !!! put values into table - end; - WEAPON_IMP_FIRE: - begin - Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table - end; - WEAPON_BSP_FIRE: - begin - Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table - end; - WEAPON_CACO_FIRE: - begin - Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table - end; - WEAPON_BARON_FIRE: - begin - Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table - end; - WEAPON_MANCUB_FIRE: - begin - Shots[i].Animation := TAnimationState.Create(True, 4, 2); // !!! put values into table - end; - end; + Shots[i].time := gTime; // TODO save time? end; end; @@ -2720,7 +2658,6 @@ begin end; // case ShotType of... ShotType := 0; - Animation.Free(); end; end;