mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Removed unnecessary code
Added some function/variable defines.
This commit is contained in:
+22
-3
@@ -393,7 +393,7 @@ static void MoveDebugString(char* messageAddr) {
|
||||
messageAddr[i + 1] = '\n';
|
||||
}
|
||||
|
||||
static const DWORD addrSpaceChar[] = {
|
||||
static const DWORD addrDotChar[] = {
|
||||
0x50B244, 0x50B27C, 0x50B2B6, 0x50B2EE // "ERROR: attempt to reference * var out of range: %d"
|
||||
};
|
||||
|
||||
@@ -444,7 +444,7 @@ static void DebugModePatch() {
|
||||
|
||||
// Fix the format of some debug messages
|
||||
SafeWriteBatch<BYTE>('\n', addrNewLineChar);
|
||||
//SafeWriteBatch<BYTE>(' ', addrSpaceChar);
|
||||
SafeWriteBatch<BYTE>('.', addrDotChar);
|
||||
const DWORD mapVarErrorAddr[] = {
|
||||
0x482240, // map_set_global_var_
|
||||
0x482274, // map_get_global_var_
|
||||
@@ -466,7 +466,26 @@ static void DontDeleteProtosPatch() {
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void CheckTimerResolution() {
|
||||
DWORD ticksList[50];
|
||||
DWORD old_ticks = GetTickCount();
|
||||
for (size_t i = 0; i < 50;) {
|
||||
DWORD ticks = GetTickCount();
|
||||
if (ticks != old_ticks) {
|
||||
old_ticks = ticks;
|
||||
ticksList[i++] = ticks;
|
||||
}
|
||||
}
|
||||
int min = 100, max = 0;
|
||||
for (size_t i = 0; i < 49; i++) {
|
||||
int ms = ticksList[i + 1] - ticksList[i];
|
||||
if (ms < min) min = ms;
|
||||
if (ms > max) max = ms;
|
||||
}
|
||||
fo_debug_printf("System timer resolution: %d - %d ms.\n", min, max);
|
||||
}
|
||||
*/
|
||||
void DebugEditor_Init() {
|
||||
DebugModePatch();
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#define FO_VAR_art_name 0x56C9E4
|
||||
#define FO_VAR_art_vault_guy_num 0x5108A4
|
||||
#define FO_VAR_art_vault_person_nums 0x5108A8
|
||||
#define FO_VAR_artCritterFidShouldRunData 0x56CAF0
|
||||
#define FO_VAR_background_volume 0x518E88
|
||||
#define FO_VAR_bboxslot 0x5970E0
|
||||
#define FO_VAR_bckgnd 0x5707A4
|
||||
|
||||
@@ -81,6 +81,8 @@ FUNC(block_for_tocks_, 0x4C93B8)
|
||||
FUNC(buf_to_buf_, 0x4D36D4)
|
||||
FUNC(caiHasWeapPrefType_, 0x42938C)
|
||||
FUNC(cai_attempt_w_reload_, 0x42AECC)
|
||||
FUNC(cai_retargetTileFromFriendlyFireSubFunc_, 0x42A410)
|
||||
FUNC(cai_retargetTileFromFriendlyFire_, 0x42A1D4)
|
||||
FUNC(can_see_, 0x412BEC)
|
||||
FUNC(check_death_, 0x410814)
|
||||
FUNC(check_for_death_, 0x424EE8)
|
||||
|
||||
@@ -31,6 +31,7 @@ WRAP_WATCOM_FFUNC3(FrmFrameData*, frame_ptr, FrmHeaderData*, frm, long, frame, l
|
||||
WRAP_WATCOM_FFUNC3(void, GNW_win_refresh, WINinfo*, win, BoundRect*, rect, long*, buffer)
|
||||
WRAP_WATCOM_FFUNC3(void, intface_update_items, long, animate, long, modeLeft, long, modeRight)
|
||||
WRAP_WATCOM_FFUNC3(TGameObj*, inven_find_type, TGameObj*, critter, long, itemType, DWORD*, buf)
|
||||
WRAP_WATCOM_FFUNC3(long, inven_wield, TGameObj*, critter, TGameObj*, item, long, slot)
|
||||
WRAP_WATCOM_FFUNC3(long, item_add_force, TGameObj*, critter, TGameObj*, item, long, count)
|
||||
WRAP_WATCOM_FFUNC3(long, item_w_mp_cost, TGameObj*, source, long, hitMode, long, isCalled)
|
||||
WRAP_WATCOM_FFUNC7(void, make_straight_path_func, TGameObj*, objFrom, DWORD, tileFrom, DWORD, tileTo, void*, rotationPtr, DWORD*, result, long, flags, void*, func)
|
||||
@@ -40,6 +41,7 @@ WRAP_WATCOM_FFUNC4(long, mouse_in, long, x, long, y, long, x_offs, long, y_offs)
|
||||
WRAP_WATCOM_FFUNC3(TGameObj*, obj_blocking_at, TGameObj*, object, long, tile, long, elevation)
|
||||
WRAP_WATCOM_FFUNC3(long, obj_new_sid_inst, TGameObj*, object, long, sType, long, scriptIndex)
|
||||
WRAP_WATCOM_FFUNC3(TGameObj*, object_under_mouse, long, crSwitch, long, inclDude, long, elevation)
|
||||
WRAP_WATCOM_FFUNC4(void, qsort, void*, base, long, number, long, elSize, DWORD, comp)
|
||||
WRAP_WATCOM_FFUNC4(long, queue_add, long, time, TGameObj*, object, void*, data, long, qType)
|
||||
WRAP_WATCOM_FFUNC4(void, register_object_call, long*, target, long*, source, void*, func, long, delay)
|
||||
WRAP_WATCOM_FFUNC3(long, scr_get_local_var, long, sid, long, varId, long*, value)
|
||||
@@ -71,6 +73,7 @@ WRAP_WATCOM_FUNC1(long, critter_body_type, TGameObj*, critter)
|
||||
WRAP_WATCOM_FUNC1(long, critter_is_dead, TGameObj*, critter)
|
||||
WRAP_WATCOM_FUNC1(const char*, critter_name, TGameObj*, critter) // Returns the name of the critter
|
||||
WRAP_WATCOM_FUNC1(void, critter_pc_set_name, const char*, newName) // Change the name of playable character
|
||||
WRAP_WATCOM_FUNC1(long, critterIsOverloaded, TGameObj*, critter)
|
||||
/* Database functions */
|
||||
WRAP_WATCOM_FUNC1(bool, db_access, const char*, fileName) // Checks if given file exists in DB
|
||||
WRAP_WATCOM_FUNC1(long, db_fclose, DbFile*, file)
|
||||
|
||||
+8
-13
@@ -107,23 +107,20 @@ end:
|
||||
|
||||
static void WorldMapFPS() {
|
||||
DWORD prevTicks = worldMapTicks; // previous ticks
|
||||
while (true) {
|
||||
do {
|
||||
RunGlobalScripts3();
|
||||
if (worldMapLongDelay) {
|
||||
__asm call process_bk_;
|
||||
}
|
||||
|
||||
DWORD tick; // current ticks
|
||||
while (true) {
|
||||
do {
|
||||
tick = SpeedPatch_getTickCount();
|
||||
// get elapsed time
|
||||
if ((tick - prevTicks) >= 10) break; // delay 10 ms (GetTickCount returns a difference of 14-16 ms)
|
||||
}
|
||||
} while (tick == prevTicks); // delay ~15 ms
|
||||
prevTicks = tick;
|
||||
|
||||
// get elapsed time
|
||||
if ((tick - worldMapTicks) >= worldMapDelay) break;
|
||||
}
|
||||
} while ((prevTicks - worldMapTicks) < worldMapDelay);
|
||||
worldMapTicks = prevTicks;
|
||||
}
|
||||
|
||||
@@ -149,12 +146,10 @@ static void __declspec(naked) wmWorldMap_hook_patch2() {
|
||||
static void __declspec(naked) wmWorldMap_hook() {
|
||||
__asm {
|
||||
call ds:[getTickCountOffs]; // current ticks
|
||||
mov edx, eax;
|
||||
sub eax, worldMapTicks; // get elapsed time (cur.ticks - prev.ticks)
|
||||
cmp eax, 10; // delay 10 ms (GetTickCount returns a difference of 14-16 ms)
|
||||
jb skipHook;
|
||||
mov worldMapTicks, edx;
|
||||
call RunGlobalScripts3; // scripts are run every ~15 ms (not more often than 10 ms)
|
||||
cmp eax, worldMapTicks;
|
||||
je skipHook;
|
||||
mov worldMapTicks, eax;
|
||||
call RunGlobalScripts3; // scripts are run every ~15 ms (GetTickCount returns a difference of 14-16 ms)
|
||||
skipHook:
|
||||
jmp get_input_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user