From ec2029e0ba7e06374968e277205881ef867fbd72 Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Thu, 4 Apr 2019 14:44:37 -0500 Subject: [PATCH] Fix sync.cpp names p1 (#828) --- Source/msg.cpp | 2 +- Source/multi.cpp | 2 +- Source/sync.cpp | 58 ++++++++++++++++++++++++------------------------ Source/sync.h | 14 ++++++------ 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Source/msg.cpp b/Source/msg.cpp index bae22728f..da4c64f8e 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1304,7 +1304,7 @@ void __fastcall DeltaImportJunk(BYTE *src) int __fastcall On_SYNCDATA(void *packet, int pnum) { - return SyncData(pnum, (TSyncHeader *)packet); + return sync_update(pnum, (TSyncHeader *)packet); } int __fastcall On_WALKXY(TCmdLoc *pCmd, int pnum) diff --git a/Source/multi.cpp b/Source/multi.cpp index 4dead192c..5bd525d34 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -745,7 +745,7 @@ int __fastcall NetInit(int bSinglePlayer, int *pfExitProgram) buffer_init(&sgHiPriBuf); buffer_init(&sgLoPriBuf); dword_678628 = 0; - sync_clear_pkt(); + sync_init(); nthread_start(sgbPlayerTurnBitTbl[myplr]); dthread_start(); MI_Dummy(0); /* v5 */ diff --git a/Source/sync.cpp b/Source/sync.cpp index 6f029d81a..331d3fcd4 100644 --- a/Source/sync.cpp +++ b/Source/sync.cpp @@ -2,10 +2,10 @@ #include "../types.h" -short sync_word_6AA708[MAXMONSTERS]; -int syncmonsters; // weak -short sync_word_6AA89C[MAXMONSTERS]; -int syncitems; +WORD sync_word_6AA708[MAXMONSTERS]; +int sgnMonsters; // weak +WORD sgwLRU[MAXMONSTERS]; +int sgnSyncItem; int sgnSyncPInv; // weak int __fastcall sync_all_monsters(TSyncHeader *packet, int size) @@ -47,11 +47,11 @@ void __cdecl sync_one_monster() int i; // ebx int v1; // edi int v2; // esi - short v3; // bp - short v4; // ax + WORD v3; // bp + WORD v4; // ax BOOLEAN v5; // zf - short *v6; // edx - short *v7; // eax + WORD *v6; // edx + WORD *v7; // eax for (i = 0; i < nummonsters; ++i) { v1 = monstactive[i]; @@ -64,7 +64,7 @@ void __cdecl sync_one_monster() if (v5) { *v6 = v4 + v3 + 4096; } else { - v7 = &sync_word_6AA89C[v1]; + v7 = &sgwLRU[v1]; if (*v7) --*v7; } @@ -85,8 +85,8 @@ int __fastcall sync_monster_active(TSyncMonster *packet) return 0; do { v4 = monstactive[v2]; - if ((unsigned short)sync_word_6AA708[v4] < v1 && (unsigned short)sync_word_6AA89C[v4] < 0xFFFEu) { - v1 = (unsigned short)sync_word_6AA708[v4]; + if (sync_word_6AA708[v4] < v1 && sgwLRU[v4] < 0xFFFEu) { + v1 = sync_word_6AA708[v4]; v3 = monstactive[v2]; } ++v2; @@ -103,7 +103,7 @@ void __fastcall sync_monster_pos(TSyncMonster *packet, int mon_id) TSyncMonster *v3; // esi int v4; // edi int v5; // eax - short v6; // cx + WORD v6; // cx char v7; // cl v2 = mon_id; @@ -115,12 +115,12 @@ void __fastcall sync_monster_pos(TSyncMonster *packet, int mon_id) packet->_menemy = encode_enemy(mon_id); v5 = v2; v6 = sync_word_6AA708[v2]; - if ((unsigned short)v6 > 0xFFu) + if (v6 > 0xFFu) _LOBYTE(v6) = -1; v3->_mdelta = v6; v7 = monster[v4]._msquelch; sync_word_6AA708[v5] = -1; - sync_word_6AA89C[v5] = -(v7 != 0) - 1; + sgwLRU[v5] = -(v7 != 0) - 1; } int __fastcall sync_monster_active2(TSyncMonster *packet) @@ -135,26 +135,26 @@ int __fastcall sync_monster_active2(TSyncMonster *packet) v2 = 65534; if (nummonsters <= 0) return 0; - v3 = syncmonsters; + v3 = sgnMonsters; v6 = nummonsters; do { if (v3 >= nummonsters) v3 = 0; v4 = monstactive[v3]; - if ((unsigned short)sync_word_6AA89C[v4] < v2) { - v2 = (unsigned short)sync_word_6AA89C[v4]; + if (sgwLRU[v4] < v2) { + v2 = sgwLRU[v4]; v1 = monstactive[v3]; } ++v3; --v6; } while (v6); - syncmonsters = v3; + sgnMonsters = v3; if (v1 == -1) return 0; sync_monster_pos(packet, v1); return 1; } -// 6AA898: using guessed type int syncmonsters; +// 6AA898: using guessed type int sgnMonsters; void __fastcall SyncPlrInv(TSyncHeader *pSync) { @@ -168,11 +168,11 @@ void __fastcall SyncPlrInv(TSyncHeader *pSync) if (numitems <= 0) { pSync->bItemI = -1; } else { - v1 = syncitems; - if (syncitems >= numitems) + v1 = sgnSyncItem; + if (sgnSyncItem >= numitems) v1 = 0; v2 = itemactive[v1]; - syncitems = v1 + 1; + sgnSyncItem = v1 + 1; pSync->bItemI = v2; v3 = v2; pSync->bItemX = item[v3]._ix; @@ -219,7 +219,7 @@ void __fastcall SyncPlrInv(TSyncHeader *pSync) } // 6AAA34: using guessed type int sgnSyncPInv; -int __fastcall SyncData(int pnum, TSyncHeader *packet) +int __fastcall sync_update(int pnum, TSyncHeader *packet) { TSyncHeader *v2; // esi TSyncMonster *v3; // edi @@ -238,7 +238,7 @@ int __fastcall SyncData(int pnum, TSyncHeader *packet) v6 = v5 / 5u; do { if (currlevel == v2->bLevel) - sync_monster_data(v4, v3); + sync_monster(v4, v3); delta_sync_monster((TCmdLocParam1 *)v3, v2->bLevel); ++v3; --v6; @@ -249,7 +249,7 @@ int __fastcall SyncData(int pnum, TSyncHeader *packet) } // 676194: using guessed type char gbBufferMsgs; -void __fastcall sync_monster_data(int pnum, TSyncMonster *packet) +void __fastcall sync_monster(int pnum, TSyncMonster *packet) { TSyncMonster *v2; // edi int v3; // ecx @@ -336,9 +336,9 @@ void __fastcall sync_monster_data(int pnum, TSyncMonster *packet) } } -void __cdecl sync_clear_pkt() +void __cdecl sync_init() { - syncmonsters = 16 * myplr; - memset(sync_word_6AA89C, 255, 0x190u); + sgnMonsters = 16 * myplr; + memset(sgwLRU, 255, 0x190u); } -// 6AA898: using guessed type int syncmonsters; +// 6AA898: using guessed type int sgnMonsters; diff --git a/Source/sync.h b/Source/sync.h index 88d0f83eb..56b80bc7f 100644 --- a/Source/sync.h +++ b/Source/sync.h @@ -2,10 +2,10 @@ #ifndef __SYNC_H__ #define __SYNC_H__ -extern short sync_word_6AA708[MAXMONSTERS]; -extern int syncmonsters; // weak -extern short sync_word_6AA89C[MAXMONSTERS]; -extern int syncitems; +extern WORD sync_word_6AA708[MAXMONSTERS]; +extern int sgnMonsters; // weak +extern WORD sgwLRU[MAXMONSTERS]; +extern int sgnSyncItem; int __fastcall sync_all_monsters(TSyncHeader *packet, int size); void __cdecl sync_one_monster(); @@ -13,8 +13,8 @@ int __fastcall sync_monster_active(TSyncMonster *packet); void __fastcall sync_monster_pos(TSyncMonster *packet, int mon_id); int __fastcall sync_monster_active2(TSyncMonster *packet); void __fastcall SyncPlrInv(TSyncHeader *pSync); -int __fastcall SyncData(int pnum, TSyncHeader *packet); -void __fastcall sync_monster_data(int pnum, TSyncMonster *packet); -void __cdecl sync_clear_pkt(); +int __fastcall sync_update(int pnum, TSyncHeader *packet); +void __fastcall sync_monster(int pnum, TSyncMonster *packet); +void __cdecl sync_init(); #endif /* __SYNC_H__ */