index 9a984283979f63d9676da548bc34d8bffe020035..3ef4979ad1fadf181c8879a2cb7106b445fb863f 100644 (file)
interface
interface
- uses g_base; // TRectWH
+ uses g_base, g_player; // TRectWH, TPlayer
procedure r_Map_Initialize;
procedure r_Map_Finalize;
procedure r_Map_Initialize;
procedure r_Map_Finalize;
procedure r_Map_Update;
procedure r_Map_Update;
- procedure r_Map_Draw (x, y, w, h, camx, camy: Integer);
+ procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer);
implementation
implementation
e_log,
binheap, MAPDEF, utils,
g_options, g_textures, g_basic, g_phys,
e_log,
binheap, MAPDEF, utils,
g_options, g_textures, g_basic, g_phys,
- g_game, g_map, g_panel, g_items, g_monsters, g_playermodel, g_player, g_weapons,
+ g_game, g_map, g_panel, g_items, g_monsters, g_playermodel, g_weapons,
{$IFDEF ENABLE_CORPSES}
g_corpses,
{$ENDIF}
{$IFDEF ENABLE_CORPSES}
g_corpses,
{$ENDIF}
FlagTextures: array [0..FLAG_LAST] of TGLMultiTexture;
PunchTextures: array [Boolean, 0..2] of TGLMultiTexture; // [berserk, center/up/down]
VileFire: TGLMultiTexture;
FlagTextures: array [0..FLAG_LAST] of TGLMultiTexture;
PunchTextures: array [Boolean, 0..2] of TGLMultiTexture; // [berserk, center/up/down]
VileFire: TGLMultiTexture;
+ InvulPenta: TGLTexture;
Models: array of record
anim: array [TDirection, 0..A_LAST] of record
base, mask: TGLMultiTexture;
Models: array of record
anim: array [TDirection, 0..A_LAST] of record
base, mask: TGLMultiTexture;
// ok
end;
end;
// ok
end;
end;
- for a := 0 to m.GibsCount - 1 do
- e_logwritefln('model %s gib %s: %sx%s:%sx%s', [i, a, Models[i].gibs.rect[a].x, Models[i].gibs.rect[a].y, Models[i].gibs.rect[a].width, Models[i].gibs.rect[a].height]);
end;
{$ENDIF}
end;
end;
{$ENDIF}
end;
for i := 0 to 2 do
PunchTextures[b, i] := r_Textures_LoadMultiFromFileAndInfo(GameWad + ':WEAPONS/' + PunchName[b] + WeapPos[i], 64, 64, 4, false);
end;
for i := 0 to 2 do
PunchTextures[b, i] := r_Textures_LoadMultiFromFileAndInfo(GameWad + ':WEAPONS/' + PunchName[b] + WeapPos[i], 64, 64, 4, false);
end;
+ // --------- other --------- //
+ InvulPenta := r_Textures_LoadFromFile(GameWad + ':TEXTURES/PENTA');
end;
procedure r_Map_Free;
var i, j, k: Integer; d: TDirection; b: Boolean;
begin
end;
procedure r_Map_Free;
var i, j, k: Integer; d: TDirection; b: Boolean;
begin
+ if InvulPenta <> nil then
+ InvulPenta.Free;
+ InvulPenta := nil;
for b := false to true do
begin
for i := 0 to 2 do
for b := false to true do
begin
for i := 0 to 2 do
end;
end;
end;
end;
- procedure r_Map_DrawPlayerModel (pm: TPlayerModel; x, y: Integer);
+ procedure r_Map_DrawPlayerModel (pm: TPlayerModel; x, y: Integer; alpha: Byte);
var a, pos, act, xx, yy, angle: Integer; d: TDirection; flip: Boolean; t: TGLMultiTexture; tex: TGLTexture; c: TRGB;
begin
a := pm.CurrentAnimation;
var a, pos, act, xx, yy, angle: Integer; d: TDirection; flip: Boolean; t: TGLMultiTexture; tex: TGLTexture; c: TRGB;
begin
a := pm.CurrentAnimation;
tex.width,
tex.height,
d = TDirection.D_LEFT,
tex.width,
tex.height,
d = TDirection.D_LEFT,
- 255, 255, 255, 255, false
+ 255, 255, 255, alpha, false
);
end;
end;
);
end;
end;
if r_Map_GetPlayerModelTex(pm.id, a, d, flip) then
begin
t := Models[pm.id].anim[d, a].base;
if r_Map_GetPlayerModelTex(pm.id, a, d, flip) then
begin
t := Models[pm.id].anim[d, a].base;
- r_Draw_MultiTextureRepeat(t, pm.AnimState, x, y, t.width, t.height, flip, 255, 255, 255, 255, false);
+ r_Draw_MultiTextureRepeat(t, pm.AnimState, x, y, t.width, t.height, flip, 255, 255, 255, alpha, false);
t := Models[pm.id].anim[d, a].mask;
if t <> nil then
begin
c := pm.Color;
t := Models[pm.id].anim[d, a].mask;
if t <> nil then
begin
c := pm.Color;
- r_Draw_MultiTextureRepeat(t, pm.AnimState, x, y, t.width, t.height, flip, c.r, c.g, c.b, 255, false);
+ r_Draw_MultiTextureRepeat(t, pm.AnimState, x, y, t.width, t.height, flip, c.r, c.g, c.b, alpha, false);
end;
end;
end;
end;
end;
end;
- procedure r_Map_DrawPlayer (p: TPlayer);
- var fX, fY, fSlope, ax, ay: Integer; b, flip: Boolean; t: TGLMultiTexture;
+ procedure r_Map_DrawPlayer (p, drawed: TPlayer);
+ var fX, fY, fSlope, ax, ay, w, h: Integer; b, flip: Boolean; t: TGLMultiTexture; alpha: Byte;
begin
if p.alive then
begin
begin
if p.alive then
begin
// TODO fix lerp
//p.obj.Lerp(gLerpFactor, fX, fY);
fSlope := nlerp(p.SlopeOld, p.obj.slopeUpLeft, gLerpFactor);
// TODO fix lerp
//p.obj.Lerp(gLerpFactor, fX, fY);
fSlope := nlerp(p.SlopeOld, p.obj.slopeUpLeft, gLerpFactor);
+
+ (* punch effect *)
if p.PunchAnim.IsValid() and p.PunchAnim.enabled then
begin
b := R_BERSERK in p.FRulez;
if p.PunchAnim.IsValid() and p.PunchAnim.enabled then
begin
b := R_BERSERK in p.FRulez;
r_Draw_MultiTextureRepeat(t, p.PunchAnim, fx + ax, fy + fSlope + ay, t.width, t.height, flip, 255, 255, 255, 255, false)
end;
end;
r_Draw_MultiTextureRepeat(t, p.PunchAnim, fx + ax, fy + fSlope + ay, t.width, t.height, flip, 255, 255, 255, 255, false)
end;
end;
- // TODO invul pentagram
- // TODO draw it with transparency
- r_Map_DrawPlayerModel(p.Model, fX, fY + fSlope);
+
+ (* invulnerability effect *)
+ if (InvulPenta <> nil) and (p.FMegaRulez[MR_INVUL] > gTime) and ((p <> drawed) or (p.SpawnInvul >= gTime)) then
+ begin
+ w := InvulPenta.width;
+ h := InvulPenta.height;
+ ax := p.Obj.Rect.X + (p.Obj.Rect.Width div 2) - (w div 2); // + IfThen(flip, +4, -2) // ???
+ ay := p.Obj.Rect.Y + (p.Obj.Rect.Height div 2) - (h div 2) - 7; // ???
+ r_Draw_Texture(InvulPenta, fx + ax, fy + ay + fSlope, w, h, false, 255, 255, 255, 255, false);
+ end;
+
+ (* invisibility effect *)
+ alpha := 255;
+ if p.FMegaRulez[MR_INVIS] > gTime then
+ begin
+ if (drawed <> nil) and ((p = drawed) or ((p.Team = drawed.Team) and (gGameSettings.GameMode <> GM_DM))) then
+ begin
+ if (p.FMegaRulez[MR_INVIS] - gTime <= 2100) and not ODD((p.FMegaRulez[MR_INVIS] - gTime) div 300) then
+ alpha := 55;
+ end
+ else
+ alpha := 1; // ???
+ end;
+
+ r_Map_DrawPlayerModel(p.Model, fX, fY + fSlope, alpha);
end;
// TODO draw g_debug_frames
// TODO draw chat bubble
// TODO draw aim
end;
end;
// TODO draw g_debug_frames
// TODO draw chat bubble
// TODO draw aim
end;
- procedure r_Map_DrawPlayers (x, y, w, h: Integer);
+ procedure r_Map_DrawPlayers (x, y, w, h: Integer; player: TPlayer);
var i: Integer;
begin
if gPlayers <> nil then
for i := 0 to High(gPlayers) do
if gPlayers[i] <> nil then
var i: Integer;
begin
if gPlayers <> nil then
for i := 0 to High(gPlayers) do
if gPlayers[i] <> nil then
- r_Map_DrawPlayer(gPlayers[i]);
+ r_Map_DrawPlayer(gPlayers[i], player);
end;
{$IFDEF ENABLE_GIBS}
end;
{$IFDEF ENABLE_GIBS}
if (p <> nil) and (p.state <> CORPSE_STATE_REMOVEME) and (p.model <> nil) then
begin
p.obj.Lerp(gLerpFactor, fX, fY);
if (p <> nil) and (p.state <> CORPSE_STATE_REMOVEME) and (p.model <> nil) then
begin
p.obj.Lerp(gLerpFactor, fX, fY);
- r_Map_DrawPlayerModel(p.model, fX, fY);
+ r_Map_DrawPlayerModel(p.model, fX, fY, 255);
end;
end;
end;
end;
end;
end;
end;
{$ENDIF}
end;
{$ENDIF}
- procedure r_Map_Draw (x, y, w, h, camx, camy: Integer);
+ procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer);
var iter: TPanelGrid.Iter; p: PPanel; cx, cy, xx, yy, ww, hh: Integer;
begin
cx := camx - w div 2;
var iter: TPanelGrid.Iter; p: PPanel; cx, cy, xx, yy, ww, hh: Integer;
begin
cx := camx - w div 2;
ww := w;
hh := h;
ww := w;
hh := h;
- // TODO lock camera at map bounds
+ if g_dbg_ignore_bounds = false then
+ begin
+ if xx + ww > gMapInfo.Width then
+ xx := gMapInfo.Width - ww;
+ if yy + hh > gMapInfo.Height then
+ yy := gMapInfo.Height - hh;
+ if xx < 0 then
+ xx := 0;
+ if yy < 0 then
+ yy := 0;
+ cx := xx - x;
+ cy := yy - y;
+ end;
// TODO draw paralax
if SkyTexture <> nil then
// TODO draw paralax
if SkyTexture <> nil then
{$IFDEF ENABLE_SHELLS}
r_Map_DrawShells(xx, yy, ww, hh);
{$ENDIF}
{$IFDEF ENABLE_SHELLS}
r_Map_DrawShells(xx, yy, ww, hh);
{$ENDIF}
- r_Map_DrawPlayers(xx, yy, ww, hh);
+ r_Map_DrawPlayers(xx, yy, ww, hh, player);
{$IFDEF ENABLE_GIBS}
r_Map_DrawGibs(xx, yy, ww, hh);
{$ENDIF}
{$IFDEF ENABLE_GIBS}
r_Map_DrawGibs(xx, yy, ww, hh);
{$ENDIF}