X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_weapons.pas;h=96c46c8d4fc0cad7a2d0e36eeaf88b431addbaf9;hb=789dadda373cbc77a36d095f041489a225894516;hp=95137cdf456c88c61a4a800f93efae210b53e6b8;hpb=0361545117c9f1e9c4e719f2250c48f69879de4a;p=d2df-sdl.git diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas index 95137cd..96c46c8 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; @@ -123,7 +124,7 @@ implementation Math, g_map, g_player, g_sound, g_panel, g_console, g_options, g_game, g_triggers, MAPDEF, e_log, g_monsters, g_saveload, - g_language, g_netmsg, g_grid, + g_language, g_netmsg, g_grid, g_window, geom, binheap, hashtable, utils, xstreams ; @@ -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,24 +1104,15 @@ 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; procedure g_Weapon_LoadData(); begin e_WriteLog('Loading weapons data...', TMsgType.Notify); + g_Game_SetLoadingText(_lc[I_LOAD_WEAPONS_DATA], 0, False); g_Sound_CreateWADEx('SOUND_WEAPON_HITPUNCH', GameWAD+':SOUNDS\HITPUNCH'); g_Sound_CreateWADEx('SOUND_WEAPON_MISSPUNCH', GameWAD+':SOUNDS\MISSPUNCH'); @@ -1662,8 +1646,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 +1686,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 +1727,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 +1768,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 +1809,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 +1850,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 +1891,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 +1932,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 +1973,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 +2014,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 +2173,6 @@ begin end; end; - // Àíèìàöèÿ ñíàðÿäà: - if Animation <> nil then - Animation.Update(); - // Äâèæåíèå: spl := (ShotType <> WEAPON_PLASMA) and (ShotType <> WEAPON_BFG) and @@ -2216,7 +2194,7 @@ begin begin // Íà êëèåíòå ñêîðåå âñåãî è òàê óæå âûïàë. ShotType := 0; - Animation.Free(); + time := 0; Continue; end; @@ -2490,11 +2468,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 +2574,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 +2659,6 @@ begin end; // case ShotType of... ShotType := 0; - Animation.Free(); end; end;