X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fopengl%2Fr_player.pas;h=8b25eb491187301e6dd06a2972bb58a39b0cb9bc;hb=1443e95fdfcecd289bb2801121198caad9ecd039;hp=b9fae844a5a1cdba4b0875ca4a7b7e6595ebc779;hpb=9c0771925cdad1c02e69512635dd66d26438f13b;p=d2df-sdl.git diff --git a/src/game/opengl/r_player.pas b/src/game/opengl/r_player.pas index b9fae84..8b25eb4 100644 --- a/src/game/opengl/r_player.pas +++ b/src/game/opengl/r_player.pas @@ -17,7 +17,10 @@ unit r_player; interface - uses g_player, e_graphics; // TPlayer, TRGB + uses g_player, g_base; // TPlayer, TRGB + + procedure r_Player_Load; + procedure r_Player_Free; procedure r_Player_DrawAll; procedure r_Player_DrawDebug (p: TPlayer); @@ -42,9 +45,36 @@ implementation uses SysUtils, Classes, Math, MAPDEF, utils, - g_basic, g_game, g_phys, g_map, g_textures, g_menu, g_language, g_weapons, g_items, g_net, g_options + 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 ; + var + PunchFrames: array [Boolean, 0..2] of DWORD; + + procedure r_Player_Load; + begin + g_Frames_CreateWAD(@PunchFrames[False, 0], 'FRAMES_PUNCH', GameWAD + ':WEAPONS\PUNCH', 64, 64, 4, False); + g_Frames_CreateWAD(@PunchFrames[False, 1], 'FRAMES_PUNCH_UP', GameWAD + ':WEAPONS\PUNCH_UP', 64, 64, 4, False); + g_Frames_CreateWAD(@PunchFrames[False, 2], 'FRAMES_PUNCH_DN', GameWAD + ':WEAPONS\PUNCH_DN', 64, 64, 4, False); + 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); + end; + + procedure r_Player_Free; + begin + g_Frames_DeleteByName('FRAMES_PUNCH'); + g_Frames_DeleteByName('FRAMES_PUNCH_UP'); + g_Frames_DeleteByName('FRAMES_PUNCH_DN'); + g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK'); + g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_UP'); + g_Frames_DeleteByName('FRAMES_PUNCH_BERSERK_DN'); + end; + procedure r_Player_DrawAll; var i: Integer; begin @@ -93,38 +123,14 @@ begin end; end; -procedure r_Player_DrawCorpses; -var - i, fX, fY: Integer; - a: TDFPoint; -begin - if gGibs <> nil then - for i := 0 to High(gGibs) do - if gGibs[i].alive then - with gGibs[i] do - begin - if not g_Obj_Collide(sX, sY, sWidth, sHeight, @Obj) then - Continue; - - Obj.lerp(gLerpFactor, fX, fY); - - a.X := Obj.Rect.X+(Obj.Rect.Width div 2); - a.y := Obj.Rect.Y+(Obj.Rect.Height div 2); - - e_DrawAdv(ID, fX, fY, 0, True, False, RAngle, @a, TMirrorType.None); - - e_Colors := Color; - e_DrawAdv(MaskID, fX, fY, 0, True, False, RAngle, @a, TMirrorType.None); - e_Colors.R := 255; - e_Colors.G := 255; - e_Colors.B := 255; - end; - - if gCorpses <> nil then - for i := 0 to High(gCorpses) do - if gCorpses[i] <> nil then - r_Player_DrawCorpse(gCorpses[i]) -end; + procedure r_Player_DrawCorpses; + var i: Integer; + begin + if gCorpses <> nil then + for i := 0 to High(gCorpses) do + if gCorpses[i] <> nil then + r_Player_DrawCorpse(gCorpses[i]) + end; procedure r_Player_DrawShells; var @@ -325,14 +331,12 @@ begin else Mirror := TMirrorType.Horizontal; - if p.PunchAnim <> nil then + if p.PunchAnim.enabled then begin - p.PunchAnim.Draw(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); - if p.PunchAnim.played then - begin - p.PunchAnim.Free; - p.PunchAnim := nil; - end; + 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); end; if (p.FMegaRulez[MR_INVUL] > gTime) and ((gPlayerDrawn <> p) or (p.SpawnInvul >= gTime)) then @@ -357,15 +361,15 @@ begin else dr := True; if dr then - p.Model.Draw(fX, fY + fSlope, 200) + r_PlayerModel_Draw(p.Model, fX, fY + fSlope, 200) else - p.Model.Draw(fX, fY + fSlope); + r_PlayerModel_Draw(p.Model, fX, fY + fSlope); end else - p.Model.Draw(fX, fY + fSlope, 254); + r_PlayerModel_Draw(p.Model, fX, fY + fSlope, 254); end else - p.Model.Draw(fX, fY + fSlope); + r_PlayerModel_Draw(p.Model, fX, fY + fSlope); end; if g_debug_Frames then @@ -395,7 +399,7 @@ procedure r_Player_DrawAim (p: TPlayer); begin {$IFDEF ENABLE_HOLMES} - if isValidViewPort and (self = gPlayer1) then + if p.isValidViewPort() and (p = gPlayer1) then begin g_Holmes_plrLaser(ax0, ay0, ax1, ay1); end; @@ -791,12 +795,12 @@ begin p.Obj.lerp(gLerpFactor, fX, fY); if p.Animation <> nil then - p.Animation.Draw(fX, fY, TMirrorType.None); + r_Animation_Draw(p.Animation, fX, fY, TMirrorType.None); if p.AnimationMask <> nil then begin e_Colors := p.Color; - p.AnimationMask.Draw(fX, fY, TMirrorType.None); + r_Animation_Draw(p.AnimationMask, fX, fY, TMirrorType.None); e_Colors.R := 255; e_Colors.G := 255; e_Colors.B := 255;