From: Ketmar Dark Date: Sun, 10 Sep 2017 12:36:16 +0000 (+0300) Subject: cosmetix: `curTime*` -> `getTime*` X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=66a94fecae8b7adff4a52946029944e3cb1870da;p=d2df-sdl.git cosmetix: `curTime*` -> `getTime*` --- diff --git a/src/game/Doom2DF.dpr b/src/game/Doom2DF.dpr index 806032d..97fdb66 100644 --- a/src/game/Doom2DF.dpr +++ b/src/game/Doom2DF.dpr @@ -40,6 +40,7 @@ program Doom2DF; uses conbuf in '../shared/conbuf.pas', + math, GL, GLExt, SDL2 in '../lib/sdl2/sdl2.pas', @@ -118,8 +119,9 @@ uses var f: Integer; noct: Boolean = false; - tfo: Text; + //tfo: Text; begin + SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); //k8: fuck off, that's why for f := 1 to ParamCount do begin if ParamStr(f) = '--gdb' then noct := true @@ -140,11 +142,13 @@ begin begin e_WriteStackTrace(e.message); //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_MSG], [E.Message]), MSG_FATALERROR); + (* AssignFile(tfo, GameDir+'/trace.log'); {$I-} Append(tfo); if (IOResult <> 0) then Rewrite(tfo); if (IOResult = 0) then begin writeln(tfo, '====================='); DumpExceptionBackTrace(tfo); CloseFile(tfo); end; + *) end else begin diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas index e75af88..2e4dc87 100644 --- a/src/game/g_gfx.pas +++ b/src/game/g_gfx.pas @@ -1186,14 +1186,14 @@ begin // tracer will return `false` if we started outside of the liquid {$IF DEFINED(D2F_DEBUG_BUBBLES)} - stt := curTimeMicro(); + stt := getTimeMicro(); ptr := mapGrid.traceOrthoRayWhileIn(liquidx, liquidTopY, x, y, x, 0, GridTagWater or GridTagAcid1 or GridTagAcid2); - stt := curTimeMicro()-stt; + stt := getTimeMicro()-stt; e_LogWritefln('traceOrthoRayWhileIn: time=%s (%s); liquidTopY=%s', [Integer(stt), ptr, liquidTopY]); // - stt := curTimeMicro(); + stt := getTimeMicro(); nptr := g_Map_TraceLiquidNonPrecise(x, y, 0, -8, liquidx, liquidTopY); - stt := curTimeMicro()-stt; + stt := getTimeMicro()-stt; e_LogWritefln('g_Map_TraceLiquidNonPrecise: time=%s (%s); liquidTopY=%s', [Integer(stt), nptr, liquidTopY]); if not nptr then continue; {$ELSE} diff --git a/src/game/g_map.pas b/src/game/g_map.pas index ac54bd5..bac475b 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -1672,7 +1672,7 @@ begin e_LogWritefln('Loading map: %s', [mapResName], MSG_NOTIFY); g_Game_SetLoadingText(_lc[I_LOAD_MAP], 0, False); - stt := curTimeMicro(); + stt := getTimeMicro(); try mapReader := g_Map_ParseMap(Data, Len); @@ -2159,7 +2159,7 @@ begin gMusic.SetByName(''); end; - stt := curTimeMicro()-stt; + stt := getTimeMicro()-stt; e_LogWritefln('map loaded in %s.%s milliseconds', [Integer(stt div 1000), Integer(stt mod 1000)]); mapOk := true; finally diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas index 5ba00a7..4a22a3b 100644 --- a/src/game/g_weapons.pas +++ b/src/game/g_weapons.pas @@ -1321,7 +1321,7 @@ begin //vy := (dy*10 div d)*yi; {$IF DEFINED(D2F_DEBUG)} - stt := curTimeMicro(); + stt := getTimeMicro(); {$ENDIF} xx := x; @@ -1352,7 +1352,7 @@ begin begin _collide := True; {$IF DEFINED(D2F_DEBUG)} - stt := curTimeMicro()-stt; + stt := getTimeMicro()-stt; e_WriteLog(Format('*** old trace time: %u microseconds', [LongWord(stt)]), MSG_NOTIFY); showTime := false; {$ENDIF} @@ -1372,7 +1372,7 @@ begin {$IF DEFINED(D2F_DEBUG)} if showTime then begin - stt := curTimeMicro()-stt; + stt := getTimeMicro()-stt; e_WriteLog(Format('*** old trace time: %u microseconds', [LongWord(stt)]), MSG_NOTIFY); end; {$ENDIF} @@ -1511,7 +1511,7 @@ begin {$IF DEFINED(D2F_DEBUG)} e_WriteLog(Format('GUN TRACE: (%d,%d) to (%d,%d)', [x, y, x2, y2]), MSG_NOTIFY); - stt := curTimeMicro(); + stt := getTimeMicro(); {$ENDIF} wallHitFlag := (g_Map_traceToNearestWall(x, y, x2, y2, @wallHitX, @wallHitY) <> nil); @@ -1565,7 +1565,7 @@ begin if wallHitFlag then begin {$IF DEFINED(D2F_DEBUG)} - stt := curTimeMicro()-stt; + stt := getTimeMicro()-stt; e_WriteLog(Format('*** new trace time: %u microseconds', [LongWord(stt)]), MSG_NOTIFY); {$ENDIF} g_GFX_Spark(wallHitX, wallHitY, 2+Random(2), 180+a, 0, 0); @@ -1574,7 +1574,7 @@ begin else begin {$IF DEFINED(D2F_DEBUG)} - stt := curTimeMicro()-stt; + stt := getTimeMicro()-stt; e_WriteLog(Format('*** new trace time: %u microseconds', [LongWord(stt)]), MSG_NOTIFY); {$ENDIF} end; diff --git a/src/game/g_window.pas b/src/game/g_window.pas index ec3f116..5f04992 100644 --- a/src/game/g_window.pas +++ b/src/game/g_window.pas @@ -631,11 +631,11 @@ begin begin if forceUpdate then begin - prevLoadingUpdateTime := curTimeMilli(); + prevLoadingUpdateTime := getTimeMilli(); end else begin - stt := curTimeMilli(); + stt := getTimeMilli(); if (stt < prevLoadingUpdateTime) or (stt-prevLoadingUpdateTime >= 400) then begin prevLoadingUpdateTime := stt; diff --git a/src/shared/xdynrec.pas b/src/shared/xdynrec.pas index c992997..4ac9db7 100644 --- a/src/shared/xdynrec.pas +++ b/src/shared/xdynrec.pas @@ -3099,7 +3099,7 @@ var begin if (mOwner = nil) then raise TDynParseException.CreateFmt(pr, 'can''t parse record ''%s'' value without owner', [mTypeName]); - {$IF DEFINED(D2D_DYNREC_PROFILER)}stall := curTimeMicro();{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}stall := getTimeMicro();{$ENDIF} // not a header? if not mHeader then @@ -3123,31 +3123,31 @@ begin if mHeader then begin // add records with this type (if any) - {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := curTimeMicro();{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := getTimeMicro();{$ENDIF} trc := mOwner.recType[pr.tokStr]; - {$IF DEFINED(D2D_DYNREC_PROFILER)}profFindRecType := curTimeMicro()-stt;{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}profFindRecType := getTimeMicro()-stt;{$ENDIF} if (trc <> nil) then begin - {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := curTimeMicro();{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := getTimeMicro();{$ENDIF} rec := trc.clone(mHeaderRec); - {$IF DEFINED(D2D_DYNREC_PROFILER)}profCloneRec := curTimeMicro()-stt;{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}profCloneRec := getTimeMicro()-stt;{$ENDIF} rec.mHeaderRec := mHeaderRec; // on error, it will be freed by memowner pr.skipToken(); rec.parseValue(pr); - {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := curTimeMicro();{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := getTimeMicro();{$ENDIF} addRecordByType(rec.mTypeName, rec); - {$IF DEFINED(D2D_DYNREC_PROFILER)}profAddRecByType := curTimeMicro()-stt;{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}profAddRecByType := getTimeMicro()-stt;{$ENDIF} continue; end; end; // fields - {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := curTimeMicro();{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := getTimeMicro();{$ENDIF} //writeln('0: <', mName, '.', pr.tokStr, '>'); fld := field[pr.tokStr]; //writeln('1: <', mName, '.', pr.tokStr, '>'); - {$IF DEFINED(D2D_DYNREC_PROFILER)}profFieldSearching := curTimeMicro()-stt;{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}profFieldSearching := getTimeMicro()-stt;{$ENDIF} if (fld <> nil) then begin //writeln('2: <', mName, '.', pr.tokStr, '>'); @@ -3155,9 +3155,9 @@ begin if fld.internal then raise TDynParseException.CreateFmt(pr, 'internal field ''%s'' in record ''%s''', [fld.mName, mTypeName]); pr.skipToken(); // skip field name //writeln('3: <', mName, '.', pr.tokStr, '>:', pr.tokType); - {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := curTimeMicro();{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := getTimeMicro();{$ENDIF} fld.parseValue(pr); - {$IF DEFINED(D2D_DYNREC_PROFILER)}profFieldValParsing := curTimeMicro()-stt;{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}profFieldValParsing := getTimeMicro()-stt;{$ENDIF} continue; end; @@ -3177,12 +3177,12 @@ begin end; // fix field defaults - {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := curTimeMicro();{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}stt := getTimeMicro();{$ENDIF} for fld in mFields do fld.fixDefaultValue(); - {$IF DEFINED(D2D_DYNREC_PROFILER)}profFixDefaults := curTimeMicro()-stt;{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}profFixDefaults := getTimeMicro()-stt;{$ENDIF} //writeln('done parsing record <', mName, '>'); - //{$IF DEFINED(D2D_DYNREC_PROFILER)}writeln('stall: ', curTimeMicro()-stall);{$ENDIF} - {$IF DEFINED(D2D_DYNREC_PROFILER)}profRecValParse := curTimeMicro()-stall;{$ENDIF} + //{$IF DEFINED(D2D_DYNREC_PROFILER)}writeln('stall: ', getTimeMicro()-stall);{$ENDIF} + {$IF DEFINED(D2D_DYNREC_PROFILER)}profRecValParse := getTimeMicro()-stall;{$ENDIF} end; diff --git a/src/shared/xprofiler.pas b/src/shared/xprofiler.pas index 6fb0035..f61b844 100644 --- a/src/shared/xprofiler.pas +++ b/src/shared/xprofiler.pas @@ -143,8 +143,8 @@ type end; -function curTimeMicro (): UInt64; inline; -function curTimeMilli (): UInt64; inline; +function getTimeMicro (): UInt64; inline; +function getTimeMilli (): UInt64; inline; implementation @@ -182,7 +182,7 @@ begin end; -function curTimeMicro (): UInt64; inline; +function getTimeMicro (): UInt64; inline; var r: THPTimeType; begin @@ -197,9 +197,9 @@ begin end; -function curTimeMilli (): UInt64; inline; +function getTimeMilli (): UInt64; inline; begin - result := curTimeMicro div 1000; + result := getTimeMicro div 1000; end; @@ -221,7 +221,7 @@ procedure TStopWatch.updateElapsed (); var e: UInt64; begin - e := curTimeMicro(); + e := getTimeMicro(); if (mStartPosition > e) then mStartPosition := e; Inc(mElapsed, e-mStartPosition); mStartPosition := e; @@ -253,7 +253,7 @@ end; procedure TStopWatch.start (reset: Boolean=true); begin if mRunning and not reset then exit; // nothing to do - mStartPosition := curTimeMicro(); + mStartPosition := getTimeMicro(); mRunning := true; if (reset) then mElapsed := 0; end;