summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/netvars.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/netvars.cpp b/src/netvars.cpp
index 2747c29..9b7e3c9 100644
--- a/src/netvars.cpp
+++ b/src/netvars.cpp
@@ -67,10 +67,18 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) {
67 if (dump) 67 if (dump)
68 logd(" [%s] %s type=%d off=%d(0x%x) table=%s array=%s", tname, pname2, 68 logd(" [%s] %s type=%d off=%d(0x%x) table=%s array=%s", tname, pname2,
69 ptype, poff, poff, ptable ? "yes" : "no", parray ? "yes" : "no"); 69 ptype, poff, poff, ptable ? "yes" : "no", parray ? "yes" : "no");
70 if (ptable) { 70 if (ptable && !parray) {
71 collect_netvars(ptable, base_off + (uint32_t)poff, depth + 1); 71 collect_netvars(ptable, base_off + (uint32_t)poff, depth + 1);
72 continue; 72 continue;
73 } 73 }
74 if (parray) {
75 static int alogs = 0;
76 if (alogs < 16) {
77 alogs++;
78 logd("netvar array %s poff=%d eoff=%d base=%d", pname2, poff,
79 *(int32_t *)(parray + 0x2C), (int)base_off);
80 }
81 }
74 82
75 if (strcmp(pname2, "m_lifeState") == 0 && g_net.lifestate < 0) { 83 if (strcmp(pname2, "m_lifeState") == 0 && g_net.lifestate < 0) {
76 g_net.lifestate = (int)(base_off + (uint32_t)poff); 84 g_net.lifestate = (int)(base_off + (uint32_t)poff);
@@ -115,12 +123,28 @@ static void collect_netvars(uintptr_t table, uintptr_t base_off, int depth) {
115 } else if (strcmp(pname2, "m_hMyWeapons") == 0 && 123 } else if (strcmp(pname2, "m_hMyWeapons") == 0 &&
116 g_net.my_weapons < 0) { 124 g_net.my_weapons < 0) {
117 int off = (int)(base_off + (uint32_t)poff); 125 int off = (int)(base_off + (uint32_t)poff);
118 if (off >= 0x20 && off <= 0x2000) 126 if (parray) {
127 int32_t eoff = *(int32_t *)(parray + 0x2C);
128 if (eoff)
129 off = (int)(base_off + (uint32_t)eoff);
130 }
131 if (off >= 0x20 && off <= 0x2000) {
119 g_net.my_weapons = off; 132 g_net.my_weapons = off;
133 logd("netvar: m_hMyWeapons base_off=%d poff=%d parray=%p -> %d",
134 (int)base_off, poff, (void *)parray, off);
135 }
120 } else if (strcmp(pname2, "m_iAmmo") == 0 && g_net.ammo < 0) { 136 } else if (strcmp(pname2, "m_iAmmo") == 0 && g_net.ammo < 0) {
121 int off = (int)(base_off + (uint32_t)poff); 137 int off = (int)(base_off + (uint32_t)poff);
122 if (off >= 0x20 && off <= 0x2000) 138 if (parray) {
139 int32_t eoff = *(int32_t *)(parray + 0x2C);
140 if (eoff)
141 off = (int)(base_off + (uint32_t)eoff);
142 }
143 if (off >= 0x20 && off <= 0x2000) {
123 g_net.ammo = off; 144 g_net.ammo = off;
145 logd("netvar: m_iAmmo base_off=%d poff=%d parray=%p -> %d",
146 (int)base_off, poff, (void *)parray, off);
147 }
124 } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) { 148 } else if (strcmp(pname2, "m_iTeamNum") == 0 && g_net.teamnum < 0) {
125 g_net.teamnum = (int)(base_off + (uint32_t)poff); 149 g_net.teamnum = (int)(base_off + (uint32_t)poff);
126 } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) { 150 } else if (strcmp(pname2, "m_vecOrigin") == 0 && g_net.origin < 0) {