summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f4dd4b6)
raw | patch | inline | side by side (parent: f4dd4b6)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 6 Jun 2022 16:52:09 +0000 (19:52 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 08:38:57 +0000 (11:38 +0300) |
src/game/g_playermodel.pas | patch | blob | history | |
src/game/renders/opengl/r_map.pas | patch | blob | history |
index e4915607eb882625944cf28f9074865894b91726..4f4d709182bb491668c4f29f5de076ca4e0867e4 100644 (file)
W_POS_NORMAL = 0;
W_POS_UP = 1;
W_POS_DOWN = 2;
+ W_POS_LAST = W_POS_DOWN;
W_ACT_NORMAL = 0;
W_ACT_FIRE = 1;
+ W_ACT_LAST = W_ACT_FIRE;
FLAG_BASEPOINT: TDFPoint = (X:16; Y:43);
index 016aed3c0ac210c20ed5b23b1606aa7bdd2d5205..60f1ee62e66605d3bd441719db1e02cdc075ecaa 100644 (file)
e_log,
binheap, MAPDEF, utils,
g_options, g_textures, g_basic, g_base, g_phys,
- g_game, g_map, g_panel, g_items, g_monsters, g_playermodel, g_player,
+ g_game, g_map, g_panel, g_items, g_monsters, g_playermodel, g_player, g_weapons,
{$IFDEF ENABLE_CORPSES}
g_corpses,
{$ENDIF}
anim: TAnimState;
end;
MonTextures: array [0..MONSTER_MAN] of TMonsterAnims;
+ WeapTextures: array [0..WP_LAST, 0..W_POS_LAST, 0..W_ACT_LAST] of TGLTexture;
VileFire: TGLMultiTexture;
Models: array of record
anim: array [TDirection, 0..A_LAST] of record
procedure r_Map_Load;
- var i, j: Integer; d: TDirection;
+ const
+ WeapName: array [0..WP_LAST] of AnsiString = ('', 'CSAW', 'HGUN', 'SG', 'SSG', 'MGUN', 'RKT', 'PLZ', 'BFG', 'SPL', 'FLM');
+ WeapPos: array [0..W_POS_LAST] of AnsiString = ('', '_UP', '_DN');
+ WeapAct: array [0..W_ACT_LAST] of AnsiString = ('', '_FIRE');
+ var
+ i, j, k: Integer; d: TDirection;
procedure LoadItem (i: Integer; const name: AnsiString; w, h, delay, count: Integer; backanim: Boolean);
begin
for i := 0 to High(PlayerModelsArray) do
r_Map_LoadModel(i);
end;
+ // --------- player weapons --------- //
+ for i := 1 to WP_LAST do
+ for j := 0 to W_POS_LAST do
+ for k := 0 to W_ACT_LAST do
+ WeapTextures[i, j, k] := r_Textures_LoadFromFile(GameWAD + ':WEAPONS\' + WeapName[i] + WeapPos[j] + WeapAct[k]);
end;
procedure r_Map_Free;
end;
procedure r_Map_DrawPlayerModel (pm: TPlayerModel; x, y: Integer);
- var a: Integer; d: TDirection; flip: Boolean; t: TGLMultiTexture;
+ var a, pos, act, xx, yy: Integer; d: TDirection; flip: Boolean; t: TGLMultiTexture; tex: TGLTexture;
begin
- // TODO draw flag
- // TODO draw weapon
a := pm.CurrentAnimation;
d := pm.Direction;
+ // TODO draw flag
+ if PlayerModelsArray[pm.id].HaveWeapon and not (pm.CurrentAnimation in [A_DIE1, A_DIE2, A_PAIN]) then
+ begin
+ case a of
+ A_SEEUP, A_ATTACKUP: pos := W_POS_UP;
+ A_SEEDOWN, A_ATTACKDOWN: pos := W_POS_DOWN;
+ else pos := W_POS_NORMAL;
+ end;
+ if (a in [A_ATTACK, A_ATTACKUP, A_ATTACKDOWN]) or pm.GetFire() then
+ act := W_ACT_FIRE
+ else
+ act := W_ACT_NORMAL;
+ tex := WeapTextures[pm.CurrentWeapon, pos, act];
+ if tex <> nil then
+ begin
+ xx := PlayerModelsArray[pm.id].WeaponPoints[pm.CurrentWeapon, a, d, pm.AnimState.CurrentFrame].X;
+ yy := PlayerModelsArray[pm.id].WeaponPoints[pm.CurrentWeapon, a, d, pm.AnimState.CurrentFrame].Y;
+ r_Draw_Texture(
+ tex,
+ x + xx,
+ y + yy,
+ tex.width,
+ tex.height,
+ d = TDirection.D_LEFT
+ );
+ end;
+ end;
if r_Map_GetPlayerModelTex(pm.id, a, d, flip) then
begin
t := Models[pm.id].anim[d, a].base;