index fe9769d2d9e6b158a7fc0e439390bd12f5930a32..9a984283979f63d9676da548bc34d8bffe020035 100644 (file)
WeapTextures: array [0..WP_LAST, 0..W_POS_LAST, 0..W_ACT_LAST] of TGLTexture;
ShotTextures: array [0..WEAPON_LAST] of TGLMultiTexture;
FlagTextures: array [0..FLAG_LAST] of TGLMultiTexture;
WeapTextures: array [0..WP_LAST, 0..W_POS_LAST, 0..W_ACT_LAST] of TGLTexture;
ShotTextures: array [0..WEAPON_LAST] of TGLMultiTexture;
FlagTextures: array [0..FLAG_LAST] of TGLMultiTexture;
+ PunchTextures: array [Boolean, 0..2] of TGLMultiTexture; // [berserk, center/up/down]
VileFire: TGLMultiTexture;
Models: array of record
anim: array [TDirection, 0..A_LAST] of record
VileFire: TGLMultiTexture;
Models: array of record
anim: array [TDirection, 0..A_LAST] of record
{$ENDIF}
end;
{$ENDIF}
end;
- StubShotAnim: TAnimState;
+ StubShotAnim: TAnimState; // TODO remove this hack
FlagAnim: TAnimState;
{$IFDEF ENABLE_SHELLS}
FlagAnim: TAnimState;
{$IFDEF ENABLE_SHELLS}
StubShotAnim.Invalidate;
end;
StubShotAnim.Invalidate;
end;
+ procedure r_Map_FreeModel (i: Integer);
+ var a: Integer; d: TDirection;
+ begin
+ for d := TDirection.D_LEFT to TDirection.D_RIGHT do
+ begin
+ for a := A_STAND to A_LAST do
+ begin
+ if Models[i].anim[d, a].base <> nil then
+ Models[i].anim[d, a].base.Free;
+ if Models[i].anim[d, a].mask <> nil then
+ Models[i].anim[d, a].mask.Free;
+ Models[i].anim[d, a].base := nil;
+ Models[i].anim[d, a].mask := nil;
+ end;
+ end;
+ {$IFDEF ENABLE_GIBS}
+ if Models[i].gibs.base <> nil then
+ for a := 0 to High(Models[i].gibs.base) do
+ Models[i].gibs.base[a].Free;
+ if Models[i].gibs.mask <> nil then
+ for a := 0 to High(Models[i].gibs.mask) do
+ Models[i].gibs.mask[a].Free;
+ Models[i].gibs.base := nil;
+ Models[i].gibs.mask := nil;
+ Models[i].gibs.rect := nil;
+ {$ENDIF}
+ end;
+
procedure r_Map_LoadModel (i: Integer);
var prefix: AnsiString; a: Integer; d: TDirection; m: ^TPlayerModelInfo;
begin
ASSERT(i < Length(Models));
ASSERT(i < Length(PlayerModelsArray));
procedure r_Map_LoadModel (i: Integer);
var prefix: AnsiString; a: Integer; d: TDirection; m: ^TPlayerModelInfo;
begin
ASSERT(i < Length(Models));
ASSERT(i < Length(PlayerModelsArray));
+ r_Map_FreeModel(i);
m := @PlayerModelsArray[i];
prefix := m.FileName + ':TEXTURES/';
for d := TDirection.D_LEFT to TDirection.D_RIGHT do
m := @PlayerModelsArray[i];
prefix := m.FileName + ':TEXTURES/';
for d := TDirection.D_LEFT to TDirection.D_RIGHT do
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');
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');
+ PunchName: array [Boolean] of AnsiString = ('PUNCH', 'PUNCHB');
var
var
- i, j, k: Integer; d: TDirection;
+ i, j, k: Integer; d: TDirection; b: Boolean;
begin
// --------- items --------- //
for i := 0 to ITEM_LAST do
begin
// --------- items --------- //
for i := 0 to ITEM_LAST do
for i := 0 to SHELL_LAST do
ShellTextures[i] := r_Textures_LoadFromFile(GameWad + ':TEXTURES/' + ShellAnim[i].name);
{$ENDIF}
for i := 0 to SHELL_LAST do
ShellTextures[i] := r_Textures_LoadFromFile(GameWad + ':TEXTURES/' + ShellAnim[i].name);
{$ENDIF}
+ // --------- punch --------- //
+ for b := false to true do
+ begin
+ for i := 0 to 2 do
+ PunchTextures[b, i] := r_Textures_LoadMultiFromFileAndInfo(GameWad + ':WEAPONS/' + PunchName[b] + WeapPos[i], 64, 64, 4, false);
+ end;
end;
procedure r_Map_Free;
end;
procedure r_Map_Free;
- var i, j, k, a: Integer; d: TDirection;
+ var i, j, k: Integer; d: TDirection; b: Boolean;
begin
begin
+ for b := false to true do
+ begin
+ for i := 0 to 2 do
+ begin
+ if PunchTextures[b, i] <> nil then
+ PunchTextures[b, i].Free;
+ PunchTextures[b, i] := nil;
+ end;
+ end;
{$IFDEF ENABLE_SHELLS}
for i := 0 to SHELL_LAST do
begin
{$IFDEF ENABLE_SHELLS}
for i := 0 to SHELL_LAST do
begin
end;
end;
end;
end;
end;
end;
- for d := TDirection.D_LEFT to TDirection.D_RIGHT do
- begin
- for a := A_STAND to A_LAST do
- begin
- if Models[i].anim[d, a].base <> nil then
- Models[i].anim[d, a].base.Free;
- if Models[i].anim[d, a].mask <> nil then
- Models[i].anim[d, a].mask.Free;
- Models[i].anim[d, a].base := nil;
- Models[i].anim[d, a].mask := nil;
- end;
- end;
+ if Models <> nil then
+ for i := 0 to High(Models) do
+ r_Map_FreeModel(i);
for i := MONSTER_DEMON to MONSTER_MAN do
begin
for j := 0 to ANIM_LAST do
for i := MONSTER_DEMON to MONSTER_MAN do
begin
for j := 0 to ANIM_LAST do
begin
it.obj.Lerp(gLerpFactor, fX, fY);
r_Draw_MultiTextureRepeat(t, Items[it.ItemType].anim, fX, fY, t.width, t.height, false, 255, 255, 255, 255, false);
begin
it.obj.Lerp(gLerpFactor, fX, fY);
r_Draw_MultiTextureRepeat(t, Items[it.ItemType].anim, fX, fY, t.width, t.height, false, 255, 255, 255, 255, false);
- // if g_debug_frames then // TODO draw collision frame
end;
end;
end;
end;
end;
end;
end;
end;
+ // TODO draw g_debug_frames
end;
function r_Map_GetMonsterTexture (m, a: Integer; d: TDirection; out t: TGLMultiTexture; out dx, dy: Integer; out flip: Boolean): Boolean;
end;
function r_Map_GetMonsterTexture (m, a: Integer; d: TDirection; out t: TGLMultiTexture; out dx, dy: Integer; out flip: Boolean): Boolean;
if r_Map_GetMonsterTexture(m, a, d, t, dx, dy, flip) then
r_Draw_MultiTextureRepeat(t, mon.DirAnim[a, d], fX + dx, fY + dy, t.width, t.height, flip, 255, 255, 255, 255, false);
if r_Map_GetMonsterTexture(m, a, d, t, dx, dy, flip) then
r_Draw_MultiTextureRepeat(t, mon.DirAnim[a, d], fX + dx, fY + dy, t.width, t.height, flip, 255, 255, 255, 255, false);
-{
- if g_debug_frames
- // TODO draw frame
-}
+ // TODO draw g_debug_frames
end;
procedure r_Map_DrawMonsters (x, y, w, h: Integer);
end;
procedure r_Map_DrawMonsters (x, y, w, h: Integer);
end;
procedure r_Map_DrawPlayer (p: TPlayer);
end;
procedure r_Map_DrawPlayer (p: TPlayer);
- var fX, fY, fSlope: Integer;
+ var fX, fY, fSlope, ax, ay: Integer; b, flip: Boolean; t: TGLMultiTexture;
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);
- // TODO draw punch
+ if p.PunchAnim.IsValid() and p.PunchAnim.enabled then
+ begin
+ b := R_BERSERK in p.FRulez;
+ if p.FKeys[KEY_DOWN].pressed then
+ t := PunchTextures[b, 2]
+ else if p.FKeys[KEY_UP].pressed then
+ t := PunchTextures[b, 1]
+ else
+ t := PunchTextures[b, 0];
+ if t <> nil then
+ begin
+ flip := p.Direction = TDirection.D_LEFT;
+ ax := IfThen(flip, 15 - p.Obj.Rect.X, p.Obj.Rect.X - 15); // ???
+ ay := p.Obj.Rect.Y - 11;
+ 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);
// TODO invul pentagram
// TODO draw it with transparency
r_Map_DrawPlayerModel(p.Model, fX, fY + fSlope);
procedure r_Map_DrawPlayers (x, y, w, h: Integer);
var i: Integer;
begin
procedure r_Map_DrawPlayers (x, y, w, h: Integer);
var i: Integer;
begin
- // TODO draw only visible
if gPlayers <> nil then
for i := 0 to High(gPlayers) do
if gPlayers[i] <> nil then
if gPlayers <> nil then
for i := 0 to High(gPlayers) do
if gPlayers[i] <> nil then
end;
end;
end;
end;
end;
end;
+ // TODO draw g_debug_frames
end;
{$ENDIF}
end;
{$ENDIF}
end;
end;
end;
end;
end;
end;
+ // TODO draw g_debug_frames
end;
{$ENDIF}
end;
{$ENDIF}
end;
end;
end;
end;
end;
end;
+ // TODO draw g_debug_frames
end;
procedure r_Map_DrawFlags (x, y, w, h: Integer);
end;
procedure r_Map_DrawFlags (x, y, w, h: Integer);
if flip then dx := -1 else dx := +1;
tex := FlagTextures[i];
r_Draw_MultiTextureRepeat(tex, FlagAnim, fx + dx, fy + 1, tex.width, tex.height, flip, 255, 255, 255, 255, false)
if flip then dx := -1 else dx := +1;
tex := FlagTextures[i];
r_Draw_MultiTextureRepeat(tex, FlagAnim, fx + dx, fy + 1, tex.width, tex.height, flip, 255, 255, 255, 255, false)
- // TODO g_debug_frames
end;
end;
end;
end;
end;
end;
+ // TODO g_debug_frames
end;
{$IFDEF ENABLE_SHELLS}
end;
{$IFDEF ENABLE_SHELLS}
ww := w;
hh := h;
ww := w;
hh := h;
+ // TODO lock camera at map bounds
+
+ // TODO draw paralax
if SkyTexture <> nil then
r_Draw_Texture(SkyTexture, x, y, w, h, false, 255, 255, 255, 255, false);
if SkyTexture <> nil then
r_Draw_Texture(SkyTexture, x, y, w, h, false, 255, 255, 255, 255, false);
r_Map_DrawPanelType(PANEL_ACID2);
r_Map_DrawPanelType(PANEL_WATER);
r_Map_DrawPanelType(PANEL_FORE);
r_Map_DrawPanelType(PANEL_ACID2);
r_Map_DrawPanelType(PANEL_WATER);
r_Map_DrawPanelType(PANEL_FORE);
+ // TODO draw monsters health bar
+ // TODO draw players health bar
+ // TODO draw players indicators
glPopMatrix;
glPopMatrix;
+
+ // TODO draw player pain
+ // TODO draw player pickup
+ // TODO draw player invul
+ // TODO draw minimap
+ // TODO draw g_debug_player
end;
procedure r_Map_Update;
end;
procedure r_Map_Update;