X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame%2Fopengl%2Fr_player.pas;h=62f81929bb612497f77a7f3795afa4e794abc927;hb=373f27c0de10cb90442f535cb5d330095bafbf54;hp=41c519be71b9c70166ac045bb43a5e4f5423f29b;hpb=b01cc2e9192a8deb3ab6a64d9cbed29ad2baeb9c;p=d2df-sdl.git diff --git a/src/game/opengl/r_player.pas b/src/game/opengl/r_player.pas index 41c519b..62f8192 100644 --- a/src/game/opengl/r_player.pas +++ b/src/game/opengl/r_player.pas @@ -41,17 +41,22 @@ interface implementation uses + {$IFDEF ENABLE_HOLMES} + g_holmes, + {$ENDIF} + {$IFDEF ENABLE_MENU} + g_menu, + {$ENDIF} SysUtils, Classes, Math, MAPDEF, utils, - g_basic, g_game, g_phys, g_map, g_menu, g_language, g_weapons, g_items, g_net, g_options, -{$IFDEF ENABLE_HOLMES} - g_holmes, -{$ENDIF} - r_playermodel, r_graphics, r_animations, r_textures, r_items + g_basic, g_game, g_phys, g_map, g_language, g_weapons, g_items, g_net, g_options, + r_playermodel, r_graphics, r_animations, r_textures, r_items, r_game, r_map ; var PunchFrames: array [Boolean, 0..2] of DWORD; + BulletTexture: DWORD; + ShellTexture: DWORD; procedure r_Player_Load; begin @@ -61,6 +66,10 @@ implementation g_Frames_CreateWAD(@PunchFrames[True, 0], 'FRAMES_PUNCH_BERSERK', GameWAD + ':WEAPONS\PUNCHB', 64, 64, 4, False); g_Frames_CreateWAD(@PunchFrames[True, 1], 'FRAMES_PUNCH_BERSERK_UP', GameWAD + ':WEAPONS\PUNCHB_UP', 64, 64, 4, False); g_Frames_CreateWAD(@PunchFrames[True, 2], 'FRAMES_PUNCH_BERSERK_DN', GameWAD + ':WEAPONS\PUNCHB_DN', 64, 64, 4, False); + g_Texture_CreateWADEx('TEXTURE_SHELL_BULLET', GameWAD + ':TEXTURES\EBULLET'); + g_Texture_CreateWADEx('TEXTURE_SHELL_SHELL', GameWAD + ':TEXTURES\ESHELL'); + g_Texture_Get('TEXTURE_SHELL_BULLET', BulletTexture); + g_Texture_Get('TEXTURE_SHELL_SHELL', ShellTexture); end; procedure r_Player_Free; @@ -140,27 +149,37 @@ end; r_Player_DrawCorpse(gCorpses[i]) end; -procedure r_Player_DrawShells; -var - i, fX, fY: Integer; - a: TDFPoint; -begin - if gShells <> nil then - for i := 0 to High(gShells) do - if gShells[i].alive then - with gShells[i] do + procedure r_Player_DrawShells; + var i, fX, fY: Integer; a: TDFPoint; TextureID: DWORD = DWORD(-1); + begin + if gShells <> nil then + begin + for i := 0 to High(gShells) do + begin + if gShells[i].alive and g_Obj_Collide(sX, sY, sWidth, sHeight, @gShells[i].Obj) then begin - if not g_Obj_Collide(sX, sY, sWidth, sHeight, @Obj) then - Continue; - - Obj.lerp(gLerpFactor, fX, fY); - - a.X := CX; - a.Y := CY; - - e_DrawAdv(SpriteID, fX, fY, 0, True, False, RAngle, @a, TMirrorType.None); - end; -end; + gShells[i].Obj.lerp(gLerpFactor, fX, fY); + case gShells[i].SType of + SHELL_BULLET: + begin + TextureID := BulletTexture; + a.X := 2; + a.Y := 1; + end; + SHELL_SHELL, SHELL_DBLSHELL: + begin + TextureID := ShellTexture; + a.X := 4; + a.Y := 2; + end + else + Assert(false) + end; + e_DrawAdv(TextureID, fX, fY, 0, True, False, gShells[i].RAngle, @a, TMirrorType.None); + end + end + end + end; procedure r_Player_DrawIndicator (p: TPlayer; Color: TRGB); var @@ -344,7 +363,7 @@ begin if p.FKeys[KEY_DOWN].Pressed then ID := PunchFrames[R_BERSERK in p.FRulez, 2] else if p.FKeys[KEY_UP].Pressed then ID := PunchFrames[R_BERSERK in p.FRulez, 1] else ID := PunchFrames[R_BERSERK in p.FRulez, 0]; - r_AnimationState_Draw(ID, p.PunchAnim, fX + IfThen(p.Direction = TDirection.D_LEFT, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15), fY + fSlope + p.Obj.Rect.Y - 11, Mirror); + r_AnimationState_Draw(ID, p.PunchAnim, fX + IfThen(p.Direction = TDirection.D_LEFT, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15), fY + fSlope + p.Obj.Rect.Y - 11, 0, Mirror, False); end; if (p.FMegaRulez[MR_INVUL] > gTime) and ((gPlayerDrawn <> p) or (p.SpawnInvul >= gTime)) then