summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3a76b7e)
raw | patch | inline | side by side (parent: 3a76b7e)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 16 Jan 2022 18:49:28 +0000 (21:49 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 16 Jan 2022 18:49:28 +0000 (21:49 +0300) |
src/game/g_map.pas | patch | blob | history | |
src/game/opengl/r_map.pas | patch | blob | history | |
src/game/opengl/r_render.pas | patch | blob | history |
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index f53fd1500ec723ef7bdcfca6c93aa7c37dbfc24b..2ca5bb67c604fc8f1f03c53aa87575eb260524e2 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
State: Byte;
Count: Integer;
CaptureTime: LongWord;
- Animation: TAnimation;
Direction: TDirection;
end;
procedure CreateArea(Area: TDynRecord);
var
a: Integer;
- id: DWORD = 0;
begin
case Area.AreaType of
AREA_DMPOINT, AREA_PLAYERPOINT1, AREA_PLAYERPOINT2,
with gFlags[a] do
begin
- case a of
- FLAG_RED: g_Frames_Get(id, 'FRAMES_FLAG_RED');
- FLAG_BLUE: g_Frames_Get(id, 'FRAMES_FLAG_BLUE');
- end;
-
- Animation := TAnimation.Create(id, True, 8);
Obj.Rect := FLAGRECT;
-
g_Map_ResetFlag(a);
end;
end;
begin
with gFlags[a] do
begin
- if gFlags[a].Animation <> nil then gFlags[a].Animation.Update();
-
m := g_Obj_Move(@Obj, True, True);
if gTime mod (GAME_TICK*2) <> 0 then Continue;
index 50d06d03c88d3cf55380a11864f44df446fb4754..1970ac3baf39de4462a1fe43818ba205734b3463 100644 (file)
uses g_panel, MAPDEF; // TPanel, TDFColor
+ procedure r_Map_Initialize;
+ procedure r_Map_Finalize;
+
+ procedure r_Map_Load;
+ procedure r_Map_Free;
+
procedure r_Map_LoadTextures;
+ // TODO procedure r_Map_FreeTextures
+
+ procedure r_Map_Update;
procedure r_Map_DrawBack (dx, dy: Integer);
procedure r_Map_DrawPanels (PanelType: Word; hasAmbient: Boolean; constref ambColor: TDFColor); // unaccelerated
uses
{$INCLUDE ../nogl/noGLuses.inc}
SysUtils, Classes, Math, e_log, wadreader, CONFIG, utils,
- r_graphics, r_animations, r_textures,
+ r_graphics, r_animations, r_textures, g_textures,
g_base, g_basic, g_game, g_options,
g_map
;
Width, Height: WORD;
Anim: Boolean;
end;
+ FlagFrames: array [FLAG_RED..FLAG_BLUE] of DWORD;
+ FlagAnim: TAnimationState;
+
+ procedure r_Map_Initialize;
+ begin
+ FlagAnim := TAnimationState.Create(True, 8, 5);
+ end;
+
+ procedure r_Map_Finalize;
+ begin
+ FlagAnim.Free;
+ FlagAnim := nil;
+ end;
+
+ procedure r_Map_Load;
+ begin
+ g_Frames_CreateWAD(@FlagFrames[FLAG_RED], 'FRAMES_FLAG_RED', GameWAD + ':TEXTURES\FLAGRED', 64, 64, 5, False);
+ g_Frames_CreateWAD(@FlagFrames[FLAG_BLUE], 'FRAMES_FLAG_BLUE', GameWAD + ':TEXTURES\FLAGBLUE', 64, 64, 5, False);
+ end;
+
+ procedure r_Map_Free;
+ begin
+ g_Frames_DeleteByName('FRAMES_FLAG_RED');
+ g_Frames_DeleteByName('FRAMES_FLAG_BLUE');
+ end;
procedure r_Map_LoadTextures;
const
e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
end;
-procedure r_Map_DrawFlags();
-var
- i, dx: Integer;
- Mirror: TMirrorType;
-begin
- if gGameSettings.GameMode <> GM_CTF then
- Exit;
-
- for i := FLAG_RED to FLAG_BLUE do
- with gFlags[i] do
- if State <> FLAG_STATE_CAPTURED then
+ procedure r_Map_DrawFlags;
+ var i, dx: Integer; Mirror: TMirrorType; f: PFlag;
+ begin
+ if gGameSettings.GameMode = GM_CTF then
+ begin
+ for i := FLAG_RED to FLAG_BLUE do
begin
- if State = FLAG_STATE_NONE then
- continue;
-
- if Direction = TDirection.D_LEFT then
- begin
- Mirror := TMirrorType.Horizontal;
- dx := -1;
- end
- else
- begin
- Mirror := TMirrorType.None;
- dx := 1;
- end;
-
- r_Animation_Draw(Animation, Obj.X + dx, Obj.Y + 1, Mirror);
-
- if g_debug_Frames then
+ f := @gFlags[i];
+ if not (f.State in [FLAG_STATE_NONE, FLAG_STATE_CAPTURED]) then
begin
- e_DrawQuad(Obj.X+Obj.Rect.X,
- Obj.Y+Obj.Rect.Y,
- Obj.X+Obj.Rect.X+Obj.Rect.Width-1,
- Obj.Y+Obj.Rect.Y+Obj.Rect.Height-1,
- 0, 255, 0);
- end;
- end;
-end;
+ if f.Direction = TDirection.D_LEFT then
+ Mirror := TMirrorType.Horizontal
+ else
+ Mirror := TMirrorType.None;
+ dx := IfThen(f.Direction = TDirection.D_LEFT, -1, +1);
+ r_AnimationState_Draw(FlagFrames[i], FlagAnim, f.Obj.X + dx, f.Obj.Y + 1, Mirror);
+ if g_debug_Frames then
+ e_DrawQuad(f.Obj.X + f.Obj.Rect.X, f.Obj.Y + f.Obj.Rect.Y, f.Obj.X + f.Obj.Rect.X + f.Obj.Rect.Width - 1, f.Obj.Y + f.Obj.Rect.Y + f.Obj.Rect.Height - 1, 0, 255, 0)
+ end
+ end
+ end
+ end;
procedure r_Panel_Draw (constref p: TPanel; hasAmbient: Boolean; constref ambColor: TDFColor);
var xx, yy: Integer; NoTextureID, TextureID, FramesID: DWORD; NW, NH: Word; Texture: Cardinal; IsAnim: Boolean; w, h: Integer;
end
end;
+ procedure r_Map_Update;
+ begin
+ FlagAnim.Update
+ end;
+
end.
index b26d0ecbea851752387b952675dc49f0e074789a..50e5892e9ee0366ce0f9359cafd67f66e4b408be 100644 (file)
e_log, g_system,
g_game, g_options, g_console,
r_window, r_graphics, r_console, r_playermodel,
- r_weapons, r_items, r_gfx, r_monsters
+ r_weapons, r_items, r_gfx, r_monsters, r_map
;
var
procedure r_Render_Load;
begin
+ r_Map_Load;
r_PlayerModel_Load;
r_Monsters_Load;
r_Weapon_Load;
r_Weapon_Free;
r_Monsters_Free;
r_PlayerModel_Free;
+ r_Map_Free;
end;
procedure r_Render_Initialize;
r_Window_Initialize;
r_Console_Init;
r_PlayerModel_Initialize;
+ r_Map_Initialize;
end;
procedure r_Render_Finalize;
begin
+ r_Map_Finalize;
r_PlayerModel_Finalize;
FreeGL;
e_ReleaseEngine
procedure r_Render_Update;
begin
+ r_Map_Update;
r_PlayerModel_Update;
end;