From d7d166dc3cd287276202e862746208892c4cc89f Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sun, 17 Sep 2017 06:01:36 +0300 Subject: [PATCH] turned on "SCOPEDENUMS" fpc option --- src/engine/e_graphics.pas | 42 ++++----- src/engine/e_input.pas | 4 +- src/engine/e_log.pas | 28 +++--- src/engine/e_sound_fmod.inc | 74 ++++++++-------- src/engine/e_texture.pas | 14 +-- src/game/Doom2DF.dpr | 2 +- src/game/g_basic.pas | 4 +- src/game/g_game.pas | 44 +++++----- src/game/g_gfx.pas | 2 +- src/game/g_grid.pas | 4 +- src/game/g_gui.pas | 22 ++--- src/game/g_holmes.pas | 14 +-- src/game/g_items.pas | 6 +- src/game/g_language.pas | 3 +- src/game/g_main.pas | 26 +++--- src/game/g_map.pas | 78 ++++++++--------- src/game/g_menu.pas | 10 ++- src/game/g_monsters.pas | 128 +++++++++++++--------------- src/game/g_net.pas | 8 +- src/game/g_netmaster.pas | 4 +- src/game/g_netmsg.pas | 40 ++++----- src/game/g_options.pas | 18 ++-- src/game/g_panel.pas | 10 +-- src/game/g_player.pas | 150 ++++++++++++++++---------------- src/game/g_playermodel.pas | 156 +++++++++++++++++----------------- src/game/g_res_downloader.pas | 4 +- src/game/g_saveload.pas | 12 +-- src/game/g_sound.pas | 14 +-- src/game/g_textures.pas | 22 ++--- src/game/g_triggers.pas | 2 +- src/game/g_weapons.pas | 16 ++-- src/game/g_window.pas | 38 ++++----- src/sfs/sfs.pas | 1 + src/sfs/sfsPlainFS.pas | 1 + src/sfs/sfsZipFS.pas | 1 + src/shared/MAPDEF.pas | 4 +- src/shared/a_modes.inc | 2 +- src/shared/wadreader.pas | 18 ++-- src/shared/xdynrec.pas | 2 +- 39 files changed, 514 insertions(+), 514 deletions(-) diff --git a/src/engine/e_graphics.pas b/src/engine/e_graphics.pas index 467994f..6362cd1 100644 --- a/src/engine/e_graphics.pas +++ b/src/engine/e_graphics.pas @@ -22,8 +22,8 @@ uses 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; @@ -60,13 +60,13 @@ procedure e_SetViewPort(X, Y, Width, Height: Word); 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); @@ -80,7 +80,7 @@ procedure e_DrawPoint(Size: Byte; X, Y: Integer; Red, Green, Blue: Byte); 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); @@ -286,7 +286,7 @@ var begin Result := False; - e_WriteLog('Loading texture from '+FileName, MSG_NOTIFY); + e_WriteLog('Loading texture from '+FileName, TMsgType.Notify); find_id := FindTexture(); @@ -476,8 +476,8 @@ begin 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 @@ -491,7 +491,7 @@ 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); @@ -551,7 +551,7 @@ begin 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 @@ -589,7 +589,7 @@ 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); @@ -867,7 +867,7 @@ end; 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; @@ -1009,21 +1009,21 @@ begin 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 @@ -1232,7 +1232,7 @@ function e_CharFont_Create(sp: ShortInt=0): DWORD; var i, id: DWORD; begin - e_WriteLog('Creating CharFont...', MSG_NOTIFY); + e_WriteLog('Creating CharFont...', TMsgType.Notify); id := DWORD(-1); @@ -1555,7 +1555,7 @@ var 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 072dccb..5cf17a7 100644 --- a/src/engine/e_input.pas +++ b/src/engine/e_input.pas @@ -161,7 +161,7 @@ begin 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 @@ -173,7 +173,7 @@ 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 ed4cfe5..4ba2156 100644 --- a/src/engine/e_log.pas +++ b/src/engine/e_log.pas @@ -25,7 +25,7 @@ uses type TWriteMode = (WM_NEWFILE, WM_OLDFILE); - TRecordCategory = (MSG_FATALERROR, MSG_WARNING, MSG_NOTIFY); + TMsgType = (Fatal, Warning, Notify); procedure e_InitLog (fFileName: String; fWriteMode: TWriteMode); @@ -33,15 +33,15 @@ procedure e_DeinitLog (); 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); @@ -68,13 +68,13 @@ begin 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; @@ -167,7 +167,7 @@ begin 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 @@ -179,8 +179,8 @@ 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; @@ -208,9 +208,9 @@ begin 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 @@ -232,7 +232,7 @@ begin 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); @@ -248,7 +248,7 @@ procedure e_WriteStackTrace (const msg: AnsiString); 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); diff --git a/src/engine/e_sound_fmod.inc b/src/engine/e_sound_fmod.inc index 5e1c811..bb12c81 100644 --- a/src/engine/e_sound_fmod.inc +++ b/src/engine/e_sound_fmod.inc @@ -133,19 +133,19 @@ end; 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; @@ -159,35 +159,35 @@ var 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; @@ -196,7 +196,7 @@ begin 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 @@ -205,8 +205,8 @@ begin 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'); @@ -218,7 +218,7 @@ begin 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; @@ -226,26 +226,26 @@ begin 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; @@ -296,7 +296,7 @@ var begin Result := False; - e_WriteLog('Loading sound '+FileName+'...', MSG_NOTIFY); + e_WriteLog('Loading sound '+FileName+'...', TMsgType.Notify); find_id := FindESound(); @@ -586,8 +586,8 @@ begin 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; @@ -702,16 +702,16 @@ begin 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; diff --git a/src/engine/e_texture.pas b/src/engine/e_texture.pas index 4db41dc..11cbf0d 100644 --- a/src/engine/e_texture.pas +++ b/src/engine/e_texture.pas @@ -108,7 +108,7 @@ begin 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); @@ -185,7 +185,7 @@ begin 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); @@ -234,7 +234,7 @@ begin 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 @@ -260,13 +260,13 @@ begin 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); @@ -321,7 +321,7 @@ begin end; if fs = nil then begin - e_WriteLog('Texture "'+filename+'" not found', MSG_WARNING); + e_WriteLog('Texture "'+filename+'" not found', TMsgType.Warning); exit; end; @@ -357,7 +357,7 @@ begin 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 980c54b..0202340 100644 --- a/src/game/Doom2DF.dpr +++ b/src/game/Doom2DF.dpr @@ -136,7 +136,7 @@ begin 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 530bf8e..e9412a3 100644 --- a/src/game/g_basic.pas +++ b/src/game/g_basic.pas @@ -454,8 +454,8 @@ function g_Look(a, b: PObj; d: TDirection): Boolean; 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 f4882b6..fd0daf2 100644 --- a/src/game/g_game.pas +++ b/src/game/g_game.pas @@ -1255,21 +1255,21 @@ begin 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); @@ -1443,16 +1443,16 @@ begin // 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; @@ -1965,7 +1965,7 @@ begin // Íóæíî ñìåíèòü ðàçðåøåíèå: 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; @@ -2046,7 +2046,7 @@ procedure g_Game_LoadData(); 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'); @@ -2122,7 +2122,7 @@ begin 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'); @@ -3539,7 +3539,7 @@ end; 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; @@ -3547,7 +3547,7 @@ 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(); @@ -3731,7 +3731,7 @@ var begin g_Game_Free(); - e_WriteLog('Starting singleplayer game...', MSG_NOTIFY); + e_WriteLog('Starting singleplayer game...', TMsgType.Notify); g_Game_ClearLoading(); @@ -3804,7 +3804,7 @@ var begin g_Game_Free(); - e_WriteLog('Starting custom game...', MSG_NOTIFY); + e_WriteLog('Starting custom game...', TMsgType.Notify); g_Game_ClearLoading(); @@ -3902,7 +3902,7 @@ procedure g_Game_StartServer(Map: String; GameMode: Byte; begin g_Game_Free(); - e_WriteLog('Starting net game (server)...', MSG_NOTIFY); + e_WriteLog('Starting net game (server)...', TMsgType.Notify); g_Game_ClearLoading(); @@ -4012,8 +4012,8 @@ begin 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(); @@ -4165,7 +4165,7 @@ begin 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(); @@ -7137,7 +7137,7 @@ begin 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; @@ -7176,12 +7176,12 @@ begin 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 @@ -7189,7 +7189,7 @@ begin 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 2e4dc87..9eb3c04 100644 --- a/src/game/g_gfx.pas +++ b/src/game/g_gfx.pas @@ -1660,7 +1660,7 @@ begin 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 0c9da2d..427482f 100644 --- a/src/game/g_grid.pas +++ b/src/game/g_grid.pas @@ -861,7 +861,7 @@ begin 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; @@ -891,7 +891,7 @@ begin 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 7367a82..79b46ad 100644 --- a/src/game/g_gui.pas +++ b/src/game/g_gui.pas @@ -83,7 +83,7 @@ type lParam: LongInt; end; - TFontType = (FONT_TEXTURE, FONT_CHAR); + TFontType = (Texture, Character); TFont = class(TPoolObject) private @@ -917,7 +917,7 @@ begin Self.Proc := aProc; ProcEx := nil; - FFont := TFont.Create(FontID, FONT_CHAR); + FFont := TFont.Create(FontID, TFontType.Character); FText := Text; end; @@ -986,7 +986,7 @@ 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; @@ -994,7 +994,7 @@ procedure TFont.GetTextSize(Text: string; var w, h: Word); 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); @@ -1217,7 +1217,7 @@ constructor TGUILabel.Create(Text: string; FontID: DWORD); begin inherited Create(); - FFont := TFont.Create(FontID, FONT_CHAR); + FFont := TFont.Create(FontID, TFontType.Character); FText := Text; FFixedLen := 0; @@ -2137,7 +2137,7 @@ begin FIndex := -1; - FFont := TFont.Create(FontID, FONT_CHAR); + FFont := TFont.Create(FontID, TFontType.Character); end; procedure TGUISwitch.Draw; @@ -2217,7 +2217,7 @@ constructor TGUIEdit.Create(FontID: DWORD); begin inherited Create(); - FFont := TFont.Create(FontID, FONT_CHAR); + FFont := TFont.Create(FontID, TFontType.Character); FMaxLength := 0; FWidth := 0; @@ -2339,7 +2339,7 @@ begin FKey := 0; FIsQuery := false; - FFont := TFont.Create(FontID, FONT_CHAR); + FFont := TFont.Create(FontID, TFontType.Character); end; procedure TGUIKeyRead.Draw; @@ -2462,7 +2462,7 @@ begin FIsQuery := False; FFontID := FontID; - FFont := TFont.Create(FontID, FONT_CHAR); + FFont := TFont.Create(FontID, TFontType.Character); FMaxKeyNameWdt := 0; for a := 0 to 255 do @@ -2935,7 +2935,7 @@ constructor TGUIListBox.Create(FontID: DWORD; Width, Height: Word); begin inherited Create(); - FFont := TFont.Create(FontID, FONT_CHAR); + FFont := TFont.Create(FontID, TFontType.Character); FWidth := Width; FHeight := Height; @@ -3322,7 +3322,7 @@ constructor TGUIMemo.Create(FontID: DWORD; Width, Height: Word); 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 88edf86..165b848 100644 --- a/src/game/g_holmes.pas +++ b/src/game/g_holmes.pas @@ -626,7 +626,7 @@ end; // ////////////////////////////////////////////////////////////////////////// // 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; @@ -1445,7 +1445,7 @@ procedure cbAtcurSelectMonster (); 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; @@ -1475,12 +1475,12 @@ procedure cbAtcurDumpMonsters (); 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 (); @@ -1497,9 +1497,9 @@ var 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 fd04006..2ddc858 100644 --- a/src/game/g_items.pas +++ b/src/game/g_items.pas @@ -217,7 +217,7 @@ end; 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'); @@ -276,7 +276,7 @@ end; 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'); @@ -647,7 +647,7 @@ begin 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 diff --git a/src/game/g_language.pas b/src/game/g_language.pas index 84a17f1..7b74c3b 100644 --- a/src/game/g_language.pas +++ b/src/game/g_language.pas @@ -14,6 +14,7 @@ * along with this program. If not, see . *) {$INCLUDE ../shared/a_modes.inc} +{$SCOPEDENUMS OFF} unit g_language; interface @@ -1855,7 +1856,7 @@ begin 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 feb5980..4e10356 100644 --- a/src/game/g_main.pas +++ b/src/game/g_main.pas @@ -58,9 +58,9 @@ begin 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} @@ -72,7 +72,7 @@ begin //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} @@ -97,7 +97,7 @@ begin SDL_StartTextInput(); {$ENDIF} - e_WriteLog('Entering SDLMain', MSG_NOTIFY); + e_WriteLog('Entering SDLMain', TMsgType.Notify); {$WARNINGS OFF} SDLMain(); @@ -107,7 +107,7 @@ begin SDL_StopTextInput(); {$ENDIF} - e_WriteLog('Releasing SDL', MSG_NOTIFY); + e_WriteLog('Releasing SDL', TMsgType.Notify); SDL_Quit(); end; @@ -128,21 +128,21 @@ begin 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] := ' '; @@ -150,15 +150,15 @@ end; 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 5d4f8d8..bd94957 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -970,7 +970,7 @@ begin 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); @@ -1030,7 +1030,7 @@ begin 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); @@ -1049,7 +1049,7 @@ begin 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; @@ -1061,7 +1061,7 @@ begin // íåò, ýòî ñóïåðìåí! 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; @@ -1069,7 +1069,7 @@ begin // ×èòàåì 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; @@ -1079,7 +1079,7 @@ begin 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; @@ -1096,7 +1096,7 @@ begin // ×èòàåì ðåñóðñ òåêñòóð (êàäðîâ) àíèì. òåêñòóðû â ïàìÿòü: 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; @@ -1124,7 +1124,7 @@ begin 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; @@ -1145,13 +1145,13 @@ begin 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; @@ -1195,7 +1195,7 @@ begin //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îçäàåì êàäðû àíèì. òåêñòóðû èç êàðòèíîê @@ -1216,7 +1216,7 @@ begin 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; @@ -1499,7 +1499,7 @@ var 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; @@ -1637,7 +1637,7 @@ begin 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(); @@ -1667,7 +1667,7 @@ begin 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(); @@ -1708,7 +1708,7 @@ begin 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 @@ -1727,7 +1727,7 @@ begin // Äîáàâëåíèå òåêñòóð â 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; @@ -1736,7 +1736,7 @@ begin 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 @@ -1770,11 +1770,11 @@ begin // Çàãðóçêà òðèããåðîâ 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 @@ -1784,7 +1784,7 @@ begin 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; @@ -1797,7 +1797,7 @@ begin // Ñîçäàíèå òàáëèöû òðèããåðîâ (ñîîòâåòñòâèå ïàíåëåé òðèããåðàì) 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); @@ -1825,7 +1825,7 @@ begin // Ñîçäàåì ïàíåëè 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; @@ -2011,7 +2011,7 @@ begin 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, òî ñîçäàåì òðèããåðû @@ -2045,31 +2045,31 @@ begin 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; @@ -2077,7 +2077,7 @@ begin // Åñëè íå 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; @@ -2089,7 +2089,7 @@ begin // Çàãðóçêà íåáà 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); @@ -2115,7 +2115,7 @@ begin 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); @@ -2179,7 +2179,7 @@ begin end; end; - e_WriteLog('Done loading map.', MSG_NOTIFY); + e_WriteLog('Done loading map.', TMsgType.Notify); Result := True; end; @@ -3014,7 +3014,7 @@ begin 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 @@ -3042,14 +3042,14 @@ 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; @@ -3091,7 +3091,7 @@ var // Ñîñòîÿíèå ôëàãà 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); @@ -3170,7 +3170,7 @@ var 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 90527a1..04f7331 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -974,7 +974,7 @@ end; 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'); @@ -1300,7 +1300,9 @@ var 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); @@ -3197,7 +3199,7 @@ procedure g_Menu_Free(); begin g_GUI_Destroy(); - e_WriteLog('Releasing menu data...', MSG_NOTIFY); + e_WriteLog('Releasing menu data...', TMsgType.Notify); MenuFreeData(); end; @@ -3211,7 +3213,7 @@ begin if ex then begin - e_WriteLog('Recreating menu...', MSG_NOTIFY); + e_WriteLog('Recreating menu...', TMsgType.Notify); CreateAllMenus(); diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index 2d6daf6..b7d217b 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -62,7 +62,7 @@ type 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; @@ -238,8 +238,8 @@ procedure g_Monsters_killedp (); 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; @@ -809,7 +809,7 @@ end; 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); @@ -1053,7 +1053,7 @@ end; 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'); @@ -1523,7 +1523,7 @@ begin // Òèï ìîíñòðà 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); @@ -1532,7 +1532,7 @@ end; // ////////////////////////////////////////////////////////////////////////// // -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 @@ -1542,7 +1542,7 @@ begin 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; @@ -1897,8 +1897,8 @@ begin 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 @@ -1923,15 +1923,15 @@ begin 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]); // Åñëè åñòü îòäåëüíàÿ ëåâàÿ àíèìàöèÿ - çàãðóæàåì: @@ -1943,7 +1943,7 @@ begin 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; @@ -1972,10 +1972,7 @@ begin 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; @@ -2138,8 +2135,8 @@ var 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(); @@ -2182,7 +2179,7 @@ begin 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! @@ -2203,22 +2200,22 @@ begin 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; @@ -2371,17 +2368,17 @@ begin 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; // Ýôôåêò òåëåïîðòà â òî÷êå íàçíà÷åíèÿ: @@ -2720,9 +2717,9 @@ begin // Ïîâîðà÷èâàåìñÿ â ñòîðîíó öåëè: 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 @@ -2737,9 +2734,9 @@ begin 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; @@ -2806,9 +2803,9 @@ begin 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; @@ -2886,7 +2883,7 @@ begin 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; @@ -2927,7 +2924,7 @@ begin 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; @@ -2962,7 +2959,7 @@ begin 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; @@ -2994,7 +2991,7 @@ begin 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; @@ -3084,7 +3081,7 @@ _end: 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); @@ -3094,7 +3091,7 @@ _end: 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); @@ -3104,7 +3101,7 @@ _end: 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); @@ -3183,7 +3180,7 @@ _end: 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; @@ -3209,7 +3206,7 @@ _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; @@ -3713,7 +3710,7 @@ begin 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; @@ -3751,7 +3748,7 @@ begin 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; @@ -3784,7 +3781,7 @@ begin 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; @@ -3815,7 +3812,7 @@ begin 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; @@ -3963,7 +3960,7 @@ _end: 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; @@ -4084,13 +4081,10 @@ 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; @@ -4426,7 +4420,7 @@ begin // 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); @@ -4474,15 +4468,15 @@ begin 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; @@ -4507,7 +4501,7 @@ begin 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); // Îñòàëîñü çäîðîâüÿ @@ -4561,16 +4555,16 @@ begin // Åñëè åñòü - çàãðóæàåì 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 78b8eea..85263e5 100644 --- a/src/game/g_net.pas +++ b/src/game/g_net.pas @@ -414,7 +414,7 @@ begin NetMode := NET_NONE; g_Net_Cleanup; - e_WriteLog('NET: Server stopped', MSG_NOTIFY); + e_WriteLog('NET: Server stopped', TMsgType.Notify); end; @@ -582,7 +582,7 @@ begin 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; @@ -636,7 +636,7 @@ begin 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); @@ -650,7 +650,7 @@ begin 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); diff --git a/src/game/g_netmaster.pas b/src/game/g_netmaster.pas index 27eefa4..9e96a45 100644 --- a/src/game/g_netmaster.pas +++ b/src/game/g_netmaster.pas @@ -125,7 +125,7 @@ begin 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(); @@ -376,7 +376,7 @@ begin 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 98ef654..86c7657 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -384,7 +384,7 @@ begin 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); @@ -777,7 +777,7 @@ begin 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 @@ -787,13 +787,13 @@ begin 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; @@ -802,7 +802,7 @@ begin 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; @@ -1007,7 +1007,7 @@ begin 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); @@ -1409,7 +1409,7 @@ begin 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 @@ -1418,7 +1418,7 @@ begin 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 @@ -1996,7 +1996,7 @@ begin 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; @@ -2214,7 +2214,7 @@ begin 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); @@ -2753,13 +2753,13 @@ begin // 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; @@ -2872,15 +2872,15 @@ var 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 @@ -3019,7 +3019,7 @@ var 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; @@ -3041,11 +3041,11 @@ var 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 13de0c4..37aac9d 100644 --- a/src/game/g_options.pas +++ b/src/game/g_options.pas @@ -261,11 +261,11 @@ var 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: @@ -537,7 +537,7 @@ var config: TConfig; i: Integer; begin - e_WriteLog('Writing config', MSG_NOTIFY); + e_WriteLog('Writing config', TMsgType.Notify); config := TConfig.CreateFile(FileName); @@ -726,7 +726,7 @@ procedure g_Options_Write_Language(FileName: String); 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); @@ -739,7 +739,7 @@ var 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); @@ -769,7 +769,7 @@ procedure g_Options_Write_Gameplay_Custom(FileName: String); var config: TConfig; begin - e_WriteLog('Writing custom gameplay config', MSG_NOTIFY); + e_WriteLog('Writing custom gameplay config', TMsgType.Notify); config := TConfig.CreateFile(FileName); @@ -793,7 +793,7 @@ procedure g_Options_Write_Gameplay_Net(FileName: String); var config: TConfig; begin - e_WriteLog('Writing network gameplay config', MSG_NOTIFY); + e_WriteLog('Writing network gameplay config', TMsgType.Notify); config := TConfig.CreateFile(FileName); @@ -817,7 +817,7 @@ procedure g_Options_Write_Net_Server(FileName: String); var config: TConfig; begin - e_WriteLog('Writing server config', MSG_NOTIFY); + e_WriteLog('Writing server config', TMsgType.Notify); config := TConfig.CreateFile(FileName); @@ -835,7 +835,7 @@ procedure g_Options_Write_Net_Client(FileName: String); 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 c5eec29..2ff9af5 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -340,7 +340,7 @@ begin // Åñëè íå ñïåöòåêñòóðà, òî çàäàåì ðàçìåðû: 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; @@ -429,14 +429,14 @@ begin 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 4b0bffc..14a2fdc 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -861,7 +861,7 @@ begin 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); // Æèçíè @@ -1800,10 +1800,10 @@ begin 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; @@ -1831,7 +1831,7 @@ begin 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; @@ -2258,7 +2258,7 @@ var 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; @@ -2302,10 +2302,10 @@ begin 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; @@ -2317,12 +2317,12 @@ begin 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; @@ -2343,7 +2343,7 @@ begin 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 @@ -2416,7 +2416,7 @@ var 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; @@ -2711,7 +2711,7 @@ begin 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; // Ïðè âçÿòèè çàùèòíîãî êîñòþìà ðèñóåòñÿ çåëåíîâàòûé ôîí @@ -2724,14 +2724,14 @@ begin 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; @@ -2796,7 +2796,7 @@ begin 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 @@ -4407,7 +4407,7 @@ begin FObj.Accel.Y := 0; FDirection := RespawnPoint.Direction; - if FDirection = D_LEFT then + if FDirection = TDirection.D_LEFT then FAngle := 180 else FAngle := 0; @@ -4523,7 +4523,7 @@ begin 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); @@ -4564,7 +4564,7 @@ procedure TPlayer.SeeDown(); 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; @@ -4573,7 +4573,7 @@ procedure TPlayer.SeeUp(); 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; @@ -4661,26 +4661,26 @@ begin 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; @@ -4744,7 +4744,7 @@ begin if FAlive and (gFly or FJetpack) then FlySmoke(); - if FDirection = D_LEFT then + if FDirection = TDirection.D_LEFT then FAngle := 180 else FAngle := 0; @@ -4775,9 +4775,9 @@ begin 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 @@ -4794,8 +4794,8 @@ begin 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(); @@ -4995,7 +4995,7 @@ begin 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); @@ -5664,7 +5664,7 @@ begin // Èçðàñõîäîâàë ëè âñå æèçíè 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)); @@ -5767,7 +5767,7 @@ begin 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); // Æèçíè @@ -6193,12 +6193,12 @@ begin 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; @@ -6585,16 +6585,16 @@ 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 // Åñëè ïîáèòû - óáåãàåì - 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; @@ -6613,17 +6613,17 @@ begin 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 @@ -6635,15 +6635,15 @@ begin // Åñëè ðàçíèöà âûñîò íå âåëèêà, òî äîãîíÿåì: 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; @@ -6663,7 +6663,7 @@ begin end; // Âûáèðàåì óãîë âíèç: - if FDirection = D_LEFT then + if FDirection = TDirection.D_LEFT then angle := ANGLE_LEFTDOWN else angle := ANGLE_RIGHTDOWN; @@ -6688,8 +6688,8 @@ begin (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', ''); @@ -6741,7 +6741,7 @@ begin SetAIFlag('NEEDJUMP', '1'); - if RunDirection() = D_RIGHT then + if RunDirection() = TDirection.D_RIGHT then begin // Èäåì íå â òó ñòîðîíó if (Healthy() > 1) and GetRnd(FDifficult.InvisFire) then begin // Åñëè çäîðîâû, òî, âîçìîæíî, ñòðåëÿåì áåæèì âëåâî è ñòðåëÿåì @@ -6764,7 +6764,7 @@ 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 // Åñëè çäîðîâû, òî, âîçìîæíî, áåæèì âïðàâî è ñòðåëÿåì @@ -6793,7 +6793,7 @@ 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; @@ -6812,7 +6812,7 @@ begin end; // Èùåì öåëü ñíèçó è ñòðåëÿåì, åñëè åñòü: - if FDirection = D_LEFT then + if FDirection = TDirection.D_LEFT then angle := ANGLE_LEFTDOWN else angle := ANGLE_RIGHTDOWN; @@ -6833,8 +6833,8 @@ begin // Åñëè öåëü "ïåðåä íîñîì", òî ñòðåëÿåì: 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; @@ -6985,7 +6985,7 @@ procedure TBot.UpdateMove; ReleaseKey(KEY_LEFT); ReleaseKey(KEY_RIGHT); PressKey(KEY_LEFT, Time); - SetDirection(D_LEFT); + SetDirection(TDirection.D_LEFT); end; procedure GoRight(Time: Word = 1); @@ -6993,7 +6993,7 @@ procedure TBot.UpdateMove; ReleaseKey(KEY_LEFT); ReleaseKey(KEY_RIGHT); PressKey(KEY_RIGHT, Time); - SetDirection(D_RIGHT); + SetDirection(TDirection.D_RIGHT); end; function Rnd(a: Word): Boolean; @@ -7003,7 +7003,7 @@ procedure TBot.UpdateMove; 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(); @@ -7024,7 +7024,7 @@ procedure TBot.UpdateMove; 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); @@ -7037,7 +7037,7 @@ procedure TBot.UpdateMove; 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 @@ -7055,7 +7055,7 @@ procedure TBot.UpdateMove; 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 @@ -7078,7 +7078,7 @@ procedure TBot.UpdateMove; 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 @@ -7124,18 +7124,18 @@ procedure TBot.UpdateMove; 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; @@ -7147,7 +7147,7 @@ procedure TBot.UpdateMove; var sx, y: Integer; begin - sx := IfThen(RunDirection() = D_LEFT, -1, 1); + sx := IfThen(RunDirection() = TDirection.D_LEFT, -1, 1); Result := False; @@ -7313,7 +7313,7 @@ begin // Åñëè íà çåìëå è ìîæíî ïîäïðûãíóòü, òî, âîçìîæíî, ïðûãàåì: 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(); @@ -7492,7 +7492,7 @@ function TBot.RunDirection(): TDirection; 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; diff --git a/src/game/g_playermodel.pas b/src/game/g_playermodel.pas index b8d0ec6..e4b485d 100644 --- a/src/game/g_playermodel.pas +++ b/src/game/g_playermodel.pas @@ -80,7 +80,7 @@ type 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 @@ -88,8 +88,8 @@ type 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; @@ -259,7 +259,7 @@ begin 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; @@ -306,7 +306,7 @@ begin 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 @@ -328,7 +328,7 @@ var 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; @@ -398,7 +398,7 @@ begin 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 @@ -479,69 +479,69 @@ begin 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; @@ -591,18 +591,18 @@ begin 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; @@ -732,7 +732,7 @@ begin 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; @@ -774,17 +774,17 @@ begin 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; @@ -794,10 +794,10 @@ var 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; @@ -810,29 +810,29 @@ var 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 @@ -855,38 +855,38 @@ begin 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; @@ -896,18 +896,18 @@ end; 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; @@ -974,7 +974,7 @@ procedure TPlayerModel.SetFire(Fire: 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; @@ -1003,11 +1003,11 @@ 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; diff --git a/src/game/g_res_downloader.pas b/src/game/g_res_downloader.pas index c24e6f8..25f6985 100644 --- a/src/game/g_res_downloader.pas +++ b/src/game/g_res_downloader.pas @@ -131,7 +131,7 @@ var 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); @@ -150,7 +150,7 @@ begin 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); diff --git a/src/game/g_saveload.pas b/src/game/g_saveload.pas index dee1992..ad438f8 100644 --- a/src/game/g_saveload.pas +++ b/src/game/g_saveload.pas @@ -125,7 +125,7 @@ begin 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; @@ -136,7 +136,7 @@ begin 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; @@ -278,7 +278,7 @@ begin 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; @@ -317,7 +317,7 @@ begin 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 @@ -504,8 +504,8 @@ begin 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 d7d97d2..2676b42 100644 --- a/src/game/g_sound.pas +++ b/src/game/g_sound.pas @@ -139,7 +139,7 @@ begin 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; @@ -157,7 +157,7 @@ begin 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; @@ -268,7 +268,7 @@ begin 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; @@ -327,9 +327,9 @@ begin 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; @@ -377,9 +377,9 @@ begin 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; diff --git a/src/game/g_textures.pas b/src/game/g_textures.pas index 07ef3be..6f239e4 100644 --- a/src/game/g_textures.pas +++ b/src/game/g_textures.pas @@ -186,7 +186,7 @@ begin 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(); @@ -197,7 +197,7 @@ begin 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; @@ -234,7 +234,7 @@ begin 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; @@ -265,7 +265,7 @@ begin 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; @@ -489,7 +489,7 @@ begin 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; @@ -685,15 +685,15 @@ procedure DumpTextureNames(); 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 } diff --git a/src/game/g_triggers.pas b/src/game/g_triggers.pas index 4aca319..664faf6 100644 --- a/src/game/g_triggers.pas +++ b/src/game/g_triggers.pas @@ -2409,7 +2409,7 @@ begin //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 182207f..311b18c 100644 --- a/src/game/g_weapons.pas +++ b/src/game/g_weapons.pas @@ -1094,7 +1094,7 @@ end; 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'); @@ -1160,7 +1160,7 @@ end; 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'); @@ -1497,7 +1497,7 @@ begin 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} @@ -1553,7 +1553,7 @@ begin 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); @@ -1562,7 +1562,7 @@ begin 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; @@ -2511,14 +2511,14 @@ begin 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 7e10326..97d359e 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -88,7 +88,7 @@ begin 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; @@ -157,7 +157,7 @@ begin 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); @@ -237,7 +237,7 @@ begin 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; @@ -254,7 +254,7 @@ begin 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; @@ -277,7 +277,7 @@ begin 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; @@ -297,7 +297,7 @@ begin 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; @@ -325,7 +325,7 @@ begin begin if gWinActive then begin - e_WriteLog('deactivating window', MSG_NOTIFY); + e_WriteLog('deactivating window', TMsgType.Notify); e_EnableInput := False; e_ClearInputBuffer(); @@ -338,7 +338,7 @@ begin 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; @@ -360,7 +360,7 @@ begin 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; @@ -530,12 +530,12 @@ begin 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; @@ -797,13 +797,13 @@ begin 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; @@ -883,10 +883,10 @@ begin 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; @@ -904,7 +904,7 @@ begin 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 @@ -914,12 +914,12 @@ begin 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; @@ -936,7 +936,7 @@ begin 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 5621f50..30d82bc 100644 --- a/src/sfs/sfs.pas +++ b/src/sfs/sfs.pas @@ -15,6 +15,7 @@ *) // 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 e116d93..3f31e97 100644 --- a/src/sfs/sfsPlainFS.pas +++ b/src/sfs/sfsPlainFS.pas @@ -18,6 +18,7 @@ // 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 ae17ba1..73263e7 100644 --- a/src/sfs/sfsZipFS.pas +++ b/src/sfs/sfsZipFS.pas @@ -19,6 +19,7 @@ // {.$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 4d2859d..fb44d73 100644 --- a/src/shared/MAPDEF.pas +++ b/src/shared/MAPDEF.pas @@ -287,7 +287,7 @@ var 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; @@ -298,7 +298,7 @@ var 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 9a17a82..d4b1795 100644 --- a/src/shared/a_modes.inc +++ b/src/shared/a_modes.inc @@ -46,7 +46,7 @@ {$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} diff --git a/src/shared/wadreader.pas b/src/shared/wadreader.pas index 3f13946..b83102b 100644 --- a/src/shared/wadreader.pas +++ b/src/shared/wadreader.pas @@ -362,7 +362,7 @@ begin 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 @@ -441,12 +441,12 @@ begin 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; @@ -506,11 +506,11 @@ begin 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 @@ -529,7 +529,7 @@ begin 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; @@ -549,14 +549,14 @@ begin 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 @@ -576,7 +576,7 @@ begin 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 37c37aa..8b6534c 100644 --- a/src/shared/xdynrec.pas +++ b/src/shared/xdynrec.pas @@ -2732,7 +2732,7 @@ var 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, ')'); -- 2.29.2