summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed44a0d)
raw | patch | inline | side by side (parent: ed44a0d)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 17 Sep 2017 03:01:36 +0000 (06:01 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Sun, 17 Sep 2017 03:02:00 +0000 (06:02 +0300) |
39 files changed:
index 467994f5fdd0869eb031d10b31afbb2efd8bda8e..6362cd11437986e6eba5c5da168560e11145f06c 100644 (file)
SysUtils, Classes, Math, e_log, e_texture, SDL2, GL, GLExt, MAPDEF, ImagingTypes, Imaging, ImagingUtility;
type
- TMirrorType=(M_NONE, M_HORIZONTAL, M_VERTICAL);
- TBlending=(B_NONE, B_BLEND, B_FILTER, B_INVERT);
+ TMirrorType=(None, Horizontal, Vertical);
+ TBlending=(None, Blend, Filter, Invert);
TPoint2i = record
X, Y: Integer;
procedure e_ResizeWindow(Width, Height: Integer);
procedure e_Draw(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Mirror: TMirrorType = TMirrorType.None);
procedure e_DrawAdv(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Angle: Single; RC: PDFPoint; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Angle: Single; RC: PDFPoint; Mirror: TMirrorType = TMirrorType.None);
procedure e_DrawSize(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = TMirrorType.None);
procedure e_DrawSizeMirror(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = TMirrorType.None);
procedure e_DrawFill(ID: DWORD; X, Y: Integer; XCount, YCount: Word; Alpha: Integer;
AlphaChannel: Boolean; Blending: Boolean; ambientBlendMode: Boolean=false);
procedure e_DrawLine(Width: Byte; X1, Y1, X2, Y2: Integer; Red, Green, Blue: Byte; Alpha: Byte = 0);
procedure e_DrawQuad(X1, Y1, X2, Y2: Integer; Red, Green, Blue: Byte; Alpha: Byte = 0);
procedure e_DrawFillQuad(X1, Y1, X2, Y2: Integer; Red, Green, Blue, Alpha: Byte;
- Blending: TBlending = B_NONE);
+ Blending: TBlending = TBlending.None);
procedure e_DarkenQuad (x0, y0, x1, y1: Integer; a: Integer);
procedure e_DarkenQuadWH (x, y, w, h: Integer; a: Integer);
begin
Result := False;
- e_WriteLog('Loading texture from '+FileName, MSG_NOTIFY);
+ e_WriteLog('Loading texture from '+FileName, TMsgType.Notify);
find_id := FindTexture();
if (w < 1) or (h < 1) then exit;
x1 := x0+w;
y1 := y0+h;
- if Mirror = M_HORIZONTAL then begin tmp := x1; x1 := x0; x0 := tmp; end
- else if Mirror = M_VERTICAL then begin tmp := y1; y1 := y0; y0 := tmp; end;
+ if Mirror = TMirrorType.Horizontal then begin tmp := x1; x1 := x0; x0 := tmp; end
+ else if Mirror = TMirrorType.Vertical then begin tmp := y1; y1 := y0; y0 := tmp; end;
//HACK: make texture one pixel shorter, so it won't wrap
if (g_dbg_scale <> 1.0) then
begin
end;
procedure e_Draw(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Mirror: TMirrorType = TMirrorType.None);
begin
if e_NoGraphics then Exit;
glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
end;
procedure e_DrawSize(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = TMirrorType.None);
var
u, v: Single;
begin
end;
procedure e_DrawSizeMirror(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Width, Height: Word; Mirror: TMirrorType = TMirrorType.None);
begin
if e_NoGraphics then Exit;
glColor4ub(e_Colors.R, e_Colors.G, e_Colors.B, 255);
procedure e_DrawAdv(ID: DWORD; X, Y: Integer; Alpha: Byte; AlphaChannel: Boolean;
- Blending: Boolean; Angle: Single; RC: PDFPoint; Mirror: TMirrorType = M_NONE);
+ Blending: Boolean; Angle: Single; RC: PDFPoint; Mirror: TMirrorType = TMirrorType.None);
begin
if e_NoGraphics then Exit;
end;
procedure e_DrawFillQuad(X1, Y1, X2, Y2: Integer; Red, Green, Blue, Alpha: Byte;
- Blending: TBlending = B_NONE);
+ Blending: TBlending = TBlending.None);
begin
if e_NoGraphics then Exit;
- if (Alpha > 0) or (Blending <> B_NONE) then
+ if (Alpha > 0) or (Blending <> TBlending.None) then
glEnable(GL_BLEND)
else
glDisable(GL_BLEND);
- if Blending = B_BLEND then
+ if Blending = TBlending.Blend then
glBlendFunc(GL_SRC_ALPHA, GL_ONE)
else
- if Blending = B_FILTER then
+ if Blending = TBlending.Filter then
glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR)
else
- if Blending = B_INVERT then
+ if Blending = TBlending.Invert then
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO)
else
if Alpha > 0 then
var
i, id: DWORD;
begin
- e_WriteLog('Creating CharFont...', MSG_NOTIFY);
+ e_WriteLog('Creating CharFont...', TMsgType.Notify);
id := DWORD(-1);
i, id: DWORD;
begin
if e_NoGraphics then Exit;
- e_WriteLog('Creating texture font...', MSG_NOTIFY);
+ e_WriteLog('Creating texture font...', TMsgType.Notify);
id := DWORD(-1);
diff --git a/src/engine/e_input.pas b/src/engine/e_input.pas
index 072dccb44cd6d592f369191e12a8b5988c6b14e9..5cf17a788264ffc00dde1b8f1e524135680878a0 100644 (file)
--- a/src/engine/e_input.pas
+++ b/src/engine/e_input.pas
begin
Inc(c);
e_WriteLog('Input: Opened SDL joystick ' + IntToStr(i) + ' (' + SDL_JoystickName(joy) +
- ') as joystick ' + IntToStr(c) + ':', MSG_NOTIFY);
+ ') as joystick ' + IntToStr(c) + ':', TMsgType.Notify);
SetLength(Joysticks, c);
with Joysticks[c-1] do
begin
// TODO: find proper solution for this xbox trigger shit
for j := 0 to Axes do AxisZero[j] := SDL_JoystickGetAxis(joy, j);
e_WriteLog(' ' + IntToStr(Axes) + ' axes, ' + IntToStr(Buttons) + ' buttons, ' +
- IntToStr(Hats) + ' hats.', MSG_NOTIFY);
+ IntToStr(Hats) + ' hats.', TMsgType.Notify);
end;
end;
end;
diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas
index ed4cfe525f4479957cca8754c690a99be9f64b4c..4ba21561043872f9546d5e13e6760c2bb8a6d25c 100644 (file)
--- a/src/engine/e_log.pas
+++ b/src/engine/e_log.pas
type
TWriteMode = (WM_NEWFILE, WM_OLDFILE);
- TRecordCategory = (MSG_FATALERROR, MSG_WARNING, MSG_NOTIFY);
+ TMsgType = (Fatal, Warning, Notify);
procedure e_InitLog (fFileName: String; fWriteMode: TWriteMode);
procedure e_SetSafeSlowLog (slowAndSafe: Boolean);
-procedure e_WriteLog (TextLine: String; RecordCategory: TRecordCategory; WriteTime: Boolean=True);
+procedure e_WriteLog (TextLine: String; RecordCategory: TMsgType; WriteTime: Boolean=True);
function DecodeIPV4 (ip: LongWord): string;
// start Write/WriteLn driver. it will write everything to cbuf.
procedure e_InitWritelnDriver ();
-procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true);
-procedure e_LogWriteln (const s: AnsiString; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true);
+procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true);
+procedure e_LogWriteln (const s: AnsiString; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true);
procedure e_WriteStackTrace (const msg: AnsiString);
end;
-procedure e_WriteLog (TextLine: String; RecordCategory: TRecordCategory; WriteTime: Boolean=True);
+procedure e_WriteLog (TextLine: String; RecordCategory: TMsgType; WriteTime: Boolean=True);
begin
e_LogWritefln('%s', [TextLine], RecordCategory, WriteTime);
end;
-procedure e_LogWriteln (const s: AnsiString; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true);
+procedure e_LogWriteln (const s: AnsiString; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true);
begin
e_LogWritefln('%s', [s], category, writeTime);
end;
end;
-procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true);
+procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TMsgType=TMsgType.Notify; writeTime: Boolean=true);
procedure xwrite (const s: AnsiString);
begin
if driverInited and (length(fmt) > 0) then
begin
case category of
- MSG_FATALERROR: write('FATAL: ');
- MSG_WARNING: write('WARNING: ');
+ TMsgType.Fatal: write('FATAL: ');
+ TMsgType.Warning: write('WARNING: ');
end;
formatstrf(fmt, args, conwriter);
writeln;
xlogPrefix := '';
if writeTime then begin xlogPrefix += '['; xlogPrefix += TimeToStr(Time); xlogPrefix += '] '; end;
case category of
- MSG_FATALERROR: xlogPrefix += '!!!';
- MSG_WARNING: xlogPrefix += '! ';
- MSG_NOTIFY: xlogPrefix += '***';
+ TMsgType.Fatal: xlogPrefix += '!!!';
+ TMsgType.Warning: xlogPrefix += '! ';
+ TMsgType.Notify: xlogPrefix += '***';
end;
xlogLastWasEOL := true; // to output prefix
xlogWantSpace := true; // after prefix
if xlogFileOpened then CloseFile(xlogFile);
xlogFileOpened := false;
FileName := fFileName;
- if (fWriteMode = WM_NEWFILE) then
+ if (fWriteMode = TWriteMode.WM_NEWFILE) then
begin
try
if FileExists(FileName) then DeleteFile(FileName);
var
tfo: TextFile;
begin
- e_LogWriteln(msg, MSG_FATALERROR);
+ e_LogWriteln(msg, TMsgType.Fatal);
if (Length(FileName) > 0) then
begin
if xlogFileOpened then CloseFile(xlogFile);
index 5e1c811fe994d0b119aca6cf3cb8347507e9d797..bb12c810cc55dd61addc602e374148f08e742cda 100644 (file)
function TryInitWithOutput(Output: FMOD_OUTPUTTYPE; OutputName: String): FMOD_RESULT;
begin
- e_WriteLog('Trying with ' + OutputName + '...', MSG_WARNING);
+ e_WriteLog('Trying with ' + OutputName + '...', TMsgType.Warning);
Result := FMOD_System_SetOutput(F_System, Output);
if Result <> FMOD_OK then
begin
- e_WriteLog('Error setting FMOD output to ' + OutputName + '!', MSG_WARNING);
- e_WriteLog(FMOD_ErrorString(Result), MSG_WARNING);
+ e_WriteLog('Error setting FMOD output to ' + OutputName + '!', TMsgType.Warning);
+ e_WriteLog(FMOD_ErrorString(Result), TMsgType.Warning);
Exit;
end;
Result := FMOD_System_Init(F_System, N_CHANNELS, FMOD_INIT_NORMAL, nil);
if Result <> FMOD_OK then
begin
- e_WriteLog('Error initializing FMOD system!', MSG_WARNING);
- e_WriteLog(FMOD_ErrorString(Result), MSG_WARNING);
+ e_WriteLog('Error initializing FMOD system!', TMsgType.Warning);
+ e_WriteLog(FMOD_ErrorString(Result), TMsgType.Warning);
Exit;
end;
end;
begin
Result := False;
- e_WriteLog(Format('Trying to initialize FMOD with %d', [Freq]), MSG_NOTIFY);
+ e_WriteLog(Format('Trying to initialize FMOD with %d', [Freq]), TMsgType.Notify);
res := FMOD_System_Create(F_System);
if res <> FMOD_OK then
begin
- e_WriteLog('Error creating FMOD system:', MSG_FATALERROR);
- e_WriteLog(FMOD_ErrorString(res), MSG_FATALERROR);
+ e_WriteLog('Error creating FMOD system:', TMsgType.Fatal);
+ e_WriteLog(FMOD_ErrorString(res), TMsgType.Fatal);
Exit;
end;
res := FMOD_System_GetVersion(F_System, ver);
if res <> FMOD_OK then
begin
- e_WriteLog('Error getting FMOD version:', MSG_FATALERROR);
- e_WriteLog(FMOD_ErrorString(res), MSG_FATALERROR);
+ e_WriteLog('Error getting FMOD version:', TMsgType.Fatal);
+ e_WriteLog(FMOD_ErrorString(res), TMsgType.Fatal);
Exit;
end;
if ver < FMOD_VERSION then
begin
- e_WriteLog('FMOD library version is too old! Need '+IntToStr(FMOD_VERSION), MSG_FATALERROR);
+ e_WriteLog('FMOD library version is too old! Need '+IntToStr(FMOD_VERSION), TMsgType.Fatal);
Exit;
end;
res := FMOD_System_SetSoftwareFormat(F_System, Freq, FMOD_SOUND_FORMAT_PCM16, 0, 0, FMOD_DSP_RESAMPLER_LINEAR);
if res <> FMOD_OK then
begin
- e_WriteLog('Error setting FMOD software format!', MSG_FATALERROR);
- e_WriteLog(FMOD_ErrorString(res), MSG_FATALERROR);
+ e_WriteLog('Error setting FMOD software format!', TMsgType.Fatal);
+ e_WriteLog(FMOD_ErrorString(res), TMsgType.Fatal);
Exit;
end;
res := TryInitWithOutput(FMOD_OUTPUTTYPE_NOSOUND, 'OUTPUTTYPE_NOSOUND');
if res <> FMOD_OK then
begin
- e_WriteLog('FMOD: Giving up, can''t init with NOSOUND.', MSG_FATALERROR);
+ e_WriteLog('FMOD: Giving up, can''t init with NOSOUND.', TMsgType.Fatal);
Exit;
end;
end
res := FMOD_System_Init(F_System, N_CHANNELS, FMOD_INIT_NORMAL, nil);
if res <> FMOD_OK then
begin
- e_WriteLog('Error initializing FMOD system!', MSG_WARNING);
- e_WriteLog(FMOD_ErrorString(res), MSG_WARNING);
+ e_WriteLog('Error initializing FMOD system!', TMsgType.Warning);
+ e_WriteLog(FMOD_ErrorString(res), TMsgType.Warning);
{$IFDEF LINUX}
res := TryInitWithOutput(FMOD_OUTPUTTYPE_ALSA, 'OUTPUTTYPE_ALSA');
res := TryInitWithOutput(FMOD_OUTPUTTYPE_NOSOUND, 'OUTPUTTYPE_NOSOUND');
if res <> FMOD_OK then
begin
- e_WriteLog('FMOD: Giving up, can''t init any output.', MSG_FATALERROR);
+ e_WriteLog('FMOD: Giving up, can''t init any output.', TMsgType.Fatal);
Exit;
end;
end;
res := FMOD_System_GetOutput(F_System, output);
if res <> FMOD_OK then
- e_WriteLog('Error getting FMOD output!', MSG_WARNING)
+ e_WriteLog('Error getting FMOD output!', TMsgType.Warning)
else
case output of
- FMOD_OUTPUTTYPE_NOSOUND: e_WriteLog('FMOD Output Method: NOSOUND', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_NOSOUND_NRT: e_WriteLog('FMOD Output Method: NOSOUND_NRT', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_DSOUND: e_WriteLog('FMOD Output Method: DSOUND', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_WINMM: e_WriteLog('FMOD Output Method: WINMM', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_OPENAL: e_WriteLog('FMOD Output Method: OPENAL', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_WASAPI: e_WriteLog('FMOD Output Method: WASAPI', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_ASIO: e_WriteLog('FMOD Output Method: ASIO', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_OSS: e_WriteLog('FMOD Output Method: OSS', MSG_NOTIFY);
- FMOD_OUTPUTTYPE_ALSA: e_Writelog('FMOD Output Method: ALSA', MSG_NOTIFY);
- else e_WriteLog('FMOD Output Method: Unknown', MSG_NOTIFY);
+ FMOD_OUTPUTTYPE_NOSOUND: e_WriteLog('FMOD Output Method: NOSOUND', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_NOSOUND_NRT: e_WriteLog('FMOD Output Method: NOSOUND_NRT', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_DSOUND: e_WriteLog('FMOD Output Method: DSOUND', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_WINMM: e_WriteLog('FMOD Output Method: WINMM', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_OPENAL: e_WriteLog('FMOD Output Method: OPENAL', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_WASAPI: e_WriteLog('FMOD Output Method: WASAPI', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_ASIO: e_WriteLog('FMOD Output Method: ASIO', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_OSS: e_WriteLog('FMOD Output Method: OSS', TMsgType.Notify);
+ FMOD_OUTPUTTYPE_ALSA: e_Writelog('FMOD Output Method: ALSA', TMsgType.Notify);
+ else e_WriteLog('FMOD Output Method: Unknown', TMsgType.Notify);
end;
res := FMOD_System_GetDriver(F_System, drv);
if res <> FMOD_OK then
- e_WriteLog('Error getting FMOD driver!', MSG_WARNING)
+ e_WriteLog('Error getting FMOD driver!', TMsgType.Warning)
else
- e_WriteLog('FMOD driver id: '+IntToStr(drv), MSG_NOTIFY);
+ e_WriteLog('FMOD driver id: '+IntToStr(drv), TMsgType.Notify);
Result := True;
end;
begin
Result := False;
- e_WriteLog('Loading sound '+FileName+'...', MSG_NOTIFY);
+ e_WriteLog('Loading sound '+FileName+'...', TMsgType.Notify);
find_id := FindESound();
res := FMOD_Sound_Release(e_SoundsArray[ID].Sound);
if res <> FMOD_OK then
begin
- e_WriteLog('Error releasing sound:', MSG_WARNING);
- e_WriteLog(FMOD_ErrorString(res), MSG_WARNING);
+ e_WriteLog('Error releasing sound:', TMsgType.Warning);
+ e_WriteLog(FMOD_ErrorString(res), TMsgType.Warning);
end;
e_SoundsArray[ID].Sound := nil;
res := FMOD_System_Close(F_System);
if res <> FMOD_OK then
begin
- e_WriteLog('Error closing FMOD system!', MSG_FATALERROR);
- e_WriteLog(FMOD_ErrorString(res), MSG_FATALERROR);
+ e_WriteLog('Error closing FMOD system!', TMsgType.Fatal);
+ e_WriteLog(FMOD_ErrorString(res), TMsgType.Fatal);
Exit;
end;
res := FMOD_System_Release(F_System);
if res <> FMOD_OK then
begin
- e_WriteLog('Error releasing FMOD system!', MSG_FATALERROR);
- e_WriteLog(FMOD_ErrorString(res), MSG_FATALERROR);
+ e_WriteLog('Error releasing FMOD system!', TMsgType.Fatal);
+ e_WriteLog(FMOD_ErrorString(res), TMsgType.Fatal);
end;
end;
index 4db41dc091005e56b554d52f581c6fc822130758..11cbf0d39ced33f1f117f9999ca576e1cc8edacb 100644 (file)
--- a/src/engine/e_texture.pas
+++ b/src/engine/e_texture.pas
glBindTexture(GL_TEXTURE_2D, Texture);
if (tex.glwidth <> tex.width) or (tex.glheight <> tex.height) then
- e_WriteLog(Format('NPOT: %u is %ux%u; gl is %ux%u; u=%f; v=%f', [tex.id, Width, Height, tex.glwidth, tex.glheight, tex.u, tex.v]), MSG_NOTIFY);
+ e_WriteLog(Format('NPOT: %u is %ux%u; gl is %ux%u; u=%f; v=%f', [tex.id, Width, Height, tex.glwidth, tex.glheight, tex.u, tex.v]), TMsgType.Notify);
// texture blends with object background
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
if (img.width < 1) or (img.width > 32768) or (img.height < 1) or (img.height > 32768) then
begin
- e_WriteLog('Error loading texture: invalid image dimensions', MSG_WARNING);
+ e_WriteLog('Error loading texture: invalid image dimensions', TMsgType.Warning);
exit;
end;
//ConvertImage(img, ifA8R8G8B8);
InitImage(img);
if not LoadImageFromMemory(pData, dataSize, img) then
begin
- e_WriteLog('Error loading texture: unknown image format', MSG_WARNING);
+ e_WriteLog('Error loading texture: unknown image format', TMsgType.Warning);
exit;
end;
try
InitImage(img);
if not LoadImageFromMemory(pData, dataSize, img) then
begin
- e_WriteLog('Error loading texture: unknown image format', MSG_WARNING);
+ e_WriteLog('Error loading texture: unknown image format', TMsgType.Warning);
exit;
end;
try
if (img.width < 1) or (img.width > 32768) or (img.height < 1) or (img.height > 32768) then
begin
- e_WriteLog('Error loading texture: invalid image dimensions', MSG_WARNING);
+ e_WriteLog('Error loading texture: invalid image dimensions', TMsgType.Warning);
exit;
end;
//ConvertImage(img, ifA8R8G8B8);
end;
if fs = nil then
begin
- e_WriteLog('Texture "'+filename+'" not found', MSG_WARNING);
+ e_WriteLog('Texture "'+filename+'" not found', TMsgType.Warning);
exit;
end;
end;
if fs = nil then
begin
- e_WriteLog('Texture "'+filename+'" not found', MSG_WARNING);
+ e_WriteLog('Texture "'+filename+'" not found', TMsgType.Warning);
exit;
end;
diff --git a/src/game/Doom2DF.dpr b/src/game/Doom2DF.dpr
index 980c54b8d003c77576f5f80ec05e6b308f2e9c32..020234048404f234a0a704044594bb1814258d21 100644 (file)
--- a/src/game/Doom2DF.dpr
+++ b/src/game/Doom2DF.dpr
begin
try
Main();
- e_WriteLog('Shutdown with no errors.', MSG_NOTIFY);
+ e_WriteLog('Shutdown with no errors.', TMsgType.Notify);
except
on e: Exception do
begin
diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas
index 530bf8e4c2ea873385be3eb3403a548122bfdd8f..e9412a38ee528f62e349972148444b0c239b8426 100644 (file)
--- a/src/game/g_basic.pas
+++ b/src/game/g_basic.pas
begin
if not gmon_dbg_los_enabled then begin result := false; exit; end; // always "wall hit"
- if ((b^.X > a^.X) and (d = D_LEFT)) or
- ((b^.X < a^.X) and (d = D_RIGHT)) then
+ if ((b^.X > a^.X) and (d = TDirection.D_LEFT)) or
+ ((b^.X < a^.X) and (d = TDirection.D_RIGHT)) then
begin
Result := False;
Exit;
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index f4882b6bdbc95b4069ef439cf192f1da7cb0a4a9..fd0daf24a2f4282f5ded133f0e036e6fbd726bac 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
if FindFirst(ModelsDir+'*.wad', faAnyFile, SR) = 0 then
repeat
if not g_PlayerModel_Load(ModelsDir+SR.Name) then
- e_WriteLog(Format('Error loading model %s', [SR.Name]), MSG_WARNING);
+ e_WriteLog(Format('Error loading model %s', [SR.Name]), TMsgType.Warning);
until FindNext(SR) <> 0;
FindClose(SR);
if FindFirst(ModelsDir+'*.pk3', faAnyFile, SR) = 0 then
repeat
if not g_PlayerModel_Load(ModelsDir+SR.Name) then
- e_WriteLog(Format('Error loading model %s', [SR.Name]), MSG_WARNING);
+ e_WriteLog(Format('Error loading model %s', [SR.Name]), TMsgType.Warning);
until FindNext(SR) <> 0;
FindClose(SR);
if FindFirst(ModelsDir+'*.zip', faAnyFile, SR) = 0 then
repeat
if not g_PlayerModel_Load(ModelsDir+SR.Name) then
- e_WriteLog(Format('Error loading model %s', [SR.Name]), MSG_WARNING);
+ e_WriteLog(Format('Error loading model %s', [SR.Name]), TMsgType.Warning);
until FindNext(SR) <> 0;
FindClose(SR);
// new strafe mechanics
if (strafeDir = 0) then strafeDir := MoveButton; // start strafing
// now set direction according to strafe (reversed)
- if (strafeDir = 2) then plr.SetDirection(D_LEFT)
- else if (strafeDir = 1) then plr.SetDirection(D_RIGHT);
+ if (strafeDir = 2) then plr.SetDirection(TDirection.D_LEFT)
+ else if (strafeDir = 1) then plr.SetDirection(TDirection.D_RIGHT);
end
else
begin
strafeDir := 0; // not strafing anymore
// Ðàíüøå áûëà íàæàòà "Âïðàâî", à ñåé÷àñ "Âëåâî" => áåæèì âïðàâî, ñìîòðèì âëåâî:
- if (MoveButton = 2) and isKeyPressed(KeyLeft, KeyLeft2) then plr.SetDirection(D_LEFT)
+ if (MoveButton = 2) and isKeyPressed(KeyLeft, KeyLeft2) then plr.SetDirection(TDirection.D_LEFT)
// Ðàíüøå áûëà íàæàòà "Âëåâî", à ñåé÷àñ "Âïðàâî" => áåæèì âëåâî, ñìîòðèì âïðàâî:
- else if (MoveButton = 1) and isKeyPressed(KeyRight, KeyRight2) then plr.SetDirection(D_RIGHT)
+ else if (MoveButton = 1) and isKeyPressed(KeyRight, KeyRight2) then plr.SetDirection(TDirection.D_RIGHT)
// ×òî-òî áûëî íàæàòî è íå èçìåíèëîñü => êóäà áåæèì, òóäà è ñìîòðèì:
else if MoveButton <> 0 then plr.SetDirection(TDirection(MoveButton-1));
end;
// Íóæíî ñìåíèòü ðàçðåøåíèå:
if gResolutionChange then
begin
- e_WriteLog('Changing resolution', MSG_NOTIFY);
+ e_WriteLog('Changing resolution', TMsgType.Notify);
g_Game_ChangeResolution(gRC_Width, gRC_Height, gRC_FullScreen, gRC_Maximized);
gResolutionChange := False;
end;
begin
if DataLoaded then Exit;
- e_WriteLog('Loading game data...', MSG_NOTIFY);
+ e_WriteLog('Loading game data...', TMsgType.Notify);
g_Texture_CreateWADEx('NOTEXTURE', GameWAD+':TEXTURES\NOTEXTURE');
g_Texture_CreateWADEx('TEXTURE_PLAYER_HUD', GameWAD+':TEXTURES\HUD');
g_Weapon_FreeData();
g_Monsters_FreeData();
- e_WriteLog('Releasing game data...', MSG_NOTIFY);
+ e_WriteLog('Releasing game data...', TMsgType.Notify);
g_Texture_Delete('NOTEXTURE');
g_Texture_Delete('TEXTURE_PLAYER_HUD');
procedure g_FatalError(Text: String);
begin
g_Console_Add(Format(_lc[I_FATAL_ERROR], [Text]), True);
- e_WriteLog(Format(_lc[I_FATAL_ERROR], [Text]), MSG_WARNING);
+ e_WriteLog(Format(_lc[I_FATAL_ERROR], [Text]), TMsgType.Warning);
gExit := EXIT_SIMPLE;
end;
procedure g_SimpleError(Text: String);
begin
g_Console_Add(Format(_lc[I_SIMPLE_ERROR], [Text]), True);
- e_WriteLog(Format(_lc[I_SIMPLE_ERROR], [Text]), MSG_WARNING);
+ e_WriteLog(Format(_lc[I_SIMPLE_ERROR], [Text]), TMsgType.Warning);
end;
procedure g_Game_SetupScreenSize();
begin
g_Game_Free();
- e_WriteLog('Starting singleplayer game...', MSG_NOTIFY);
+ e_WriteLog('Starting singleplayer game...', TMsgType.Notify);
g_Game_ClearLoading();
begin
g_Game_Free();
- e_WriteLog('Starting custom game...', MSG_NOTIFY);
+ e_WriteLog('Starting custom game...', TMsgType.Notify);
g_Game_ClearLoading();
begin
g_Game_Free();
- e_WriteLog('Starting net game (server)...', MSG_NOTIFY);
+ e_WriteLog('Starting net game (server)...', TMsgType.Notify);
g_Game_ClearLoading();
g_Game_Free();
State := 0;
- e_WriteLog('Starting net game (client)...', MSG_NOTIFY);
- e_WriteLog('NET: Trying to connect to ' + Addr + ':' + IntToStr(Port) + '...', MSG_NOTIFY);
+ e_WriteLog('Starting net game (client)...', TMsgType.Notify);
+ e_WriteLog('NET: Trying to connect to ' + Addr + ':' + IntToStr(Port) + '...', TMsgType.Notify);
g_Game_ClearLoading();
g_Player_Init();
NetState := NET_STATE_GAME;
MC_SEND_FullStateRequest;
- e_WriteLog('NET: Connection successful.', MSG_NOTIFY);
+ e_WriteLog('NET: Connection successful.', TMsgType.Notify);
end;
procedure g_Game_SaveOptions();
if (s <> '') then
begin
gMapToDelete := MapsDir + map;
- e_WriteLog('"--testdelete" is deprecated, use --tempdelete.', MSG_FATALERROR);
+ e_WriteLog('"--testdelete" is deprecated, use --tempdelete.', TMsgType.Fatal);
Halt(1);
end;
Reset(F);
if IOResult <> 0 then
begin
- e_WriteLog(Format(_lc[I_SIMPLE_ERROR], ['Failed to read file: ' + s]), MSG_WARNING);
+ e_WriteLog(Format(_lc[I_SIMPLE_ERROR], ['Failed to read file: ' + s]), TMsgType.Warning);
g_Console_Add(Format(_lc[I_CONSOLE_ERROR_READ], [s]));
CloseFile(F);
Exit;
end;
- e_WriteLog('Executing script: ' + s, MSG_NOTIFY);
+ e_WriteLog('Executing script: ' + s, TMsgType.Notify);
g_Console_Add(Format(_lc[I_CONSOLE_EXEC], [s]));
while not EOF(F) do
ReadLn(F, s);
if IOResult <> 0 then
begin
- e_WriteLog(Format(_lc[I_SIMPLE_ERROR], ['Failed to read file: ' + s]), MSG_WARNING);
+ e_WriteLog(Format(_lc[I_SIMPLE_ERROR], ['Failed to read file: ' + s]), TMsgType.Warning);
g_Console_Add(Format(_lc[I_CONSOLE_ERROR_READ], [s]));
CloseFile(F);
Exit;
diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index 2e4dc8730c400582dc59085bb1515a2cbd20ef8f..9eb3c04dfca5c45ea5219031e1b1364c214b488a 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
begin
if (OnceAnims[a].Animation <> nil) then
begin
- with OnceAnims[a] do Animation.Draw(x, y, M_NONE);
+ with OnceAnims[a] do Animation.Draw(x, y, TMirrorType.None);
end;
end;
end;
diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas
index 0c9da2dbd51d2e03d7e689026499a53812b4d43b..427482fda6e4a61ab3d088df39acc4f73e46c3a0 100644 (file)
--- a/src/game/g_grid.pas
+++ b/src/game/g_grid.pas
mProxyFree := 0;
mProxyCount := 0;
mProxyMaxCount := 0;
- e_WriteLog(Format('created grid with size: %dx%d (tile size: %d); pix: %dx%d', [mWidth, mHeight, mTileSize, mWidth*mTileSize, mHeight*mTileSize]), MSG_NOTIFY);
+ e_WriteLog(Format('created grid with size: %dx%d (tile size: %d); pix: %dx%d', [mWidth, mHeight, mTileSize, mWidth*mTileSize, mHeight*mTileSize]), TMsgType.Notify);
end;
end;
if (mcb < cnt) then mcb := cnt;
end;
- e_WriteLog(Format('grid size: %dx%d (tile size: %d); pix: %dx%d; used cells: %d; max bodies in cell: %d; max proxies allocated: %d; proxies used: %d', [mWidth, mHeight, mTileSize, mWidth*mTileSize, mHeight*mTileSize, mUsedCells, mcb, mProxyMaxCount, mProxyCount]), MSG_NOTIFY);
+ e_WriteLog(Format('grid size: %dx%d (tile size: %d); pix: %dx%d; used cells: %d; max bodies in cell: %d; max proxies allocated: %d; proxies used: %d', [mWidth, mHeight, mTileSize, mWidth*mTileSize, mHeight*mTileSize, mUsedCells, mcb, mProxyMaxCount, mProxyCount]), TMsgType.Notify);
end;
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index 7367a82582f30617628f8e1adb5b748546f4318a..79b46ad6692ab1f3ae0c262b85a8e04a9d574545 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
lParam: LongInt;
end;
- TFontType = (FONT_TEXTURE, FONT_CHAR);
+ TFontType = (Texture, Character);
TFont = class(TPoolObject)
private
Self.Proc := aProc;
ProcEx := nil;
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
FText := Text;
end;
procedure TFont.Draw(X, Y: Integer; Text: string; R, G, B: Byte);
begin
- if FFontType = FONT_CHAR then e_CharFont_PrintEx(ID, X, Y, Text, _RGB(R, G, B), FScale)
+ if FFontType = TFontType.Character then e_CharFont_PrintEx(ID, X, Y, Text, _RGB(R, G, B), FScale)
else e_TextureFontPrintEx(X, Y, Text, ID, R, G, B, FScale);
end;
var
cw, ch: Byte;
begin
- if FFontType = FONT_CHAR then e_CharFont_GetSize(ID, Text, w, h)
+ if FFontType = TFontType.Character then e_CharFont_GetSize(ID, Text, w, h)
else
begin
e_TextureFontGetSize(ID, cw, ch);
begin
inherited Create();
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
FText := Text;
FFixedLen := 0;
FIndex := -1;
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
end;
procedure TGUISwitch.Draw;
begin
inherited Create();
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
FMaxLength := 0;
FWidth := 0;
FKey := 0;
FIsQuery := false;
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
end;
procedure TGUIKeyRead.Draw;
FIsQuery := False;
FFontID := FontID;
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
FMaxKeyNameWdt := 0;
for a := 0 to 255 do
begin
inherited Create();
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
FWidth := Width;
FHeight := Height;
begin
inherited Create();
- FFont := TFont.Create(FontID, FONT_CHAR);
+ FFont := TFont.Create(FontID, TFontType.Character);
FWidth := Width;
FHeight := Height;
diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas
index 88edf86ca907be0d32fa0193a27b02e77fa02d65..165b8480f804c131577f6d0f3c3d52bd1f93d32a 100644 (file)
--- a/src/game/g_holmes.pas
+++ b/src/game/g_holmes.pas
// ////////////////////////////////////////////////////////////////////////// //
procedure g_Holmes_VidModeChanged ();
begin
- e_WriteLog(Format('Holmes: videomode changed: %dx%d', [gScreenWidth, gScreenHeight]), MSG_NOTIFY);
+ e_WriteLog(Format('Holmes: videomode changed: %dx%d', [gScreenWidth, gScreenHeight]), TMsgType.Notify);
// texture space is possibly lost here, idc
curtexid := 0;
font6texid := 0;
function monsAtDump (mon: TMonster; tag: Integer): Boolean;
begin
result := true; // stop
- e_WriteLog(Format('monster #%d (UID:%u) (proxyid:%d)', [mon.arrIdx, mon.UID, mon.proxyId]), MSG_NOTIFY);
+ e_WriteLog(Format('monster #%d (UID:%u) (proxyid:%d)', [mon.arrIdx, mon.UID, mon.proxyId]), TMsgType.Notify);
monMarkedUID := mon.UID;
dumpPublishedProperties(mon);
end;
function monsAtDump (mon: TMonster; tag: Integer): Boolean;
begin
result := false; // don't stop
- e_WriteLog(Format('monster #%d (UID:%u) (proxyid:%d)', [mon.arrIdx, mon.UID, mon.proxyId]), MSG_NOTIFY);
+ e_WriteLog(Format('monster #%d (UID:%u) (proxyid:%d)', [mon.arrIdx, mon.UID, mon.proxyId]), TMsgType.Notify);
end;
begin
- e_WriteLog('===========================', MSG_NOTIFY);
+ e_WriteLog('===========================', TMsgType.Notify);
monsGrid.forEachAtPoint(pmsCurMapX, pmsCurMapY, monsAtDump);
- e_WriteLog('---------------------------', MSG_NOTIFY);
+ e_WriteLog('---------------------------', TMsgType.Notify);
end;
procedure cbAtcurDumpWalls ();
trig: PTrigger;
begin
platMarkedGUID := -1;
- e_WriteLog('=== TOGGLE WALL ===', MSG_NOTIFY);
+ e_WriteLog('=== TOGGLE WALL ===', TMsgType.Notify);
mapGrid.forEachAtPoint(pmsCurMapX, pmsCurMapY, wallToggle, (GridTagWall or GridTagDoor));
- e_WriteLog('--- toggle wall ---', MSG_NOTIFY);
+ e_WriteLog('--- toggle wall ---', TMsgType.Notify);
if showTriggers then
begin
for f := 0 to High(gTriggers) do
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index fd04006f9b223d443b65a899e70515270c0b6272..2ddc8586710e50b14d9ed833eb27dd65569f609a 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
procedure g_Items_LoadData();
begin
- e_WriteLog('Loading items data...', MSG_NOTIFY);
+ e_WriteLog('Loading items data...', TMsgType.Notify);
g_Sound_CreateWADEx('SOUND_ITEM_RESPAWNITEM', GameWAD+':SOUNDS\RESPAWNITEM');
g_Sound_CreateWADEx('SOUND_ITEM_GETRULEZ', GameWAD+':SOUNDS\GETRULEZ');
procedure g_Items_FreeData();
begin
- e_WriteLog('Releasing items data...', MSG_NOTIFY);
+ e_WriteLog('Releasing items data...', TMsgType.Notify);
g_Sound_Delete('SOUND_ITEM_RESPAWNITEM');
g_Sound_Delete('SOUND_ITEM_GETRULEZ');
end
else
begin
- Animation.Draw(Obj.X, Obj.Y, M_NONE);
+ Animation.Draw(Obj.X, Obj.Y, TMirrorType.None);
end;
if g_debug_Frames then
index 84a17f172827855b6b9fbbd30e54a112d20d14ea..7b74c3bbb9b2236886f58ec5aa96e93ae7897f18 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*)
{$INCLUDE ../shared/a_modes.inc}
+{$SCOPEDENUMS OFF}
unit g_language;
interface
CloseFile(F);
end
else
- e_WriteLog('Language file "'+fileName+'" not found!', MSG_WARNING);
+ e_WriteLog('Language file "'+fileName+'" not found!', TMsgType.Warning);
SetupArrays();
end;
diff --git a/src/game/g_main.pas b/src/game/g_main.pas
index feb59808af5870cd802b22a8c1bbad0ac3e525af..4e10356760d4b2e00a0e23d08083328120139343 100644 (file)
--- a/src/game/g_main.pas
+++ b/src/game/g_main.pas
ModelsDir := DataDir + 'models/';
GameWAD := DataDir + 'Game.wad';
- e_InitLog(GameDir + '/' + LOG_FILENAME, WM_NEWFILE);
+ e_InitLog(GameDir + '/' + LOG_FILENAME, TWriteMode.WM_NEWFILE);
- e_WriteLog('Read config file', MSG_NOTIFY);
+ e_WriteLog('Read config file', TMsgType.Notify);
g_Options_Read(GameDir + '/' + CONFIG_FILENAME);
{$IFDEF HEADLESS}
//e_WriteLog('Read language file', MSG_NOTIFY);
//g_Language_Load(DataDir + gLanguage + '.txt');
- e_WriteLog(gLanguage, MSG_NOTIFY);
+ e_WriteLog(gLanguage, TMsgType.Notify);
g_Language_Set(gLanguage);
{$IFDEF HEADLESS}
SDL_StartTextInput();
{$ENDIF}
- e_WriteLog('Entering SDLMain', MSG_NOTIFY);
+ e_WriteLog('Entering SDLMain', TMsgType.Notify);
{$WARNINGS OFF}
SDLMain();
SDL_StopTextInput();
{$ENDIF}
- e_WriteLog('Releasing SDL', MSG_NOTIFY);
+ e_WriteLog('Releasing SDL', TMsgType.Notify);
SDL_Quit();
end;
NoSound := False;
{$ENDIF}
- e_WriteLog('Init Input', MSG_NOTIFY);
+ e_WriteLog('Init Input', TMsgType.Notify);
e_InitInput();
if (e_JoysticksAvailable > 0) then
- e_WriteLog('Input: Joysticks available.', MSG_NOTIFY)
+ e_WriteLog('Input: Joysticks available.', TMsgType.Notify)
else
- e_WriteLog('Input: No Joysticks.', MSG_NOTIFY);
+ e_WriteLog('Input: No Joysticks.', TMsgType.Notify);
if (not gNoSound) then
begin
- e_WriteLog('Initializing sound system', MSG_NOTIFY);
+ e_WriteLog('Initializing sound system', TMsgType.Notify);
e_InitSoundSystem(NoSound);
end;
- e_WriteLog('Init game', MSG_NOTIFY);
+ e_WriteLog('Init game', TMsgType.Notify);
g_Game_Init();
for a := 0 to 15 do charbuff[a] := ' ';
procedure Release();
begin
- e_WriteLog('Releasing engine', MSG_NOTIFY);
+ e_WriteLog('Releasing engine', TMsgType.Notify);
e_ReleaseEngine();
- e_WriteLog('Releasing Input', MSG_NOTIFY);
+ e_WriteLog('Releasing Input', TMsgType.Notify);
e_ReleaseInput();
if not gNoSound then
begin
- e_WriteLog('Releasing FMOD', MSG_NOTIFY);
+ e_WriteLog('Releasing FMOD', TMsgType.Notify);
e_ReleaseSoundSystem();
end;
end;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 5d4f8d87cb5b0ab9a7a9c615b429496d1a6f572f..bd949579204bebf3560f558c2d840ef49abd9a44 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt();
if log and (not BadTextNameHash.get(RecName, a)) then
begin
- e_WriteLog(Format('Error loading texture %s', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Error loading texture %s', [RecName]), TMsgType.Warning);
//e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING);
end;
BadTextNameHash.put(RecName, -1);
if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt();
if log and (not BadTextNameHash.get(RecName, f)) then
begin
- e_WriteLog(Format('Error loading animation texture %s', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Error loading animation texture %s', [RecName]), TMsgType.Warning);
//e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING);
end;
BadTextNameHash.put(RecName, -1);
if ResLength < 6 then
begin
- e_WriteLog(Format('Animated texture file "%s" too short', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Animated texture file "%s" too short', [RecName]), TMsgType.Warning);
BadTextNameHash.put(RecName, -1);
exit;
end;
// íåò, ýòî ñóïåðìåí!
if not WAD.ReadMemory(TextureWAD, ResLength) then
begin
- e_WriteLog(Format('Animated texture WAD file "%s" is invalid', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Animated texture WAD file "%s" is invalid', [RecName]), TMsgType.Warning);
BadTextNameHash.put(RecName, -1);
exit;
end;
// ×èòàåì INI-ðåñóðñ àíèì. òåêñòóðû è çàïîìèíàåì åãî óñòàíîâêè:
if not WAD.GetResource('TEXT/ANIM', TextData, ResLength) then
begin
- e_WriteLog(Format('Animated texture file "%s" has invalid INI', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Animated texture file "%s" has invalid INI', [RecName]), TMsgType.Warning);
BadTextNameHash.put(RecName, -1);
exit;
end;
TextureResource := cfg.ReadStr('', 'resource', '');
if TextureResource = '' then
begin
- e_WriteLog(Format('Animated texture WAD file "%s" has no "resource"', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Animated texture WAD file "%s" has no "resource"', [RecName]), TMsgType.Warning);
BadTextNameHash.put(RecName, -1);
exit;
end;
// ×èòàåì ðåñóðñ òåêñòóð (êàäðîâ) àíèì. òåêñòóðû â ïàìÿòü:
if not WAD.GetResource('TEXTURES/'+TextureResource, TextureData, ResLength) then
begin
- e_WriteLog(Format('Animated texture WAD file "%s" has no texture "%s"', [RecName, 'TEXTURES/'+TextureResource]), MSG_WARNING);
+ e_WriteLog(Format('Animated texture WAD file "%s" has no texture "%s"', [RecName, 'TEXTURES/'+TextureResource]), TMsgType.Warning);
BadTextNameHash.put(RecName, -1);
exit;
end;
if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt();
if log and (not BadTextNameHash.get(RecName, f)) then
begin
- e_WriteLog(Format('Error loading animation texture %s', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Error loading animation texture %s', [RecName]), TMsgType.Warning);
end;
BadTextNameHash.put(RecName, -1);
end;
GlobalMetadata.ClearMetaItemsForSaving();
if not LoadMultiImageFromMemory(TextureWAD, ResLength, ia) then
begin
- e_WriteLog(Format('Animated texture file "%s" cannot be loaded', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Animated texture file "%s" cannot be loaded', [RecName]), TMsgType.Warning);
BadTextNameHash.put(RecName, -1);
exit;
end;
if length(ia) = 0 then
begin
- e_WriteLog(Format('Animated texture file "%s" has no frames', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Animated texture file "%s" has no frames', [RecName]), TMsgType.Warning);
BadTextNameHash.put(RecName, -1);
exit;
end;
//writeln(' creating animated texture with ', length(ia), ' frames (delay:', _speed, '; backloop:', _backanimation, ') from "', RecName, '"...');
//for f := 0 to high(ia) do writeln(' frame #', f, ': ', ia[f].width, 'x', ia[f].height);
f := ord(_backanimation);
- e_WriteLog(Format('Animated texture file "%s": %d frames (delay:%d; back:%d; frdelay:%d; frloop:%d), %dx%d', [RecName, length(ia), _speed, f, frdelay, frloop, _width, _height]), MSG_NOTIFY);
+ e_WriteLog(Format('Animated texture file "%s": %d frames (delay:%d; back:%d; frdelay:%d; frloop:%d), %dx%d', [RecName, length(ia), _speed, f, frdelay, frloop, _width, _height]), TMsgType.Notify);
SetLength(Textures, Length(Textures)+1);
// cîçäàåì êàäðû àíèì. òåêñòóðû èç êàðòèíîê
if (BadTextNameHash = nil) then BadTextNameHash := hashNewStrInt();
if log and (not BadTextNameHash.get(RecName, f)) then
begin
- e_WriteLog(Format('Error loading animation texture "%s" images', [RecName]), MSG_WARNING);
+ e_WriteLog(Format('Error loading animation texture "%s" images', [RecName]), TMsgType.Warning);
end;
BadTextNameHash.put(RecName, -1);
end;
if (pan.proxyId <> -1) then
begin
{$IF DEFINED(D2F_DEBUG)}
- e_WriteLog(Format('DUPLICATE wall #%d(%d) enabled (%d); type:%08x', [Integer(idx), Integer(pan.proxyId), Integer(mapGrid.proxyEnabled[pan.proxyId]), pan.PanelType]), MSG_NOTIFY);
+ e_WriteLog(Format('DUPLICATE wall #%d(%d) enabled (%d); type:%08x', [Integer(idx), Integer(pan.proxyId), Integer(mapGrid.proxyEnabled[pan.proxyId]), pan.PanelType]), TMsgType.Notify);
{$ENDIF}
continue;
end;
if (gCurrentMap = nil) then
begin
FileName := g_ExtractWadName(Res);
- e_WriteLog('Loading map WAD: '+FileName, MSG_NOTIFY);
+ e_WriteLog('Loading map WAD: '+FileName, TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_WAD_FILE], 0, False);
WAD := TWADFile.Create();
end;
// Çàãðóçêà êàðòû:
- e_LogWritefln('Loading map: %s', [mapResName], MSG_NOTIFY);
+ e_LogWritefln('Loading map: %s', [mapResName], TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_MAP], 0, False);
stt := getTimeMicro();
monsters := gCurrentMap['monster'];
// Çàãðóçêà îïèñàíèÿ êàðòû:
- e_WriteLog(' Reading map info...', MSG_NOTIFY);
+ e_WriteLog(' Reading map info...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_MAP_HEADER], 0, False);
with gMapInfo do
// Äîáàâëåíèå òåêñòóð â Textures[]:
if (mapTextureList <> nil) and (mapTextureList.count > 0) then
begin
- e_WriteLog(' Loading textures:', MSG_NOTIFY);
+ e_WriteLog(' Loading textures:', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_TEXTURES], mapTextureList.count-1, False);
cnt := -1;
Inc(cnt);
s := rec.Resource;
{$IF DEFINED(D2F_DEBUG_TXLOAD)}
- e_WriteLog(Format(' Loading texture #%d: %s', [cnt, s]), MSG_NOTIFY);
+ e_WriteLog(Format(' Loading texture #%d: %s', [cnt, s]), TMsgType.Notify);
{$ENDIF}
//if g_Map_IsSpecialTexture(s) then e_WriteLog(' SPECIAL!', MSG_NOTIFY);
if rec.Anim then
// Çàãðóçêà òðèããåðîâ
gTriggerClientID := 0;
- e_WriteLog(' Loading triggers...', MSG_NOTIFY);
+ e_WriteLog(' Loading triggers...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_TRIGGERS], 0, False);
// Çàãðóçêà ïàíåëåé
- e_WriteLog(' Loading panels...', MSG_NOTIFY);
+ e_WriteLog(' Loading panels...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_PANELS], 0, False);
// check texture numbers for panels
begin
if (rec.tagInt < 0) then
begin
- e_WriteLog('error loading map: invalid texture index for panel', MSG_FATALERROR);
+ e_WriteLog('error loading map: invalid texture index for panel', TMsgType.Fatal);
result := false;
gCurrentMap.Free();
gCurrentMap := nil;
// Ñîçäàíèå òàáëèöû òðèããåðîâ (ñîîòâåòñòâèå ïàíåëåé òðèããåðàì)
if (triggers <> nil) and (triggers.count > 0) then
begin
- e_WriteLog(' Setting up trigger table...', MSG_NOTIFY);
+ e_WriteLog(' Setting up trigger table...', TMsgType.Notify);
//SetLength(TriggersTable, triggers.count);
g_Game_SetLoadingText(_lc[I_LOAD_TRIGGERS_TABLE], triggers.count-1, False);
// Ñîçäàåì ïàíåëè
if (panels <> nil) and (panels.count > 0) then
begin
- e_WriteLog(' Setting up trigger links...', MSG_NOTIFY);
+ e_WriteLog(' Setting up trigger links...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_LINK_TRIGGERS], panels.count-1, False);
pannum := -1;
end;
// create map grid, init other grids (for monsters, for example)
- e_WriteLog('Creating map grid', MSG_NOTIFY);
+ e_WriteLog('Creating map grid', TMsgType.Notify);
mapCreateGrid();
// Åñëè íå LoadState, òî ñîçäàåì òðèããåðû
end;
// Çàãðóçêà ïðåäìåòîâ
- e_WriteLog(' Loading items...', MSG_NOTIFY);
+ e_WriteLog(' Loading items...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_ITEMS], 0, False);
// Åñëè íå LoadState, òî ñîçäàåì ïðåäìåòû
if (items <> nil) and not gLoadGameMode then
begin
- e_WriteLog(' Spawning items...', MSG_NOTIFY);
+ e_WriteLog(' Spawning items...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_CREATE_ITEMS], 0, False);
for rec in items do CreateItem(rec);
end;
// Çàãðóçêà îáëàñòåé
- e_WriteLog(' Loading areas...', MSG_NOTIFY);
+ e_WriteLog(' Loading areas...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_AREAS], 0, False);
// Åñëè íå LoadState, òî ñîçäàåì îáëàñòè
if areas <> nil then
begin
- e_WriteLog(' Creating areas...', MSG_NOTIFY);
+ e_WriteLog(' Creating areas...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_CREATE_AREAS], 0, False);
for rec in areas do CreateArea(rec);
end;
// Çàãðóçêà ìîíñòðîâ
- e_WriteLog(' Loading monsters...', MSG_NOTIFY);
+ e_WriteLog(' Loading monsters...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_MONSTERS], 0, False);
gTotalMonsters := 0;
// Åñëè íå LoadState, òî ñîçäàåì ìîíñòðîâ
if (monsters <> nil) and not gLoadGameMode then
begin
- e_WriteLog(' Spawning monsters...', MSG_NOTIFY);
+ e_WriteLog(' Spawning monsters...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_CREATE_MONSTERS], 0, False);
for rec in monsters do CreateMonster(rec);
end;
// Çàãðóçêà íåáà
if (gMapInfo.SkyName <> '') then
begin
- e_WriteLog(' Loading sky: ' + gMapInfo.SkyName, MSG_NOTIFY);
+ e_WriteLog(' Loading sky: ' + gMapInfo.SkyName, TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_SKY], 0, False);
FileName := g_ExtractWadName(gMapInfo.SkyName);
ok := False;
if gMapInfo.MusicName <> '' then
begin
- e_WriteLog(' Loading music: ' + gMapInfo.MusicName, MSG_NOTIFY);
+ e_WriteLog(' Loading music: ' + gMapInfo.MusicName, TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_MUSIC], 0, False);
FileName := g_ExtractWadName(gMapInfo.MusicName);
end;
end;
- e_WriteLog('Done loading map.', MSG_NOTIFY);
+ e_WriteLog('Done loading map.', TMsgType.Notify);
Result := True;
end;
Obj.Y := -1000;
Obj.Vel.X := 0;
Obj.Vel.Y := 0;
- Direction := D_LEFT;
+ Direction := TDirection.D_LEFT;
State := FLAG_STATE_NONE;
if FlagPoints[Flag] <> nil then
begin
if State = FLAG_STATE_NONE then
continue;
- if Direction = D_LEFT then
+ if Direction = TDirection.D_LEFT then
begin
- Mirror := M_HORIZONTAL;
+ Mirror := TMirrorType.Horizontal;
dx := -1;
end
else
begin
- Mirror := M_NONE;
+ Mirror := TMirrorType.None;
dx := 1;
end;
// Ñîñòîÿíèå ôëàãà
utils.writeInt(st, Byte(flag^.State));
// Íàïðàâëåíèå ôëàãà
- if flag^.Direction = D_LEFT then b := 1 else b := 2; // D_RIGHT
+ if flag^.Direction = TDirection.D_LEFT then b := 1 else b := 2; // D_RIGHT
utils.writeInt(st, Byte(b));
// Îáúåêò ôëàãà
Obj_SaveState(st, @flag^.Obj);
flag^.State := utils.readByte(st);
// Íàïðàâëåíèå ôëàãà
b := utils.readByte(st);
- if (b = 1) then flag^.Direction := D_LEFT else flag^.Direction := D_RIGHT; // b = 2
+ if (b = 1) then flag^.Direction := TDirection.D_LEFT else flag^.Direction := TDirection.D_RIGHT; // b = 2
// Îáúåêò ôëàãà
Obj_LoadState(@flag^.Obj, st);
end;
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 90527a15cbbab95279b76b8ec38ab38f8cb2a869..04f7331c5a00394ea29382d57da64604c4b7dbb4 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
procedure MenuLoadData();
begin
- e_WriteLog('Loading menu data...', MSG_NOTIFY);
+ e_WriteLog('Loading menu data...', TMsgType.Notify);
g_Texture_CreateWADEx('MAINMENU_MARKER1', GameWAD+':TEXTURES\MARKER1');
g_Texture_CreateWADEx('MAINMENU_MARKER2', GameWAD+':TEXTURES\MARKER2');
begin
if g_ActiveWindow.Name = 'OptionsPlayersP1Menu' then s := 'P1' else s := 'P2';
with TGUIModelView(g_ActiveWindow.GetControl('mv'+s+'Model')).Model do
- if Direction = D_LEFT then Direction := D_RIGHT else Direction := D_LEFT;
+ begin
+ if Direction = TDirection.D_LEFT then Direction := TDirection.D_RIGHT else Direction := TDirection.D_LEFT;
+ end;
end;
procedure ProcDefaultMenuKeyDown (yes: Boolean);
begin
g_GUI_Destroy();
- e_WriteLog('Releasing menu data...', MSG_NOTIFY);
+ e_WriteLog('Releasing menu data...', TMsgType.Notify);
MenuFreeData();
end;
if ex then
begin
- e_WriteLog('Recreating menu...', MSG_NOTIFY);
+ e_WriteLog('Recreating menu...', TMsgType.Notify);
CreateAllMenus();
index 2d6daf6c9de719bd9fed2b43f9c8025dfa9ec14c..b7d217b159a306c27aadb399139786a38fead474 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
FMaxHealth: Integer;
FState: Byte;
FCurAnim: Byte;
- FAnim: Array of Array [D_LEFT..D_RIGHT] of TAnimation;
+ FAnim: Array of Array [TDirection.D_LEFT..TDirection.D_RIGHT] of TAnimation;
FTargetUID: Word;
FTargetTime: Integer;
FBehaviour: Byte;
procedure g_Monsters_SaveState (st: TStream);
procedure g_Monsters_LoadState (st: TStream);
-function g_Mons_SpawnAt (monType: Integer; x, y: Integer; dir: TDirection=D_LEFT): TMonster; overload;
-function g_Mons_SpawnAt (const typeName: AnsiString; x, y: Integer; dir: TDirection=D_LEFT): TMonster; overload;
+function g_Mons_SpawnAt (monType: Integer; x, y: Integer; dir: TDirection=TDirection.D_LEFT): TMonster; overload;
+function g_Mons_SpawnAt (const typeName: AnsiString; x, y: Integer; dir: TDirection=TDirection.D_LEFT): TMonster; overload;
function g_Mons_TypeLo (): Integer; inline;
function g_Mons_TypeHi (): Integer; inline;
procedure g_Monsters_LoadData();
begin
- e_WriteLog('Loading monsters data...', MSG_NOTIFY);
+ e_WriteLog('Loading monsters data...', TMsgType.Notify);
g_Game_SetLoadingText(_lc[I_LOAD_MONSTER_TEXTURES]+' 0%', 0, False);
g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_SLEEP', GameWAD+':MTEXTURES\BARREL_SLEEP', 64, 64, 3);
procedure g_Monsters_FreeData();
begin
- e_WriteLog('Releasing monsters data...', MSG_NOTIFY);
+ e_WriteLog('Releasing monsters data...', TMsgType.Notify);
g_Frames_DeleteByName('FRAMES_MONSTER_BARREL_SLEEP');
g_Frames_DeleteByName('FRAMES_MONSTER_BARREL_PAIN');
// Òèï ìîíñòðà
b := utils.readByte(st);
// Ñîçäàåì ìîíñòðà
- mon := g_Monsters_Create(b, 0, 0, D_LEFT);
+ mon := g_Monsters_Create(b, 0, 0, TDirection.D_LEFT);
if (mon = nil) then raise XStreamError.Create('g_Monsters_LoadState: ID = -1 (can''t create)');
// Çàãðóæàåì äàííûå ìîíñòðà
mon.LoadState(st);
// ////////////////////////////////////////////////////////////////////////// //
-function g_Mons_SpawnAt (monType: Integer; x, y: Integer; dir: TDirection=D_LEFT): TMonster; overload;
+function g_Mons_SpawnAt (monType: Integer; x, y: Integer; dir: TDirection=TDirection.D_LEFT): TMonster; overload;
begin
result := nil;
if (monType >= MONSTER_DEMON) and (monType <= MONSTER_MAN) then
end;
-function g_Mons_SpawnAt (const typeName: AnsiString; x, y: Integer; dir: TDirection=D_LEFT): TMonster; overload;
+function g_Mons_SpawnAt (const typeName: AnsiString; x, y: Integer; dir: TDirection=TDirection.D_LEFT): TMonster; overload;
begin
result := g_Mons_SpawnAt(g_Mons_TypeIdByName(typeName), x, y, dir);
end;
for a := 0 to High(FAnim) do
begin
- FAnim[a, D_LEFT] := nil;
- FAnim[a, D_RIGHT] := nil;
+ FAnim[a, TDirection.D_LEFT] := nil;
+ FAnim[a, TDirection.D_RIGHT] := nil;
end;
for a := ANIM_SLEEP to ANIM_PAIN do
if g_Frames_Get(FramesID, 'FRAMES_MONSTER_'+MONSTERTABLE[MonsterType].Name+
'_'+ANIMTABLE[ANIM_DIE].name) then
begin
- FAnim[a, D_RIGHT] := TAnimation.Create(FramesID, ANIMTABLE[ANIM_DIE].loop,
+ FAnim[a, TDirection.D_RIGHT] := TAnimation.Create(FramesID, ANIMTABLE[ANIM_DIE].loop,
MONSTER_ANIMTABLE[MonsterType].AnimSpeed[ANIM_DIE]);
- FAnim[a, D_LEFT] := TAnimation.Create(FramesID, ANIMTABLE[ANIM_DIE].loop,
+ FAnim[a, TDirection.D_LEFT] := TAnimation.Create(FramesID, ANIMTABLE[ANIM_DIE].loop,
MONSTER_ANIMTABLE[MonsterType].AnimSpeed[ANIM_DIE]);
Continue;
end;
end;
- FAnim[a, D_RIGHT] := TAnimation.Create(FramesID, ANIMTABLE[a].loop,
+ FAnim[a, TDirection.D_RIGHT] := TAnimation.Create(FramesID, ANIMTABLE[a].loop,
MONSTER_ANIMTABLE[MonsterType].AnimSpeed[a]);
// Åñëè åñòü îòäåëüíàÿ ëåâàÿ àíèìàöèÿ - çàãðóæàåì:
g_Frames_Get(FramesID, s);
end;
- FAnim[a, D_LEFT] := TAnimation.Create(FramesID, ANIMTABLE[a].loop,
+ FAnim[a, TDirection.D_LEFT] := TAnimation.Create(FramesID, ANIMTABLE[a].loop,
MONSTER_ANIMTABLE[MonsterType].AnimSpeed[a]);
end;
if (t = HIT_ELECTRO) and (FMonsterType = MONSTER_FISH) and g_Game_IsServer then
begin
FSleep := 20;
- if Random(2) = 0 then
- FDirection := D_RIGHT
- else
- FDirection := D_LEFT;
+ if Random(2) = 0 then FDirection := TDirection.D_RIGHT else FDirection := TDirection.D_LEFT;
Result := True;
SetState(MONSTATE_RUN);
Exit;
begin
for a := 0 to High(FAnim) do
begin
- FAnim[a, D_LEFT].Free();
- FAnim[a, D_RIGHT].Free();
+ FAnim[a, TDirection.D_LEFT].Free();
+ FAnim[a, TDirection.D_RIGHT].Free();
end;
vilefire.Free();
if FState = MONSTATE_SHOOT then
if GetPos(FTargetUID, @o) then
vilefire.Draw(o.X+o.Rect.X+(o.Rect.Width div 2)-32,
- o.Y+o.Rect.Y+o.Rect.Height-128, M_NONE);
+ o.Y+o.Rect.Y+o.Rect.Height-128, TMirrorType.None);
// Íå â îáëàñòè ðèñîâàíèÿ íå ðåñóåì:
//FIXME!
if FAnim[FCurAnim, FDirection] <> nil then
begin
// Åñëè íåò ëåâîé àíèìàöèè èëè îíà ñîâïàäàåò ñ ïðàâîé => îòðàæàåì ïðàâóþ:
- if (FDirection = D_LEFT) and
+ if (FDirection = TDirection.D_LEFT) and
((not MONSTER_ANIMTABLE[FMonsterType].LeftAnim) or
- (FAnim[FCurAnim, D_LEFT].FramesID = FAnim[FCurAnim, D_RIGHT].FramesID)) and
+ (FAnim[FCurAnim, TDirection.D_LEFT].FramesID = FAnim[FCurAnim, TDirection.D_RIGHT].FramesID)) and
(FMonsterType <> MONSTER_BARREL) then
- m := M_HORIZONTAL
+ m := TMirrorType.Horizontal
else
- m := M_NONE;
+ m := TMirrorType.None;
// Ëåâàÿ àíèìàöèÿ => ìåíÿåì ñìåùåíèå îòíîñèòåëüíî öåíòðà:
- if (FDirection = D_LEFT) and
+ if (FDirection = TDirection.D_LEFT) and
(FMonsterType <> MONSTER_BARREL) then
begin
dx := MONSTER_ANIMTABLE[FMonsterType].AnimDeltaLeft[FCurAnim].X;
dy := MONSTER_ANIMTABLE[FMonsterType].AnimDeltaLeft[FCurAnim].Y;
- if m = M_HORIZONTAL then
+ if m = TMirrorType.Horizontal then
begin // Íåò îòäåëüíîé ëåâîé àíèìàöèè
// Ðàññòîÿíèå îò êðàÿ òåêñòóðû äî êðàÿ âèçóàëüíîãî ïîëîæåíèÿ îáúåêòà íà òåêñòóðå:
c := (MONSTERTABLE[FMonsterType].Rect.X - dx) + MONSTERTABLE[FMonsterType].Rect.Width;
positionChanged();
if dir = 1 then
- FDirection := D_LEFT
+ FDirection := TDirection.D_LEFT
else
if dir = 2 then
- FDirection := D_RIGHT
+ FDirection := TDirection.D_RIGHT
else
if dir = 3 then
begin // îáðàòíîå
- if FDirection = D_RIGHT then
- FDirection := D_LEFT
+ if FDirection = TDirection.D_RIGHT then
+ FDirection := TDirection.D_LEFT
else
- FDirection := D_RIGHT;
+ FDirection := TDirection.D_RIGHT;
end;
// Ýôôåêò òåëåïîðòà â òî÷êå íàçíà÷åíèÿ:
// Ïîâîðà÷èâàåìñÿ â ñòîðîíó öåëè:
if sx > 0 then
- FDirection := D_RIGHT
+ FDirection := TDirection.D_RIGHT
else
- FDirection := D_LEFT;
+ FDirection := TDirection.D_LEFT;
// Åñëè ìîíñòð óìååò ñòðåëÿòü è åñòü ïî êîìó - ñòðåëÿåì:
if canShoot(FMonsterType) and (FTargetUID <> 0) then
FSleep := 15;
SetState(MONSTATE_RUN);
if Random(2) = 0 then
- FDirection := D_LEFT
+ FDirection := TDirection.D_LEFT
else
- FDirection := D_RIGHT;
+ FDirection := TDirection.D_RIGHT;
goto _end;
end;
FObj.Vel.Y := 0;
// Ïëàâàåì òóäà-ñþäà:
if Random(2) = 0 then
- FDirection := D_LEFT
+ FDirection := TDirection.D_LEFT
else
- FDirection := D_RIGHT;
+ FDirection := TDirection.D_RIGHT;
FSleep := 20;
SetState(MONSTATE_RUN);
end;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
if (FMonsterType = MONSTER_PAIN) then
begin
mon := g_Monsters_Create(MONSTER_SOUL, FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-30,
- FObj.Y+FObj.Rect.Y+20, D_LEFT);
+ FObj.Y+FObj.Rect.Y+20, TDirection.D_LEFT);
if mon <> nil then
begin
mon.SetState(MONSTATE_GO);
end;
mon := g_Monsters_Create(MONSTER_SOUL, FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2),
- FObj.Y+FObj.Rect.Y+20, D_RIGHT);
+ FObj.Y+FObj.Rect.Y+20, TDirection.D_RIGHT);
if mon <> nil then
begin
mon.SetState(MONSTATE_GO);
end;
mon := g_Monsters_Create(MONSTER_SOUL, FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-15,
- FObj.Y+FObj.Rect.Y, D_RIGHT);
+ FObj.Y+FObj.Rect.Y, TDirection.D_RIGHT);
if mon <> nil then
begin
mon.SetState(MONSTATE_GO);
if FCurAnim = ANIM_ATTACK2 then
begin
o := FObj;
- o.Vel.X := IfThen(FDirection = D_RIGHT, 1, -1)*IfThen(FMonsterType = MONSTER_CYBER, 60, 50);
+ o.Vel.X := IfThen(FDirection = TDirection.D_RIGHT, 1, -1)*IfThen(FMonsterType = MONSTER_CYBER, 60, 50);
if g_Weapon_Hit(@o, IfThen(FMonsterType = MONSTER_CYBER, 33, 50), FUID, HIT_SOME) <> 0 then
g_Sound_PlayExAt('SOUND_MONSTER_SKEL_HIT', FObj.X, FObj.Y);
end;
// Âû÷èñëÿåì êîîðäèíàòû, îòêóäà âûëåòèò ïóëÿ:
wx := MONSTER_ANIMTABLE[FMonsterType].wX;
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
begin
wx := MONSTER_ANIMTABLE[FMonsterType].wX-(MONSTERTABLE[FMonsterType].Rect.X+(MONSTERTABLE[FMonsterType].Rect.Width div 2));
wx := MONSTERTABLE[FMonsterType].Rect.X+(MONSTERTABLE[FMonsterType].Rect.Width div 2)-wx;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
end;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
if FCurAnim = ANIM_ATTACK2 then
begin
o := FObj;
- o.Vel.X := IfThen(FDirection = D_RIGHT, 1, -1)*IfThen(FMonsterType = MONSTER_CYBER, 60, 50);
+ o.Vel.X := IfThen(FDirection = TDirection.D_RIGHT, 1, -1)*IfThen(FMonsterType = MONSTER_CYBER, 60, 50);
g_Weapon_Hit(@o, IfThen(FMonsterType = MONSTER_CYBER, 33, 50), FUID, HIT_SOME);
end;
procedure TMonster.Turn();
begin
// Ðàçâîðà÷èâàåìñÿ:
- if FDirection = D_LEFT then
- FDirection := D_RIGHT
- else
- FDirection := D_LEFT;
+ if FDirection = TDirection.D_LEFT then FDirection := TDirection.D_RIGHT else FDirection := TDirection.D_LEFT;
// Áåæèì â âûáðàííóþ ñòîðîíó:
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
FObj.Vel.X := MONSTERTABLE[FMonsterType].RunVel
else
FObj.Vel.X := -MONSTERTABLE[FMonsterType].RunVel;
// UID ìîíñòðà:
utils.writeInt(st, Word(FUID));
// Íàïðàâëåíèå
- if FDirection = D_LEFT then b := 1 else b := 2; // D_RIGHT
+ if FDirection = TDirection.D_LEFT then b := 1 else b := 2; // D_RIGHT
utils.writeInt(st, Byte(b));
// Íàäî ëè óäàëèòü åãî
utils.writeBool(st, FRemoved);
for i := ANIM_SLEEP to ANIM_PAIN do
begin
// Åñòü ëè ëåâàÿ àíèìàöèÿ
- anim := (FAnim[i, D_LEFT] <> nil);
+ anim := (FAnim[i, TDirection.D_LEFT] <> nil);
utils.writeBool(st, anim);
// Åñëè åñòü - ñîõðàíÿåì
- if anim then FAnim[i, D_LEFT].SaveState(st);
+ if anim then FAnim[i, TDirection.D_LEFT].SaveState(st);
// Åñòü ëè ïðàâàÿ àíèìàöèÿ
- anim := (FAnim[i, D_RIGHT] <> nil);
+ anim := (FAnim[i, TDirection.D_RIGHT] <> nil);
utils.writeBool(st, anim);
// Åñëè åñòü - ñîõðàíÿåì
- if anim then FAnim[i, D_RIGHT].SaveState(st);
+ if anim then FAnim[i, TDirection.D_RIGHT].SaveState(st);
end;
end;
uidMap[FUID] := self;
// Íàïðàâëåíèå
b := utils.readByte(st);
- if b = 1 then FDirection := D_LEFT else FDirection := D_RIGHT; // b = 2
+ if b = 1 then FDirection := TDirection.D_LEFT else FDirection := TDirection.D_RIGHT; // b = 2
// Íàäî ëè óäàëèòü åãî
FRemoved := utils.readBool(st);
// Îñòàëîñü çäîðîâüÿ
// Åñëè åñòü - çàãðóæàåì
if anim then
begin
- Assert(FAnim[i, D_LEFT] <> nil, 'TMonster.LoadState: no '+IntToStr(i)+'_left anim');
- FAnim[i, D_LEFT].LoadState(st);
+ Assert(FAnim[i, TDirection.D_LEFT] <> nil, 'TMonster.LoadState: no '+IntToStr(i)+'_left anim');
+ FAnim[i, TDirection.D_LEFT].LoadState(st);
end;
// Åñòü ëè ïðàâàÿ àíèìàöèÿ
anim := utils.readBool(st);
// Åñëè åñòü - çàãðóæàåì
if anim then
begin
- Assert(FAnim[i, D_RIGHT] <> nil, 'TMonster.LoadState: no '+IntToStr(i)+'_right anim');
- FAnim[i, D_RIGHT].LoadState(st);
+ Assert(FAnim[i, TDirection.D_RIGHT] <> nil, 'TMonster.LoadState: no '+IntToStr(i)+'_right anim');
+ FAnim[i, TDirection.D_RIGHT].LoadState(st);
end;
end;
end;
diff --git a/src/game/g_net.pas b/src/game/g_net.pas
index 78b8eeaa6d0da6e722a118ee4c6c60b06ce6347d..85263e51e7e709388809188f5c664c832f9f84e3 100644 (file)
--- a/src/game/g_net.pas
+++ b/src/game/g_net.pas
NetMode := NET_NONE;
g_Net_Cleanup;
- e_WriteLog('NET: Server stopped', MSG_NOTIFY);
+ e_WriteLog('NET: Server stopped', TMsgType.Notify);
end;
TP.Lives := 0;
TP.Kill(K_SIMPLEKILL, 0, HIT_DISCON);
g_Console_Add(Format(_lc[I_PLAYER_LEAVE], [TP.Name]), True);
- e_WriteLog('NET: Client ' + TP.Name + ' [' + IntToStr(ID) + '] disconnected.', MSG_NOTIFY);
+ e_WriteLog('NET: Client ' + TP.Name + ' [' + IntToStr(ID) + '] disconnected.', TMsgType.Notify);
g_Player_Remove(TP.UID);
end;
end
else
begin
- e_WriteLog('NET: Kicked from server: ' + IntToStr(NetEvent.data), MSG_NOTIFY);
+ e_WriteLog('NET: Kicked from server: ' + IntToStr(NetEvent.data), TMsgType.Notify);
if (NetEvent.data <= NET_DISC_MAX) then
g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_MSG_KICK] +
_lc[TStrings_Locale(Cardinal(I_NET_DISC_NONE) + NetEvent.data)], True);
g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_MSG_CLIENT_DISC]);
g_Net_Cleanup;
- e_WriteLog('NET: Disconnected', MSG_NOTIFY);
+ e_WriteLog('NET: Disconnected', TMsgType.Notify);
end;
procedure g_Net_Client_Send(Reliable: Boolean; Chan: Byte = NET_CHAN_GAME);
index 27eefa480656fea25a50ebe20af19d9c96904193..9e96a451f43f07326a693a2b78775945899ad2ea 100644 (file)
--- a/src/game/g_netmaster.pas
+++ b/src/game/g_netmaster.pas
if not g_Net_Slist_Connect then
Exit;
- e_WriteLog('Fetching serverlist...', MSG_NOTIFY);
+ e_WriteLog('Fetching serverlist...', TMsgType.Notify);
g_Console_Add(_lc[I_NET_MSG] + _lc[I_NET_SLIST_FETCH]);
NetOut.Clear();
begin
enet_address_set_host(@NetSlistAddr, PChar(Addr(IP[1])));
NetSlistAddr.Port := Port;
- e_WriteLog('Masterserver address set to ' + IP + ':' + IntToStr(Port), MSG_NOTIFY);
+ e_WriteLog('Masterserver address set to ' + IP + ':' + IntToStr(Port), TMsgType.Notify);
end;
end;
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 98ef65484d75106458c50cf94f86679e52d992ca..86c76570e35722f43ae564b2cd1958016ea0a326 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
g_Console_Add(Format(_lc[I_PLAYER_JOIN], [PName]), True);
e_WriteLog('NET: Client ' + PName + ' [' + IntToStr(C^.ID) +
- '] connected. Assigned player #' + IntToStr(PID) + '.', MSG_NOTIFY);
+ '] connected. Assigned player #' + IntToStr(PID) + '.', TMsgType.Notify);
MH_SEND_Info(C^.ID);
if Mode = NET_CHAT_PLAYER then
begin
g_Console_Add(Txt, True);
- e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), MSG_NOTIFY);
+ e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
g_Sound_PlayEx('SOUND_GAME_RADIO');
end
else
if (gPlayer1.Team = TEAM_RED) and (Team = TEAM_RED) then
begin
g_Console_Add(#18'[Team] '#2 + Txt, True);
- e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), MSG_NOTIFY);
+ e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
g_Sound_PlayEx('SOUND_GAME_RADIO');
end
else if (gPlayer1.Team = TEAM_BLUE) and (Team = TEAM_BLUE) then
begin
g_Console_Add(#20'[Team] '#2 + Txt, True);
- e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), MSG_NOTIFY);
+ e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
g_Sound_PlayEx('SOUND_GAME_RADIO');
end;
end;
begin
Name := g_Net_ClientName_ByID(ID);
g_Console_Add('-> ' + Name + ': ' + Txt, True);
- e_WriteLog('[Tell ' + Name + '] ' + b_Text_Unformat(Txt), MSG_NOTIFY);
+ e_WriteLog('[Tell ' + Name + '] ' + b_Text_Unformat(Txt), TMsgType.Notify);
g_Sound_PlayEx('SOUND_GAME_RADIO');
end;
end;
end;
NetOut.Write(kByte);
- if Direction = D_LEFT then NetOut.Write(Byte(0)) else NetOut.Write(Byte(1));
+ if Direction = TDirection.D_LEFT then NetOut.Write(Byte(0)) else NetOut.Write(Byte(1));
NetOut.Write(GameX);
NetOut.Write(GameY);
NetOut.Write(GameVelX);
if Mode = NET_CHAT_PLAYER then
begin
g_Console_Add(Txt, True);
- e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), MSG_NOTIFY);
+ e_WriteLog('[Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
g_Sound_PlayEx('SOUND_GAME_RADIO');
end else
if (Mode = NET_CHAT_TEAM) and (gPlayer1 <> nil) then
g_Console_Add(b_Text_Format('\r[Team] ') + Txt, True);
if gPlayer1.Team = TEAM_BLUE then
g_Console_Add(b_Text_Format('\b[Team] ') + Txt, True);
- e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), MSG_NOTIFY);
+ e_WriteLog('[Team Chat] ' + b_Text_Unformat(Txt), TMsgType.Notify);
g_Sound_PlayEx('SOUND_GAME_RADIO');
end;
end else
end;
g_Console_Add(Format(_lc[I_PLAYER_JOIN], [PName]), True);
- e_WriteLog('NET: Player ' + PName + ' [' + IntToStr(PID) + '] added.', MSG_NOTIFY);
+ e_WriteLog('NET: Player ' + PName + ' [' + IntToStr(PID) + '] added.', TMsgType.Notify);
Result := PID;
end;
if Pl = nil then Exit;
g_Console_Add(Format(_lc[I_PLAYER_LEAVE], [Pl.Name]), True);
- e_WriteLog('NET: Player ' + Pl.Name + ' [' + IntToStr(PID) + '] removed.', MSG_NOTIFY);
+ e_WriteLog('NET: Player ' + Pl.Name + ' [' + IntToStr(PID) + '] removed.', TMsgType.Notify);
g_Player_Remove(PID);
// new strafe mechanics
if (strafeDir = 0) then strafeDir := P1MoveButton; // start strafing
// now set direction according to strafe (reversed)
- if (strafeDir = 2) then gPlayer1.SetDirection(D_LEFT)
- else if (strafeDir = 1) then gPlayer1.SetDirection(D_RIGHT);
+ if (strafeDir = 2) then gPlayer1.SetDirection(TDirection.D_LEFT)
+ else if (strafeDir = 1) then gPlayer1.SetDirection(TDirection.D_RIGHT);
end
else
begin
- if (P1MoveButton = 2) and isKeyPressed(KeyLeft, KeyLeft2) then gPlayer1.SetDirection(D_LEFT)
- else if (P1MoveButton = 1) and isKeyPressed(KeyRight, KeyRight2) then gPlayer1.SetDirection(D_RIGHT)
+ if (P1MoveButton = 2) and isKeyPressed(KeyLeft, KeyLeft2) then gPlayer1.SetDirection(TDirection.D_LEFT)
+ else if (P1MoveButton = 1) and isKeyPressed(KeyRight, KeyRight2) then gPlayer1.SetDirection(TDirection.D_RIGHT)
else if P1MoveButton <> 0 then gPlayer1.SetDirection(TDirection(P1MoveButton-1));
end;
FileStream : TStream;
fname: string;
begin
- e_WriteLog(Format('NETWORK: looking for file "%s"', [FileName]), MSG_NOTIFY);
+ e_WriteLog(Format('NETWORK: looking for file "%s"', [FileName]), TMsgType.Notify);
fname := findDiskWad(FileName);
if length(fname) = 0 then
begin
- e_WriteLog(Format('NETWORK: file "%s" not found!', [FileName]), MSG_FATALERROR);
+ e_WriteLog(Format('NETWORK: file "%s" not found!', [FileName]), TMsgType.Fatal);
SetLength(Result, 0);
exit;
end;
- e_WriteLog(Format('NETWORK: found file "%s"', [fname]), MSG_NOTIFY);
+ e_WriteLog(Format('NETWORK: found file "%s"', [fname]), TMsgType.Notify);
Result := nil;
FileStream := openDiskFileRO(fname);
try
mapDataMsg: TMapDataMsg;
begin
e_WriteLog('NET: Received map request from ' +
- DecodeIPV4(C.Peer.address.host), MSG_NOTIFY);
+ DecodeIPV4(C.Peer.address.host), TMsgType.Notify);
mapDataMsg := CreateMapDataMsg(MapsDir + gGameSettings.WAD, gExternalResources);
peer := NetClients[C.ID].Peer;
begin
FileName := ExtractFileName(M.ReadString());
e_WriteLog('NET: Received res request: ' + FileName +
- ' from ' + DecodeIPV4(C.Peer.address.host), MSG_NOTIFY);
+ ' from ' + DecodeIPV4(C.Peer.address.host), TMsgType.Notify);
if not IsValidFilePath(FileName) then
begin
- e_WriteLog('Invalid filename: ' + FileName, MSG_WARNING);
+ e_WriteLog('Invalid filename: ' + FileName, TMsgType.Warning);
exit;
end;
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 13de0c499d13e7a82df4b8c30e6404e1c271f286..37aac9da3d198269795ff608afd161a840d84d41 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
i: Integer;
begin
gAskLanguage := True;
- e_WriteLog('Reading config', MSG_NOTIFY);
+ e_WriteLog('Reading config', TMsgType.Notify);
if not FileExists(FileName) then
begin
- e_WriteLog('Config file '+FileName+' not found', MSG_WARNING);
+ e_WriteLog('Config file '+FileName+' not found', TMsgType.Warning);
g_Options_SetDefault();
// Default video options:
config: TConfig;
i: Integer;
begin
- e_WriteLog('Writing config', MSG_NOTIFY);
+ e_WriteLog('Writing config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
var
config: TConfig;
begin
- e_WriteLog('Writing language config', MSG_NOTIFY);
+ e_WriteLog('Writing language config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
config.WriteStr('Game', 'Language', gLanguage);
config: TConfig;
sW, sH: Integer;
begin
- e_WriteLog('Writing resolution to config', MSG_NOTIFY);
+ e_WriteLog('Writing resolution to config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
var
config: TConfig;
begin
- e_WriteLog('Writing custom gameplay config', MSG_NOTIFY);
+ e_WriteLog('Writing custom gameplay config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
var
config: TConfig;
begin
- e_WriteLog('Writing network gameplay config', MSG_NOTIFY);
+ e_WriteLog('Writing network gameplay config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
var
config: TConfig;
begin
- e_WriteLog('Writing server config', MSG_NOTIFY);
+ e_WriteLog('Writing server config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
var
config: TConfig;
begin
- e_WriteLog('Writing client config', MSG_NOTIFY);
+ e_WriteLog('Writing client config', TMsgType.Notify);
config := TConfig.CreateFile(FileName);
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index c5eec299a67f3b75dbffbdae292e14c19ca3870a..2ff9af5648006d2650a0b4e5e101e781e03f3003 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
// Åñëè íå ñïåöòåêñòóðà, òî çàäàåì ðàçìåðû:
if PanelRec.TextureNum > High(Textures) then
begin
- e_WriteLog(Format('WTF?! PanelRec.TextureNum is out of limits! (%d : %d)', [PanelRec.TextureNum, High(Textures)]), MSG_FATALERROR);
+ e_WriteLog(Format('WTF?! PanelRec.TextureNum is out of limits! (%d : %d)', [PanelRec.TextureNum, High(Textures)]), TMsgType.Fatal);
FTextureWidth := 2;
FTextureHeight := 2;
FAlpha := 0;
for yy := 0 to (Height div FTextureHeight)-1 do
FTextureIDs[FCurTexture].AnTex.Draw(
X + xx*FTextureWidth,
- Y + yy*FTextureHeight, M_NONE);
+ Y + yy*FTextureHeight, TMirrorType.None);
end
else
begin // Îáû÷íàÿ òåêñòóðà
case FTextureIDs[FCurTexture].Tex of
- LongWord(TEXTURE_SPECIAL_WATER): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 0, 0, 255, 0, B_FILTER);
- LongWord(TEXTURE_SPECIAL_ACID1): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 0, 128, 0, 0, B_FILTER);
- LongWord(TEXTURE_SPECIAL_ACID2): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 128, 0, 0, 0, B_FILTER);
+ LongWord(TEXTURE_SPECIAL_WATER): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 0, 0, 255, 0, TBlending.Filter);
+ LongWord(TEXTURE_SPECIAL_ACID1): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 0, 128, 0, 0, TBlending.Filter);
+ LongWord(TEXTURE_SPECIAL_ACID2): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 128, 0, 0, 0, TBlending.Filter);
LongWord(TEXTURE_NONE):
if g_Texture_Get('NOTEXTURE', NoTextureID) then
begin
diff --git a/src/game/g_player.pas b/src/game/g_player.pas
index 4b0bffce46977c3e721a484dd314fb764ceff52a..14a2fdcd4d17d4fb9c3478ce9383303c7fe14986 100644 (file)
--- a/src/game/g_player.pas
+++ b/src/game/g_player.pas
gPlayers[a].FNoRespawn := utils.readBool(st);
// Íàïðàâëåíèå
b := utils.readByte(st);
- if b = 1 then gPlayers[a].FDirection := D_LEFT else gPlayers[a].FDirection := D_RIGHT; // b = 2
+ if b = 1 then gPlayers[a].FDirection := TDirection.D_LEFT else gPlayers[a].FDirection := TDirection.D_RIGHT; // b = 2
// Çäîðîâüå
gPlayers[a].FHealth := utils.readLongInt(st);
// Æèçíè
a.X := Obj.Rect.X+(Obj.Rect.Width div 2);
a.y := Obj.Rect.Y+(Obj.Rect.Height div 2);
- e_DrawAdv(ID, Obj.X, Obj.Y, 0, True, False, RAngle, @a, M_NONE);
+ e_DrawAdv(ID, Obj.X, Obj.Y, 0, True, False, RAngle, @a, TMirrorType.None);
e_Colors := Color;
- e_DrawAdv(MaskID, Obj.X, Obj.Y, 0, True, False, RAngle, @a, M_NONE);
+ e_DrawAdv(MaskID, Obj.X, Obj.Y, 0, True, False, RAngle, @a, TMirrorType.None);
e_Colors.R := 255;
e_Colors.G := 255;
e_Colors.B := 255;
a.X := CX;
a.Y := CY;
- e_DrawAdv(SpriteID, Obj.X, Obj.Y, 0, True, False, RAngle, @a, M_NONE);
+ e_DrawAdv(SpriteID, Obj.X, Obj.Y, 0, True, False, RAngle, @a, TMirrorType.None);
end;
end;
Rw, Gw, Bw: SmallInt;
Dot: Byte;
begin
- bubX := FObj.X+FObj.Rect.X + IfThen(FDirection = D_LEFT, -4, 18);
+ bubX := FObj.X+FObj.Rect.X + IfThen(FDirection = TDirection.D_LEFT, -4, 18);
bubY := FObj.Y+FObj.Rect.Y - 18;
Rb := 64;
Gb := 64;
4: // custom textured bubble
begin
if g_Texture_Get('TEXTURE_PLAYER_TALKBUBBLE', ID) then
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
e_Draw(ID, bubX - 6, bubY - 7, 0, True, False)
else
- e_Draw(ID, bubX - 6, bubY - 7, 0, True, False, M_HORIZONTAL);
+ e_Draw(ID, bubX - 6, bubY - 7, 0, True, False, TMirrorType.Horizontal);
Exit;
end;
end;
e_DrawFillQuad(bubX + 1, bubY + 1, bubX + 18, bubY + 12, Rw, Gw, Bw, 0);
// Tail
- Dot := IfThen(FDirection = D_LEFT, 14, 5);
+ Dot := IfThen(FDirection = TDirection.D_LEFT, 14, 5);
e_DrawLine(1, bubX + Dot, bubY + 14, bubX + Dot, bubY + 16, Rb, Gb, Bb);
- e_DrawLine(1, bubX + IfThen(FDirection = D_LEFT, Dot - 1, Dot + 1), bubY + 13, bubX + IfThen(FDirection = D_LEFT, Dot - 1, Dot + 1), bubY + 15, Rw, Gw, Bw);
- e_DrawLine(1, bubX + IfThen(FDirection = D_LEFT, Dot - 2, Dot + 2), bubY + 13, bubX + IfThen(FDirection = D_LEFT, Dot - 2, Dot + 2), bubY + 14, Rw, Gw, Bw);
- e_DrawLine(1, bubX + IfThen(FDirection = D_LEFT, Dot - 3, Dot + 3), bubY + 13, bubX + IfThen(FDirection = D_LEFT, Dot - 3, Dot + 3), bubY + 13, Rw, Gw, Bw);
- e_DrawLine(1, bubX + IfThen(FDirection = D_LEFT, Dot - 3, Dot + 3), bubY + 14, bubX + IfThen(FDirection = D_LEFT, Dot - 1, Dot + 1), bubY + 16, Rb, Gb, Bb);
+ e_DrawLine(1, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 1, Dot + 1), bubY + 13, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 1, Dot + 1), bubY + 15, Rw, Gw, Bw);
+ e_DrawLine(1, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 2, Dot + 2), bubY + 13, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 2, Dot + 2), bubY + 14, Rw, Gw, Bw);
+ e_DrawLine(1, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 3, Dot + 3), bubY + 13, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 3, Dot + 3), bubY + 13, Rw, Gw, Bw);
+ e_DrawLine(1, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 3, Dot + 3), bubY + 14, bubX + IfThen(FDirection = TDirection.D_LEFT, Dot - 1, Dot + 1), bubY + 16, Rb, Gb, Bb);
// Dots
Dot := 6;
if g_Texture_Get('TEXTURE_PLAYER_INVULPENTA', ID) then
begin
e_GetTextureSize(ID, @w, @h);
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
e_Draw(ID, FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-(w div 2)+4,
FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-(h div 2)-7+FObj.slopeUpLeft, 0, True, False)
else
angle: SmallInt;
sz, len: Word;
begin
- wx := FObj.X + WEAPONPOINT[FDirection].X + IfThen(FDirection = D_LEFT, 7, -7);
+ wx := FObj.X + WEAPONPOINT[FDirection].X + IfThen(FDirection = TDirection.D_LEFT, 7, -7);
wy := FObj.Y + WEAPONPOINT[FDirection].Y;
angle := FAngle;
len := 1024;
if dr then
e_DrawFillQuad(0, 0, gPlayerScreenSize.X-1, gPlayerScreenSize.Y-1,
- 191, 191, 191, 0, B_INVERT);
+ 191, 191, 191, 0, TBlending.Invert);
end;
// Ïðè âçÿòèè çàùèòíîãî êîñòþìà ðèñóåòñÿ çåëåíîâàòûé ôîí
if dr then
e_DrawFillQuad(0, 0, gPlayerScreenSize.X-1, gPlayerScreenSize.Y-1,
- 0, 96, 0, 200, B_NONE);
+ 0, 96, 0, 200, TBlending.None);
end;
// Ïðè âçÿòèè áåðñåðêà ðèñóåòñÿ êðàñíîâàòûé ôîí
if (FBerserk >= 0) and (LongWord(FBerserk) >= gTime) and (gFlash = 2) then
begin
e_DrawFillQuad(0, 0, gPlayerScreenSize.X-1, gPlayerScreenSize.Y-1,
- 255, 0, 0, 200, B_NONE);
+ 255, 0, 0, 200, TBlending.None);
end;
end;
f := False;
wx := FObj.X+WEAPONPOINT[FDirection].X;
wy := FObj.Y+WEAPONPOINT[FDirection].Y;
- xd := wx+IfThen(FDirection = D_LEFT, -30, 30);
+ xd := wx+IfThen(FDirection = TDirection.D_LEFT, -30, 30);
yd := wy+firediry();
case FCurrWeap of
FObj.Accel.Y := 0;
FDirection := RespawnPoint.Direction;
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
FAngle := 180
else
FAngle := 0;
FlySmoke();
// Áåæèì:
- if Direction = D_LEFT then
+ if Direction = TDirection.D_LEFT then
begin
if FObj.Vel.X > -MAX_RUNVEL then
FObj.Vel.X := FObj.Vel.X - (MAX_RUNVEL shr 3);
begin
SetAction(A_SEEDOWN);
- if FDirection = D_LEFT then FAngle := ANGLE_LEFTDOWN else FAngle := ANGLE_RIGHTDOWN;
+ if FDirection = TDirection.D_LEFT then FAngle := ANGLE_LEFTDOWN else FAngle := ANGLE_RIGHTDOWN;
if FIncCam > -120 then DecMin(FIncCam, 5, -120);
end;
begin
SetAction(A_SEEUP);
- if FDirection = D_LEFT then FAngle := ANGLE_LEFTUP else FAngle := ANGLE_RIGHTUP;
+ if FDirection = TDirection.D_LEFT then FAngle := ANGLE_LEFTUP else FAngle := ANGLE_RIGHTUP;
if FIncCam < 120 then IncMax(FIncCam, 5, 120);
end;
begin
if dir = 1 then
begin
- SetDirection(D_LEFT);
+ SetDirection(TDirection.D_LEFT);
FAngle := 180;
end
else
if dir = 2 then
begin
- SetDirection(D_RIGHT);
+ SetDirection(TDirection.D_RIGHT);
FAngle := 0;
end
else
if dir = 3 then
begin // îáðàòíîå
- if FDirection = D_RIGHT then
+ if FDirection = TDirection.D_RIGHT then
begin
- SetDirection(D_LEFT);
+ SetDirection(TDirection.D_LEFT);
FAngle := 180;
end
else
begin
- SetDirection(D_RIGHT);
+ SetDirection(TDirection.D_RIGHT);
FAngle := 0;
end;
end;
if FAlive and (gFly or FJetpack) then
FlySmoke();
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
FAngle := 180
else
FAngle := 0;
if (FObj.Vel.X = 0) and FAlive then
begin
if FKeys[KEY_LEFT].Pressed then
- Run(D_LEFT);
+ Run(TDirection.D_LEFT);
if FKeys[KEY_RIGHT].Pressed then
- Run(D_RIGHT);
+ Run(TDirection.D_RIGHT);
end;
if FPhysics then
if FAlive then
begin
// Let alive player do some actions
- if FKeys[KEY_LEFT].Pressed then Run(D_LEFT);
- if FKeys[KEY_RIGHT].Pressed then Run(D_RIGHT);
+ if FKeys[KEY_LEFT].Pressed then Run(TDirection.D_LEFT);
+ if FKeys[KEY_RIGHT].Pressed then Run(TDirection.D_RIGHT);
//if FKeys[KEY_NEXTWEAPON].Pressed and AnyServer then NextWeapon();
//if FKeys[KEY_PREVWEAPON].Pressed and AnyServer then PrevWeapon();
if FKeys[KEY_FIRE].Pressed and AnyServer then Fire();
begin
wx := FObj.X+WEAPONPOINT[FDirection].X;
wy := FObj.Y+WEAPONPOINT[FDirection].Y;
- xd := wx+IfThen(FDirection = D_LEFT, -30, 30);
+ xd := wx+IfThen(FDirection = TDirection.D_LEFT, -30, 30);
yd := wy+firediry();
g_Weapon_bfgshot(wx, wy, xd, yd, FUID);
if NetServer then MH_SEND_PlayerFire(FUID, WEAPON_BFG, wx, wy, xd, yd);
// Èçðàñõîäîâàë ëè âñå æèçíè
utils.writeBool(st, FNoRespawn);
// Íàïðàâëåíèå
- if FDirection = D_LEFT then b := 1 else b := 2; // D_RIGHT
+ if FDirection = TDirection.D_LEFT then b := 1 else b := 2; // D_RIGHT
utils.writeInt(st, Byte(b));
// Çäîðîâüå
utils.writeInt(st, LongInt(FHealth));
FNoRespawn := utils.readBool(st);
// Íàïðàâëåíèå
b := utils.readByte(st);
- if b = 1 then FDirection := D_LEFT else FDirection := D_RIGHT; // b = 2
+ if b = 1 then FDirection := TDirection.D_LEFT else FDirection := TDirection.D_RIGHT; // b = 2
// Çäîðîâüå
FHealth := utils.readLongInt(st);
// Æèçíè
Exit;
if FAnimation <> nil then
- FAnimation.Draw(FObj.X, FObj.Y, M_NONE);
+ FAnimation.Draw(FObj.X, FObj.Y, TMirrorType.None);
if FAnimationMask <> nil then
begin
e_Colors := FColor;
- FAnimationMask.Draw(FObj.X, FObj.Y, M_NONE);
+ FAnimationMask.Draw(FObj.X, FObj.Y, TMirrorType.None);
e_Colors.R := 255;
e_Colors.G := 255;
e_Colors.B := 255;
if (Healthy() = 3) or ((Healthy() = 2)) then
begin // Åñëè çäîðîâû - äîãîíÿåì
- if ((RunDirection() = D_LEFT) and (Target.X > FObj.X)) then
+ if ((RunDirection() = TDirection.D_LEFT) and (Target.X > FObj.X)) then
SetAIFlag('GORIGHT', '1');
- if ((RunDirection() = D_RIGHT) and (Target.X < FObj.X)) then
+ if ((RunDirection() = TDirection.D_RIGHT) and (Target.X < FObj.X)) then
SetAIFlag('GOLEFT', '1');
end
else
begin // Åñëè ïîáèòû - óáåãàåì
- if ((RunDirection() = D_LEFT) and (Target.X < FObj.X)) then
+ if ((RunDirection() = TDirection.D_LEFT) and (Target.X < FObj.X)) then
SetAIFlag('GORIGHT', '1');
- if ((RunDirection() = D_RIGHT) and (Target.X > FObj.X)) then
+ if ((RunDirection() = TDirection.D_RIGHT) and (Target.X > FObj.X)) then
SetAIFlag('GOLEFT', '1');
end;
begin // Öåëü ñáåæàëà ñ "ýêðàíà"
if (Healthy() = 3) or ((Healthy() = 2)) then
begin // Åñëè çäîðîâû - äîãîíÿåì
- if ((RunDirection() = D_LEFT) and (Target.X > FObj.X)) then
+ if ((RunDirection() = TDirection.D_LEFT) and (Target.X > FObj.X)) then
SetAIFlag('GORIGHT', '1');
- if ((RunDirection() = D_RIGHT) and (Target.X < FObj.X)) then
+ if ((RunDirection() = TDirection.D_RIGHT) and (Target.X < FObj.X)) then
SetAIFlag('GOLEFT', '1');
end
else
begin // Åñëè ïîáèòû - çàáûâàåì î öåëè è óáåãàåì
Target.UID := 0;
- if ((RunDirection() = D_LEFT) and (Target.X < FObj.X)) then
+ if ((RunDirection() = TDirection.D_LEFT) and (Target.X < FObj.X)) then
SetAIFlag('GORIGHT', '1');
- if ((RunDirection() = D_RIGHT) and (Target.X > FObj.X)) then
+ if ((RunDirection() = TDirection.D_RIGHT) and (Target.X > FObj.X)) then
SetAIFlag('GOLEFT', '1');
end;
end
// Åñëè ðàçíèöà âûñîò íå âåëèêà, òî äîãîíÿåì:
if (Abs(FObj.Y-Target.Y) <= 128) then
begin
- if ((RunDirection() = D_LEFT) and (Target.X > FObj.X)) then
+ if ((RunDirection() = TDirection.D_LEFT) and (Target.X > FObj.X)) then
SetAIFlag('GORIGHT', '1');
- if ((RunDirection() = D_RIGHT) and (Target.X < FObj.X)) then
+ if ((RunDirection() = TDirection.D_RIGHT) and (Target.X < FObj.X)) then
SetAIFlag('GOLEFT', '1');
end;
end;
// Âûáèðàåì óãîë ââåðõ:
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
angle := ANGLE_LEFTUP
else
angle := ANGLE_RIGHTUP;
end;
// Âûáèðàåì óãîë âíèç:
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
angle := ANGLE_LEFTDOWN
else
angle := ANGLE_RIGHTDOWN;
(y1-4 > Target.Y+Target.Rect.Y) then
begin
// Åñëè èäåì â ñòîðîíó öåëè, òî íàäî ñòðåëÿòü:
- if ((FDirection = D_LEFT) and (Target.X < FObj.X)) or
- ((FDirection = D_RIGHT) and (Target.X > FObj.X)) then
+ if ((FDirection = TDirection.D_LEFT) and (Target.X < FObj.X)) or
+ ((FDirection = TDirection.D_RIGHT) and (Target.X > FObj.X)) then
begin // òî íóæíî ñòðåëÿòü âïåðåä
SetAIFlag('NEEDFIRE', '1');
SetAIFlag('NEEDSEEDOWN', '');
SetAIFlag('NEEDJUMP', '1');
- if RunDirection() = D_RIGHT then
+ if RunDirection() = TDirection.D_RIGHT then
begin // Èäåì íå â òó ñòîðîíó
if (Healthy() > 1) and GetRnd(FDifficult.InvisFire) then
begin // Åñëè çäîðîâû, òî, âîçìîæíî, ñòðåëÿåì áåæèì âëåâî è ñòðåëÿåì
SetAIFlag('NEEDJUMP', '1');
- if RunDirection() = D_LEFT then
+ if RunDirection() = TDirection.D_LEFT then
begin // Èäåì íå â òó ñòîðîíó
if (Healthy() > 1) and GetRnd(FDifficult.InvisFire) then
begin // Åñëè çäîðîâû, òî, âîçìîæíî, áåæèì âïðàâî è ñòðåëÿåì
if GetRnd(FDifficult.DiagFire) then
begin
// Èùåì öåëü ñâåðõó è ñòðåëÿåì, åñëè åñòü:
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
angle := ANGLE_LEFTUP
else
angle := ANGLE_RIGHTUP;
end;
// Èùåì öåëü ñíèçó è ñòðåëÿåì, åñëè åñòü:
- if FDirection = D_LEFT then
+ if FDirection = TDirection.D_LEFT then
angle := ANGLE_LEFTDOWN
else
angle := ANGLE_RIGHTDOWN;
// Åñëè öåëü "ïåðåä íîñîì", òî ñòðåëÿåì:
if targets[a].Line and targets[a].Visible and
- (((FDirection = D_LEFT) and (targets[a].X < FObj.X)) or
- ((FDirection = D_RIGHT) and (targets[a].X > FObj.X))) then
+ (((FDirection = TDirection.D_LEFT) and (targets[a].X < FObj.X)) or
+ ((FDirection = TDirection.D_RIGHT) and (targets[a].X > FObj.X))) then
begin
SetAIFlag('NEEDFIRE', '1');
Break;
ReleaseKey(KEY_LEFT);
ReleaseKey(KEY_RIGHT);
PressKey(KEY_LEFT, Time);
- SetDirection(D_LEFT);
+ SetDirection(TDirection.D_LEFT);
end;
procedure GoRight(Time: Word = 1);
ReleaseKey(KEY_LEFT);
ReleaseKey(KEY_RIGHT);
PressKey(KEY_RIGHT, Time);
- SetDirection(D_RIGHT);
+ SetDirection(TDirection.D_RIGHT);
end;
function Rnd(a: Word): Boolean;
procedure Turn(Time: Word = 1200);
begin
- if RunDirection() = D_LEFT then GoRight(Time) else GoLeft(Time);
+ if RunDirection() = TDirection.D_LEFT then GoRight(Time) else GoLeft(Time);
end;
procedure Stop();
function CanRun(): Boolean;
begin
- if RunDirection() = D_LEFT then Result := CanRunLeft() else Result := CanRunRight();
+ if RunDirection() = TDirection.D_LEFT then Result := CanRunLeft() else Result := CanRunRight();
end;
procedure Jump(Time: Word = 30);
x, sx: Integer;
begin
{ TODO 5 : Ëåñòíèöû }
- sx := IfThen(RunDirection() = D_LEFT, -1, 1);
+ sx := IfThen(RunDirection() = TDirection.D_LEFT, -1, 1);
for x := 1 to PLAYER_RECT.Width do
if (not StayOnStep(x*sx, 0)) and
(not CollideLevel(x*sx, PLAYER_RECT.Height)) and
x, sx, xx: Integer;
begin
{ TODO 5 : Ëåñòíèöû }
- sx := IfThen(RunDirection() = D_LEFT, -1, 1);
+ sx := IfThen(RunDirection() = TDirection.D_LEFT, -1, 1);
for x := 1 to PLAYER_RECT.Width do
if (not StayOnStep(x*sx, 0)) and
(not CollideLevel(x*sx, PLAYER_RECT.Height)) and
begin
Result := False;
- sx := IfThen(RunDirection() = D_LEFT, -1, 1);
+ sx := IfThen(RunDirection() = TDirection.D_LEFT, -1, 1);
y := 3;
for x := 1 to PLAYER_RECT.Width do
function BelowLadder(): Boolean;
begin
- Result := (FullInStep(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height) and
- not CollideLevel(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height)) or
- (FullInStep(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP) and
- not CollideLevel(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP));
+ Result := (FullInStep(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height) and
+ not CollideLevel(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height)) or
+ (FullInStep(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP) and
+ not CollideLevel(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP));
end;
function BelowLiftUp(): Boolean;
begin
- Result := ((FullInLift(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height) = -1) and
- not CollideLevel(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height)) or
- ((FullInLift(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP) = -1) and
- not CollideLevel(IfThen(RunDirection() = D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP));
+ Result := ((FullInLift(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height) = -1) and
+ not CollideLevel(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -PLAYER_RECT.Height)) or
+ ((FullInLift(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP) = -1) and
+ not CollideLevel(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*(PLAYER_RECT.Width div 2), -BOT_MAXJUMP));
end;
function OnTopLift(): Boolean;
var
sx, y: Integer;
begin
- sx := IfThen(RunDirection() = D_LEFT, -1, 1);
+ sx := IfThen(RunDirection() = TDirection.D_LEFT, -1, 1);
Result := False;
// Åñëè íà çåìëå è ìîæíî ïîäïðûãíóòü, òî, âîçìîæíî, ïðûãàåì:
if OnGround() and
- CanJumpUp(IfThen(RunDirection() = D_LEFT, -1, 1)*32) and
+ CanJumpUp(IfThen(RunDirection() = TDirection.D_LEFT, -1, 1)*32) and
Rnd(8) then
Jump();
begin
if Abs(Vel.X) >= 1 then
begin
- if Vel.X > 0 then Result := D_RIGHT else Result := D_LEFT;
+ if Vel.X > 0 then Result := TDirection.D_RIGHT else Result := TDirection.D_LEFT;
end else
Result := FDirection;
end;
index b8d0ec6c7ef4b74d3f1c54c6a7297af846029d88..e4b485d9eac079280c34118ec8e237be918097c3 100644 (file)
TGibsArray = Array of TGibSprite;
TWeaponPoints = Array [WP_FIRST + 1..WP_LAST] of
Array [A_STAND..A_LAST] of
- Array [D_LEFT..D_RIGHT] of Array of TDFPoint;
+ Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array of TDFPoint;
TPlayerModel = class(TPoolObject)
private
FDirection: TDirection;
FColor: TRGB;
FCurrentAnimation: Byte;
- FAnim: Array [D_LEFT..D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
- FMaskAnim: Array [D_LEFT..D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
+ FAnim: Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
+ FMaskAnim: Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array [A_STAND..A_LAST] of TAnimation;
FWeaponPoints: TWeaponPoints;
FPainSounds: TModelSoundArray;
FDieSounds: TModelSoundArray;
begin
X := X - WEAPONBASE[weapon].X;
Y := Y - WEAPONBASE[weapon].Y;
- if dir = D_LEFT then
+ if dir = TDirection.D_LEFT then
X := -X;
end;
end;
begin
for W := WP_FIRST + 1 to WP_LAST do
begin
- for D := D_LEFT to D_RIGHT do
+ for D := TDirection.D_LEFT to TDirection.D_RIGHT do
begin
SetLength(WeaponPoints[W, AIdx, D], Length(WeaponPoints[W, OIdx, D]));
for I := 0 to High(WeaponPoints[W, AIdx, D]) do
prefix: string;
ok, chk: Boolean;
begin
- e_WriteLog(Format('Loading player model: %s', [ExtractFileName(FileName)]), MSG_NOTIFY);
+ e_WriteLog(Format('Loading player model: %s', [ExtractFileName(FileName)]), TMsgType.Notify);
Result := False;
for aa := WP_FIRST + 1 to WP_LAST do
for bb := A_STAND to A_LAST do
- for cc := D_LEFT to D_RIGHT do
+ for cc := TDirection.D_LEFT to TDirection.D_RIGHT do
begin
f := config.ReadInt(AnimNames[bb], 'frames', 1);
if config.ReadBool(AnimNames[bb], 'backanim', False) then
for bb := A_STAND to A_LAST do
if not (bb in [A_DIE1, A_DIE2, A_PAIN]) then
begin
- chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'_points', ''), aa, bb, D_RIGHT,
+ chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'_points', ''), aa, bb, TDirection.D_RIGHT,
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints);
if ok and (not chk) and (aa = WEAPON_FLAMETHROWER) then
begin
// workaround for flamethrower
- chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[WEAPON_PLASMA]+'_points', ''), aa, bb, D_RIGHT,
+ chk := GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[WEAPON_PLASMA]+'_points', ''), aa, bb, TDirection.D_RIGHT,
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints);
if chk then
- for f := 0 to High(WeaponPoints[aa, bb, D_RIGHT]) do
+ for f := 0 to High(WeaponPoints[aa, bb, TDirection.D_RIGHT]) do
begin
case bb of
A_STAND, A_PAIN:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 8);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 6);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 8);
end;
A_WALKATTACK, A_WALK:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 9);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 9);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 9);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 9);
end;
A_ATTACK:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 8);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 8);
end;
A_WALKSEEUP, A_SEEUP:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 16);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 16);
end;
A_WALKSEEDOWN, A_SEEDOWN:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 6);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 5);
end;
A_WALKATTACKUP, A_ATTACKUP:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 5);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 16);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 5);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 16);
end;
A_WALKATTACKDOWN, A_ATTACKDOWN:
begin
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].X, 6);
- Dec(WeaponPoints[aa, bb, D_RIGHT, f].Y, 4);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X, 6);
+ Dec(WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y, 4);
end;
end;
end;
end;
ok := ok and (chk or (bb > A_LASTBASE));
- if not GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'2_points', ''), aa, bb, D_LEFT,
+ if not GetWeapPoints(config.ReadStr(AnimNames[bb], WeapNames[aa]+'2_points', ''), aa, bb, TDirection.D_LEFT,
config.ReadInt(AnimNames[bb], 'frames', 0),
config.ReadBool(AnimNames[bb], 'backanim', False),
WeaponPoints) then
- for f := 0 to High(WeaponPoints[aa, bb, D_RIGHT]) do
+ for f := 0 to High(WeaponPoints[aa, bb, TDirection.D_RIGHT]) do
begin
- WeaponPoints[aa, bb, D_LEFT, f].X := -WeaponPoints[aa, bb, D_RIGHT, f].X;
- WeaponPoints[aa, bb, D_LEFT, f].Y := WeaponPoints[aa, bb, D_RIGHT, f].Y;
+ WeaponPoints[aa, bb, TDirection.D_LEFT, f].X := -WeaponPoints[aa, bb, TDirection.D_RIGHT, f].X;
+ WeaponPoints[aa, bb, TDirection.D_LEFT, f].Y := WeaponPoints[aa, bb, TDirection.D_RIGHT, f].Y;
end;
if not ok then Break;
Exit;
end;
- Result.FAnim[D_RIGHT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FAnim[TDirection.D_RIGHT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
- Result.FMaskAnim[D_RIGHT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FMaskAnim[TDirection.D_RIGHT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
if g_Frames_Exists(Info.Name+'_LEFTANIM'+IntToStr(b)) and
g_Frames_Exists(Info.Name+'_LEFTANIM'+IntToStr(b)+'_MASK') then
if g_Frames_Get(ID, Info.Name+'_LEFTANIM'+IntToStr(b)) and
g_Frames_Get(ID2, Info.Name+'_LEFTANIM'+IntToStr(b)+'_MASK') then
begin
- Result.FAnim[D_LEFT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FAnim[TDirection.D_LEFT][b] := TAnimation.Create(ID, b in [A_STAND, A_WALK], ModelSpeed[b]);
- Result.FMaskAnim[D_LEFT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
+ Result.FMaskAnim[TDirection.D_LEFT][b] := TAnimation.Create(ID2, b in [A_STAND, A_WALK], ModelSpeed[b]);
end;
end;
for c := W_ACT_NORMAL to W_ACT_FIRE do
e_DeleteTexture(WeaponID[a][b][c]);
- e_WriteLog('Releasing models...', MSG_NOTIFY);
+ e_WriteLog('Releasing models...', TMsgType.Notify);
if PlayerModelsArray = nil then Exit;
FCurrentAnimation := Animation;
- if (FDirection = D_LEFT) and
- (FAnim[D_LEFT][FCurrentAnimation] <> nil) and
- (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
+ if (FDirection = TDirection.D_LEFT) and
+ (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) and
+ (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
begin
- FAnim[D_LEFT][FCurrentAnimation].Reset;
- FMaskAnim[D_LEFT][FCurrentAnimation].Reset;
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Reset;
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Reset;
end
else
begin
- FAnim[D_RIGHT][FCurrentAnimation].Reset;
- FMaskAnim[D_RIGHT][FCurrentAnimation].Reset;
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].Reset;
+ FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Reset;
end;
end;
begin
for a := A_STAND to A_LAST do
begin
- FAnim[D_LEFT][a].Free();
- FMaskAnim[D_LEFT][a].Free();
- FAnim[D_RIGHT][a].Free();
- FMaskAnim[D_RIGHT][a].Free();
+ FAnim[TDirection.D_LEFT][a].Free();
+ FMaskAnim[TDirection.D_LEFT][a].Free();
+ FAnim[TDirection.D_RIGHT][a].Free();
+ FMaskAnim[TDirection.D_RIGHT][a].Free();
end;
inherited;
p: TDFPoint;
begin
// Ôëàãè:
- if Direction = D_LEFT then
- Mirror := M_NONE
+ if Direction = TDirection.D_LEFT then
+ Mirror := TMirrorType.None
else
- Mirror := M_HORIZONTAL;
+ Mirror := TMirrorType.Horizontal;
if (FFlag <> FLAG_NONE) and (FFlagAnim <> nil) and
(not (FCurrentAnimation in [A_DIE1, A_DIE2])) then
begin
- p.X := IfThen(Direction = D_LEFT,
+ p.X := IfThen(Direction = TDirection.D_LEFT,
FLAG_BASEPOINT.X,
64-FLAG_BASEPOINT.X);
p.Y := FLAG_BASEPOINT.Y;
- FFlagAnim.DrawEx(X+IfThen(Direction = D_LEFT, FFlagPoint.X-1, 2*FLAG_BASEPOINT.X-FFlagPoint.X+1)-FLAG_BASEPOINT.X,
+ FFlagAnim.DrawEx(X+IfThen(Direction = TDirection.D_LEFT, FFlagPoint.X-1, 2*FLAG_BASEPOINT.X-FFlagPoint.X+1)-FLAG_BASEPOINT.X,
Y+FFlagPoint.Y-FLAG_BASEPOINT.Y+1, Mirror, p,
- IfThen(FDirection = D_RIGHT, FFlagAngle, -FFlagAngle));
+ IfThen(FDirection = TDirection.D_RIGHT, FFlagAngle, -FFlagAngle));
end;
// Îðóæèå:
- if Direction = D_RIGHT then
- Mirror := M_NONE
+ if Direction = TDirection.D_RIGHT then
+ Mirror := TMirrorType.None
else
- Mirror := M_HORIZONTAL;
+ Mirror := TMirrorType.Horizontal;
if FDrawWeapon and
(not (FCurrentAnimation in [A_DIE1, A_DIE2, A_PAIN])) and
if Alpha < 201 then
e_Draw(WeaponID[FCurrentWeapon][pos][act],
X+FWeaponPoints[FCurrentWeapon, FCurrentAnimation, FDirection,
- FAnim[D_RIGHT][FCurrentAnimation].CurrentFrame].X,
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].CurrentFrame].X,
Y+FWeaponPoints[FCurrentWeapon, FCurrentAnimation, FDirection,
- FAnim[D_RIGHT][FCurrentAnimation].CurrentFrame].Y,
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].CurrentFrame].Y,
0, True, False, Mirror);
end;
// Ìîäåëü:
- if (FDirection = D_LEFT) and
- (FAnim[D_LEFT][FCurrentAnimation] <> nil) then
+ if (FDirection = TDirection.D_LEFT) and
+ (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
begin
- FAnim[D_LEFT][FCurrentAnimation].Alpha := Alpha;
- FAnim[D_LEFT][FCurrentAnimation].Draw(X, Y, M_NONE);
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Alpha := Alpha;
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Draw(X, Y, TMirrorType.None);
end
else
begin
- FAnim[D_RIGHT][FCurrentAnimation].Alpha := Alpha;
- FAnim[D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].Alpha := Alpha;
+ FAnim[TDirection.D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
end;
// Ìàñêà ìîäåëè:
e_Colors := FColor;
- if (FDirection = D_LEFT) and
- (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
+ if (FDirection = TDirection.D_LEFT) and
+ (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
begin
- FMaskAnim[D_LEFT][FCurrentAnimation].Alpha := Alpha;
- FMaskAnim[D_LEFT][FCurrentAnimation].Draw(X, Y, M_NONE);
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Alpha := Alpha;
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Draw(X, Y, TMirrorType.None);
end
else
begin
- FMaskAnim[D_RIGHT][FCurrentAnimation].Alpha := Alpha;
- FMaskAnim[D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
+ FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Alpha := Alpha;
+ FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Draw(X, Y, Mirror);
end;
e_Colors.R := 255;
function TPlayerModel.GetCurrentAnimation: TAnimation;
begin
- if (FDirection = D_LEFT) and (FAnim[D_LEFT][FCurrentAnimation] <> nil) then
- Result := FAnim[D_LEFT][FCurrentAnimation]
+ if (FDirection = TDirection.D_LEFT) and (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ Result := FAnim[TDirection.D_LEFT][FCurrentAnimation]
else
- Result := FAnim[D_RIGHT][FCurrentAnimation];
+ Result := FAnim[TDirection.D_RIGHT][FCurrentAnimation];
end;
function TPlayerModel.GetCurrentAnimationMask: TAnimation;
begin
- if (FDirection = D_LEFT) and (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
- Result := FMaskAnim[D_LEFT][FCurrentAnimation]
+ if (FDirection = TDirection.D_LEFT) and (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ Result := FMaskAnim[TDirection.D_LEFT][FCurrentAnimation]
else
- Result := FMaskAnim[D_RIGHT][FCurrentAnimation];
+ Result := FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation];
end;
function TPlayerModel.PlaySound(SoundType, Level: Byte; X, Y: Integer): Boolean;
begin
FFire := Fire;
- if FFire then FFireCounter := FAnim[D_RIGHT, A_ATTACK].Speed*FAnim[D_RIGHT, A_ATTACK].TotalFrames
+ if FFire then FFireCounter := FAnim[TDirection.D_RIGHT, A_ATTACK].Speed*FAnim[TDirection.D_RIGHT, A_ATTACK].TotalFrames
else FFireCounter := 0;
end;
procedure TPlayerModel.Update();
begin
- if (FDirection = D_LEFT) and (FAnim[D_LEFT][FCurrentAnimation] <> nil) then
- FAnim[D_LEFT][FCurrentAnimation].Update else FAnim[D_RIGHT][FCurrentAnimation].Update;
+ if (FDirection = TDirection.D_LEFT) and (FAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ FAnim[TDirection.D_LEFT][FCurrentAnimation].Update else FAnim[TDirection.D_RIGHT][FCurrentAnimation].Update;
- if (FDirection = D_LEFT) and (FMaskAnim[D_LEFT][FCurrentAnimation] <> nil) then
- FMaskAnim[D_LEFT][FCurrentAnimation].Update else FMaskAnim[D_RIGHT][FCurrentAnimation].Update;
+ if (FDirection = TDirection.D_LEFT) and (FMaskAnim[TDirection.D_LEFT][FCurrentAnimation] <> nil) then
+ FMaskAnim[TDirection.D_LEFT][FCurrentAnimation].Update else FMaskAnim[TDirection.D_RIGHT][FCurrentAnimation].Update;
if FFlagAnim <> nil then FFlagAnim.Update;
index c24e6f89bcb426b36c9cc9e8508e8b0a147ef6a2..25f69858700fe6c3b340e164fc80444cd764c09d 100644 (file)
begin
SetLength(mapData.ExternalResources, 0);
g_Console_Add(Format(_lc[I_NET_MAP_DL], [FileName]));
- e_WriteLog('Downloading map `' + FileName + '` from server', MSG_NOTIFY);
+ e_WriteLog('Downloading map `' + FileName + '` from server', TMsgType.Notify);
MC_SEND_MapRequest();
msgStream := g_Net_Wait_Event(NET_MSG_MAP_RESPONSE);
g_Console_Add(Format(_lc[I_NET_WAD_DL],
[mapData.ExternalResources[i].Name]));
e_WriteLog('Downloading Wad `' + mapData.ExternalResources[i].Name +
- '` from server', MSG_NOTIFY);
+ '` from server', TMsgType.Notify);
MC_SEND_ResRequest(mapData.ExternalResources[i].Name);
msgStream := g_Net_Wait_Event(NET_MSG_RES_RESPONSE);
index dee199260879344aab173bd924a2a88af89631b7..ad438f89174172171fa0d05b6b174cc982c5cd20 100644 (file)
--- a/src/game/g_saveload.pas
+++ b/src/game/g_saveload.pas
try
if not utils.checkSign(st, 'DFSV') then
begin
- e_LogWritefln('GetSaveName: not a save file: ''%s''', [st], MSG_WARNING);
+ e_LogWritefln('GetSaveName: not a save file: ''%s''', [st], TMsgType.Warning);
//raise XStreamError.Create('invalid save game signature');
exit;
end;
stlen := utils.readWord(st);
if (stlen < 1) or (stlen > 64) then
begin
- e_LogWritefln('GetSaveName: not a save file: ''%s''', [st], MSG_WARNING);
+ e_LogWritefln('GetSaveName: not a save file: ''%s''', [st], TMsgType.Warning);
//raise XStreamError.Create('invalid save game version');
exit;
end;
begin
st.Free();
g_Console_Add(_lc[I_GAME_ERROR_SAVE]);
- e_WriteLog('SaveState Error: '+e.message, MSG_WARNING);
+ e_WriteLog('SaveState Error: '+e.message, TMsgType.Warning);
if deleteOnError then DeleteFile(filename);
{$IF DEFINED(D2F_DEBUG)}e_WriteStackTrace(e.message);{$ENDIF}
result := false;
if not utils.checkSign(st, 'DFSV') then raise XStreamError.Create('invalid save game signature');
if (utils.readByte(st) <> SAVE_VERSION) then raise XStreamError.Create('invalid save game version');
- e_WriteLog('Loading saved game...', MSG_NOTIFY);
+ e_WriteLog('Loading saved game...', TMsgType.Notify);
{$IF DEFINED(D2F_DEBUG)}try{$ENDIF}
//g_Game_Free(false); // don't free textures for the same map
on e: Exception do
begin
g_Console_Add(_lc[I_GAME_ERROR_LOAD]);
- e_WriteLog('LoadState Error: '+e.message, MSG_WARNING);
- {$IF DEFINED(D2F_DEBUG)}e_LogWritefln('stream error position: 0x%08x', [errpos], MSG_WARNING);{$ENDIF}
+ e_WriteLog('LoadState Error: '+e.message, TMsgType.Warning);
+ {$IF DEFINED(D2F_DEBUG)}e_LogWritefln('stream error position: 0x%08x', [errpos], TMsgType.Warning);{$ENDIF}
gLoadGameMode := false;
result := true;
if not gameCleared then g_Game_Free();
diff --git a/src/game/g_sound.pas b/src/game/g_sound.pas
index d7d97d20dcf9d7bbcb5cd81edd84ada4a679c000..2676b425d4bbe34dcf99943aebea42cb582b4021 100644 (file)
--- a/src/game/g_sound.pas
+++ b/src/game/g_sound.pas
Exit;
end;
- e_WriteLog(Format(_lc[I_GAME_ERROR_SOUND], [SoundName]), MSG_WARNING);
+ e_WriteLog(Format(_lc[I_GAME_ERROR_SOUND], [SoundName]), TMsgType.Warning);
end;
function g_Sound_PlayExPanVolume(SoundName: ShortString; Pan: Single; Volume: Single): Boolean;
Exit;
end;
- e_WriteLog(Format(_lc[I_GAME_ERROR_SOUND], [SoundName]), MSG_WARNING);
+ e_WriteLog(Format(_lc[I_GAME_ERROR_SOUND], [SoundName]), TMsgType.Warning);
end;
function PlaySoundAt(X, Y: Integer; var Pan: Single; var Volume: Single; InVolume: Single = 1.0): Boolean;
Exit;
end;
- e_WriteLog(Format(_lc[I_GAME_ERROR_SOUND], [SoundName]), MSG_WARNING);
+ e_WriteLog(Format(_lc[I_GAME_ERROR_SOUND], [SoundName]), TMsgType.Warning);
end;
function g_Sound_CreateFile(var ID: DWORD; FileName: string; isMusic: Boolean = False): Boolean;
begin
{$IFNDEF HEADLESS}
if isMusic then
- e_WriteLog(Format('Error loading music %s', [Resource]), MSG_WARNING)
+ e_WriteLog(Format('Error loading music %s', [Resource]), TMsgType.Warning)
else
- e_WriteLog(Format('Error loading sound %s', [Resource]), MSG_WARNING);
+ e_WriteLog(Format('Error loading sound %s', [Resource]), TMsgType.Warning);
Exit;
{$ENDIF}
end;
begin
{$IFNDEF HEADLESS}
if isMusic then
- e_WriteLog(Format('Error loading music %s', [Resource]), MSG_WARNING)
+ e_WriteLog(Format('Error loading music %s', [Resource]), TMsgType.Warning)
else
- e_WriteLog(Format('Error loading sound %s', [Resource]), MSG_WARNING);
+ e_WriteLog(Format('Error loading sound %s', [Resource]), TMsgType.Warning);
Exit;
{$ENDIF}
end;
index 07ef3be06bfddebd2f592181cef2132b1352cd50..6f239e4df78266d2ca749f9588727224a1004b7f 100644 (file)
--- a/src/game/g_textures.pas
+++ b/src/game/g_textures.pas
end
else
begin
- e_WriteLog(Format('Error loading texture %s', [Resource]), MSG_WARNING);
+ e_WriteLog(Format('Error loading texture %s', [Resource]), TMsgType.Warning);
//e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING);
end;
WAD.Free();
Result := True;
if not e_CreateTexture(FileName, ID) then
begin
- e_WriteLog(Format('Error loading texture %s', [FileName]), MSG_WARNING);
+ e_WriteLog(Format('Error loading texture %s', [FileName]), TMsgType.Warning);
Result := False;
end;
end;
begin
if showmsg then
begin
- e_WriteLog(Format('Error loading texture %s', [Resource]), MSG_WARNING);
+ e_WriteLog(Format('Error loading texture %s', [Resource]), TMsgType.Warning);
end;
//e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING);
result := false;
e_GetTextureSize(TexturesArray[find_id].ID, @TexturesArray[find_id].Width,
@TexturesArray[find_id].Height);
end
- else e_WriteLog(Format('Error loading texture %s', [FileName]), MSG_WARNING);
+ else e_WriteLog(Format('Error loading texture %s', [FileName]), TMsgType.Warning);
end;
function g_Texture_Get(TextureName: ShortString; var ID: DWORD): Boolean;
if not WAD.GetResource(g_ExtractFilePathName(Resource), TextureData, ResourceLength) then
begin
WAD.Free();
- e_WriteLog(Format('Error loading texture %s', [Resource]), MSG_WARNING);
+ e_WriteLog(Format('Error loading texture %s', [Resource]), TMsgType.Warning);
//e_WriteLog(Format('WAD Reader error: %s', [WAD.GetLastErrorStr]), MSG_WARNING);
Exit;
end;
var
i: Integer;
begin
- e_WriteLog('BEGIN Textures:', MSG_NOTIFY);
+ e_WriteLog('BEGIN Textures:', TMsgType.Notify);
for i := 0 to High(TexturesArray) do
- e_WriteLog(' '+IntToStr(i)+'. '+TexturesArray[i].Name, MSG_NOTIFY);
- e_WriteLog('END Textures.', MSG_NOTIFY);
+ e_WriteLog(' '+IntToStr(i)+'. '+TexturesArray[i].Name, TMsgType.Notify);
+ e_WriteLog('END Textures.', TMsgType.Notify);
- e_WriteLog('BEGIN Frames:', MSG_NOTIFY);
+ e_WriteLog('BEGIN Frames:', TMsgType.Notify);
for i := 0 to High(FramesArray) do
- e_WriteLog(' '+IntToStr(i)+'. '+FramesArray[i].Name, MSG_NOTIFY);
- e_WriteLog('END Frames.', MSG_NOTIFY);
+ e_WriteLog(' '+IntToStr(i)+'. '+FramesArray[i].Name, TMsgType.Notify);
+ e_WriteLog('END Frames.', TMsgType.Notify);
end;
{ TAnimation }
index 4aca319356ce70040c524a93dbd1681de2c85c57..664faf687e9e8c9053b7244837df1dacb6ab3aad 100644 (file)
--- a/src/game/g_triggers.pas
+++ b/src/game/g_triggers.pas
//HACK!
if (gTriggers[find_id].TriggerType <> TRIGGER_SECRET) then
begin
- e_LogWritefln('trigger of type %s has no triggerdata; wtf?!', [gTriggers[find_id].TriggerType], MSG_WARNING);
+ e_LogWritefln('trigger of type %s has no triggerdata; wtf?!', [gTriggers[find_id].TriggerType], TMsgType.Warning);
end;
end
else
diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index 182207f233740454ac355b5034c59625b78aea0b..311b18cbc344dbb78b83a7ad0d4c3053a858c9d9 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
procedure g_Weapon_LoadData();
begin
- e_WriteLog('Loading weapons data...', MSG_NOTIFY);
+ e_WriteLog('Loading weapons data...', TMsgType.Notify);
g_Sound_CreateWADEx('SOUND_WEAPON_HITPUNCH', GameWAD+':SOUNDS\HITPUNCH');
g_Sound_CreateWADEx('SOUND_WEAPON_MISSPUNCH', GameWAD+':SOUNDS\MISSPUNCH');
procedure g_Weapon_FreeData();
begin
- e_WriteLog('Releasing weapons data...', MSG_NOTIFY);
+ e_WriteLog('Releasing weapons data...', TMsgType.Notify);
g_Sound_Delete('SOUND_WEAPON_HITPUNCH');
g_Sound_Delete('SOUND_WEAPON_MISSPUNCH');
if (dy > 0) then yi := 1 else if (dy < 0) then yi := -1 else yi := 0;
{$IF DEFINED(D2F_DEBUG)}
- e_WriteLog(Format('GUN TRACE: (%d,%d) to (%d,%d)', [x, y, x2, y2]), MSG_NOTIFY);
+ e_WriteLog(Format('GUN TRACE: (%d,%d) to (%d,%d)', [x, y, x2, y2]), TMsgType.Notify);
stt := getTimeMicro();
{$ENDIF}
begin
{$IF DEFINED(D2F_DEBUG)}
stt := getTimeMicro()-stt;
- e_WriteLog(Format('*** new trace time: %u microseconds', [LongWord(stt)]), MSG_NOTIFY);
+ e_WriteLog(Format('*** new trace time: %u microseconds', [LongWord(stt)]), TMsgType.Notify);
{$ENDIF}
g_GFX_Spark(wallHitX, wallHitY, 2+Random(2), 180+a, 0, 0);
if g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(wallHitX, wallHitY, 180+a, NET_GFX_SPARK);
begin
{$IF DEFINED(D2F_DEBUG)}
stt := getTimeMicro()-stt;
- e_WriteLog(Format('*** new trace time: %u microseconds', [LongWord(stt)]), MSG_NOTIFY);
+ e_WriteLog(Format('*** new trace time: %u microseconds', [LongWord(stt)]), TMsgType.Notify);
{$ENDIF}
end;
if (Shots[i].ShotType = WEAPON_BARON_FIRE) or
(Shots[i].ShotType = WEAPON_MANCUB_FIRE) or
(Shots[i].ShotType = WEAPON_SKEL_FIRE) then
- Animation.DrawEx(Obj.X, Obj.Y, M_NONE, p, a)
+ Animation.DrawEx(Obj.X, Obj.Y, TMirrorType.None, p, a)
else
- Animation.Draw(Obj.X, Obj.Y, M_NONE);
+ Animation.Draw(Obj.X, Obj.Y, TMirrorType.None);
end
else if TextureID <> 0 then
begin
if (Shots[i].ShotType = WEAPON_ROCKETLAUNCHER) then
- e_DrawAdv(TextureID, Obj.X, Obj.Y, 0, True, False, a, @p, M_NONE)
+ e_DrawAdv(TextureID, Obj.X, Obj.Y, 0, True, False, a, @p, TMirrorType.None)
else if (Shots[i].ShotType <> WEAPON_FLAMETHROWER) then
e_Draw(TextureID, Obj.X, Obj.Y, 0, True, False);
end;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 7e10326fcac23295aea2842cebc0d9a0e21a8f09..97d359ea088d269019be92376800c7401dbc6557 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
Result := False;
- e_WriteLog('Setting display mode...', MSG_NOTIFY);
+ e_WriteLog('Setting display mode...', TMsgType.Notify);
wFlags := SDL_WINDOW_OPENGL or SDL_WINDOW_RESIZABLE;
if gFullscreen then wFlags := wFlags or SDL_WINDOW_FULLSCREEN;
pw := mode.w; ph := mode.h
end;
- e_WriteLog('SDL: Got ' + IntToStr(k) + ' resolutions.', MSG_NOTIFY);
+ e_WriteLog('SDL: Got ' + IntToStr(k) + ' resolutions.', TMsgType.Notify);
end;
procedure Sleep(ms: LongWord);
if g_debug_WinMsgs then
begin
g_Console_Add('Now minimized');
- e_WriteLog('[DEBUG] WinMsgs: Now minimized', MSG_NOTIFY);
+ e_WriteLog('[DEBUG] WinMsgs: Now minimized', TMsgType.Notify);
end;
wDeactivate := True;
end;
if g_debug_WinMsgs then
begin
g_Console_Add('Resized to ' + IntToStr(ev.data1) + 'x' + IntToStr(ev.data2));
- e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev.data1) + 'x' + IntToStr(ev.data2), MSG_NOTIFY);
+ e_WriteLog('[DEBUG] WinMsgs: Resized to ' + IntToStr(ev.data1) + 'x' + IntToStr(ev.data2), TMsgType.Notify);
end;
end;
if g_debug_WinMsgs then
begin
g_Console_Add('Now maximized');
- e_WriteLog('[DEBUG] WinMsgs: Now maximized', MSG_NOTIFY);
+ e_WriteLog('[DEBUG] WinMsgs: Now maximized', TMsgType.Notify);
end;
end;
end;
if g_debug_WinMsgs then
begin
g_Console_Add('Now restored');
- e_WriteLog('[DEBUG] WinMsgs: Now restored', MSG_NOTIFY);
+ e_WriteLog('[DEBUG] WinMsgs: Now restored', TMsgType.Notify);
end;
end;
begin
if gWinActive then
begin
- e_WriteLog('deactivating window', MSG_NOTIFY);
+ e_WriteLog('deactivating window', TMsgType.Notify);
e_EnableInput := False;
e_ClearInputBuffer();
if g_debug_WinMsgs then
begin
g_Console_Add('Now inactive');
- e_WriteLog('[DEBUG] WinMsgs: Now inactive', MSG_NOTIFY);
+ e_WriteLog('[DEBUG] WinMsgs: Now inactive', TMsgType.Notify);
end;
gWinActive := False;
if g_debug_WinMsgs then
begin
g_Console_Add('Now active');
- e_WriteLog('[DEBUG] WinMsgs: Now active', MSG_NOTIFY);
+ e_WriteLog('[DEBUG] WinMsgs: Now active', TMsgType.Notify);
end;
gWinActive := True;
gWinSizeY := gScreenHeight;
wTitle := Title;
- e_WriteLog('Creating window', MSG_NOTIFY);
+ e_WriteLog('Creating window', TMsgType.Notify);
if not g_Window_SetDisplay() then
begin
KillGLWindow();
- e_WriteLog('Window creation error (resolution not supported?)', MSG_FATALERROR);
+ e_WriteLog('Window creation error (resolution not supported?)', TMsgType.Fatal);
exit;
end;
while (exts[i] <> #0) and (exts[i] <> ' ') do Inc(i);
if i > 255 then
begin
- e_WriteLog('FUUUUUUUUUUUUU', MSG_WARNING);
+ e_WriteLog('FUUUUUUUUUUUUU', TMsgType.Warning);
end
else
begin
Move(exts^, extName[1], i);
extName[0] := Char(i);
- e_WriteLog(Format('EXT: %s', [extName]), MSG_NOTIFY);
+ e_WriteLog(Format('EXT: %s', [extName]), TMsgType.Notify);
end;
end;
found := true;
end;
end;
- e_WriteLog('Initializing OpenGL', MSG_NOTIFY);
+ e_WriteLog('Initializing OpenGL', TMsgType.Notify);
InitOpenGL(gVSync);
- e_WriteLog('Creating GL window', MSG_NOTIFY);
+ e_WriteLog('Creating GL window', TMsgType.Notify);
if not CreateGLWindow(PChar(Format('Doom 2D: Forever %s', [GAME_VERSION]))) then
begin
Result := 0;
if gwin_k8_enable_light_experiments then
begin
SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, @ltmp);
- e_WriteLog(Format('stencil buffer size: %d', [ltmp]), MSG_WARNING);
+ e_WriteLog(Format('stencil buffer size: %d', [ltmp]), TMsgType.Warning);
gwin_has_stencil := (ltmp > 0);
end
else
if not glHasExtension('GL_ARB_texture_non_power_of_two') then
begin
- e_WriteLog('Driver DID''T advertised NPOT textures support', MSG_WARNING);
+ e_WriteLog('Driver DID''T advertised NPOT textures support', TMsgType.Warning);
glLegacyNPOT := true;
end
else
begin
- e_WriteLog('Driver advertised NPOT textures support', MSG_NOTIFY);
+ e_WriteLog('Driver advertised NPOT textures support', TMsgType.Notify);
glLegacyNPOT := false;
end;
gwin_dump_extensions := false;
if (not gGameOn) and gAskLanguage then
g_Menu_AskLanguage();
- e_WriteLog('Entering the main loop', MSG_NOTIFY);
+ e_WriteLog('Entering the main loop', TMsgType.Notify);
while not ProcessMessage() do
{ Main Loop } ;
diff --git a/src/sfs/sfs.pas b/src/sfs/sfs.pas
index 5621f503bf0054fd7b72b799bf98b7f8875b29fb..30d82bc77788c6b0047854716e09307f9c222fa8 100644 (file)
--- a/src/sfs/sfs.pas
+++ b/src/sfs/sfs.pas
*)
// streaming file system (virtual)
{$INCLUDE ../shared/a_modes.inc}
+{$SCOPEDENUMS OFF}
{.$R+}
{.$DEFINE SFS_VOLDEBUG}
unit sfs;
diff --git a/src/sfs/sfsPlainFS.pas b/src/sfs/sfsPlainFS.pas
index e116d933e2fd8ebab29d3429c5113cc44a531eff..3f31e97c7262187eb5b0c92183ce1e42eff801a0 100644 (file)
--- a/src/sfs/sfsPlainFS.pas
+++ b/src/sfs/sfsPlainFS.pas
// SiN .SIN (SPAK)
//
{$INCLUDE ../shared/a_modes.inc}
+{$SCOPEDENUMS OFF}
{.$R+}
unit sfsPlainFS;
diff --git a/src/sfs/sfsZipFS.pas b/src/sfs/sfsZipFS.pas
index ae17ba10a8b55970fac0febf3c0a62fd862ef417..73263e73d5f7aa5ed563109060a9075760e11afc 100644 (file)
--- a/src/sfs/sfsZipFS.pas
+++ b/src/sfs/sfsZipFS.pas
//
{.$DEFINE SFS_DEBUG_ZIPFS}
{$INCLUDE ../shared/a_modes.inc}
+{$SCOPEDENUMS OFF}
{.$R+}
unit sfsZipFS;
diff --git a/src/shared/MAPDEF.pas b/src/shared/MAPDEF.pas
index 4d2859dd475caea7eed23cd2638cf56a605eae4f..fb44d73e1d76ee678f05fa67e0456de4ebd53fb9 100644 (file)
--- a/src/shared/MAPDEF.pas
+++ b/src/shared/MAPDEF.pas
begin
fld := field[aname];
if (fld = nil) then raise Exception.Create(Format('field ''%s'' not found in record ''%s'' of type ''%s''', [aname, typeName, id]));
- if (fld.baseType <> TPoint) then raise Exception.Create(Format('field ''%s'' in record ''%s'' of type ''%s'' has invalid data type', [aname, typeName, id]));
+ if (fld.baseType <> fld.TType.TPoint) then raise Exception.Create(Format('field ''%s'' in record ''%s'' of type ''%s'' has invalid data type', [aname, typeName, id]));
result := TDFPoint.Create(fld.ival, fld.ival2);
end;
begin
fld := field[aname];
if (fld = nil) then raise Exception.Create(Format('field ''%s'' not found in record ''%s'' of type ''%s''', [aname, typeName, id]));
- if (fld.baseType <> TSize) and (fld.baseType <> TPoint) then raise Exception.Create(Format('field ''%s'' in record ''%s'' of type ''%s'' has invalid data type', [aname, typeName, id]));
+ if (fld.baseType <> fld.TType.TSize) and (fld.baseType <> fld.TType.TPoint) then raise Exception.Create(Format('field ''%s'' in record ''%s'' of type ''%s'' has invalid data type', [aname, typeName, id]));
result := TDFSize.Create(fld.ival, fld.ival2);
end;
diff --git a/src/shared/a_modes.inc b/src/shared/a_modes.inc
index 9a17a826784a4ad9ce948730fff2bf6b1eed5f67..d4b1795a94b9a9ff77afa0a26e984afbe0bed9ab 100644 (file)
--- a/src/shared/a_modes.inc
+++ b/src/shared/a_modes.inc
{$POINTERMATH ON}
{$RANGECHECKS OFF}
{$SAFEFPUEXCEPTIONS OFF}
-{$SCOPEDENUMS OFF} // this may be changed later
+{$SCOPEDENUMS ON} // this may be changed later
{$SMARTLINK ON}
{$TYPEDADDRESS ON}
{$TYPEINFO ON}
index 3f13946bcb1dea1532c6805ad57af2ae4854449a..b83102bf611814015126b787f8cc968608541120 100644 (file)
--- a/src/shared/wadreader.pas
+++ b/src/shared/wadreader.pas
if fs = nil then
begin
if wantMap then continue;
- if logError then e_WriteLog(Format('DFWAD: can''t open file [%s] in [%s]', [name, fFileName]), MSG_WARNING);
+ if logError then e_WriteLog(Format('DFWAD: can''t open file [%s] in [%s]', [name, fFileName]), TMsgType.Warning);
break;
end;
// if we want only maps, check if this is map
result := true;
{$IFDEF SFS_DFWAD_DEBUG}
if wadoptDebug then
- e_WriteLog(Format('DFWAD: file [%s] FOUND in [%s]; size is %d bytes', [name, fFileName, Len]), MSG_NOTIFY);
+ e_WriteLog(Format('DFWAD: file [%s] FOUND in [%s]; size is %d bytes', [name, fFileName, Len]), TMsgType.Notify);
{$ENDIF}
exit;
end;
end;
- if logError then e_WriteLog(Format('DFWAD: file [%s] not found in [%s]', [name, fFileName]), MSG_WARNING);
+ if logError then e_WriteLog(Format('DFWAD: file [%s] not found in [%s]', [name, fFileName]), TMsgType.Warning);
end;
function TWADFile.GetResource (name: AnsiString; var pData: Pointer; var Len: Integer; logError: Boolean=true): Boolean;
rfn := findDiskWad(FileName);
if length(rfn) = 0 then
begin
- e_WriteLog(Format('TWADFile.ReadFile: error looking for [%s]', [FileName]), MSG_NOTIFY);
+ e_WriteLog(Format('TWADFile.ReadFile: error looking for [%s]', [FileName]), TMsgType.Notify);
exit;
end;
{$IFDEF SFS_DFWAD_DEBUG}
- if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: FOUND [%s]', [rfn]), MSG_NOTIFY);
+ if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: FOUND [%s]', [rfn]), TMsgType.Notify);
{$ENDIF}
// cache this wad
try
if fIter = nil then Exit;
fFileName := rfn;
{$IFDEF SFS_DFWAD_DEBUG}
- if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: [%s] opened', [fFileName]), MSG_NOTIFY);
+ if wadoptDebug then e_WriteLog(Format('TWADFile.ReadFile: [%s] opened', [fFileName]), TMsgType.Notify);
{$ENDIF}
Result := True;
end;
FreeWAD();
if (Data = nil) or (Len = 0) then
begin
- e_WriteLog('TWADFile.ReadMemory: EMPTY SUBWAD!', MSG_WARNING);
+ e_WriteLog('TWADFile.ReadMemory: EMPTY SUBWAD!', TMsgType.Warning);
Exit;
end;
fn := Format(' -- memwad %d -- ', [uniqueCounter]);
Inc(uniqueCounter);
{$IFDEF SFS_DFWAD_DEBUG}
- if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s]', [fn]), MSG_NOTIFY);
+ if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s]', [fn]), TMsgType.Notify);
{$ENDIF}
try
fFileName := fn;
{$IFDEF SFS_DFWAD_DEBUG}
- if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s] opened', [fFileName]), MSG_NOTIFY);
+ if wadoptDebug then e_WriteLog(Format('TWADFile.ReadMemory: [%s] opened', [fFileName]), TMsgType.Notify);
{$ENDIF}
{
diff --git a/src/shared/xdynrec.pas b/src/shared/xdynrec.pas
index 37c37aa1cf00f19b57c4912c4e72a9a56e005c53..8b6534ccd2ae0217091932b710e9d6a53d77877f 100644 (file)
--- a/src/shared/xdynrec.pas
+++ b/src/shared/xdynrec.pas
rt := findRecordByTypeId(fld.mEBSTypeName, fld.mRecRefId);
if (rt = nil) then
begin
- e_LogWritefln('record of type ''%s'' with id ''%s'' links to inexistant record of type ''%s'' with id ''%s''', [rec.mTypeName, rec.mId, fld.mEBSTypeName, fld.mRecRefId], MSG_WARNING);
+ e_LogWritefln('record of type ''%s'' with id ''%s'' links to inexistant record of type ''%s'' with id ''%s''', [rec.mTypeName, rec.mId, fld.mEBSTypeName, fld.mRecRefId], TMsgType.Warning);
//raise TDynRecException.CreateFmt('record of type ''%s'' with id ''%s'' links to inexistant record of type ''%s'' with id ''%s''', [rec.mName, rec.mId, fld.mEBSTypeName, fld.mRecRefId]);
end;
//writeln(' ', rec.mName, '.', rec.mId, ':', fld.mName, ' -> ', rt.mName, '.', rt.mId, ' (', fld.mEBSTypeName, '.', fld.mRecRefId, ')');