1void() info_intermission = 2{ 3}; 4 5void() SetChangeParms = 6{ 7}; 8 9void() SetNewParms = 10{ 11}; 12 13void() PutClientInServer = 14{ 15}; 16 17 18void() PlayerPreThink = 19{ 20}; 21 22 23void() PlayerPostThink = 24{ 25}; 26 27// 28// Dump the internal cl data structure for self 29// 30void() DumpCL = 31{ 32 local entity cl; 33 local float p; 34 local float i; 35 36 p = AddInt(PSTRING_TO_PQUAKEC, &self.netname); 37 cl = *SubInt(p, 4 * CL_NAME); 38 39 dprint("--- CLIENT_T ---\n"); 40 dprint("self = "); 41 hex32(&self); 42 dprint("cl.active = "); 43 hex32(cl[CL_ACTIVE]); 44 dprint("cl.spawned = "); 45 hex32(cl[CL_SPAWNED]); 46 dprint("cl.privileged = "); 47 hex32(cl[CL_PRIVILEGED]); 48 dprint("cl.message.data = "); 49 hex32(AddInt(cl[CL_MESSAGE_DATA], PC_TO_PQUAKEC)); 50 dprint("cl.message.maxsize = "); 51 hex32(cl[CL_MESSAGE_MAXSIZE]); 52 dprint("cl.message.cursize = "); 53 hex32(cl[CL_MESSAGE_CURSIZE]); 54 dprint("&cl.msgbuf = "); 55 hex32(AddInt(&cl, 4 * CL_MSGBUF)); 56 dprint("cl.edict = "); 57 hex32(AddInt(cl[CL_EDICT], PC_TO_PQUAKEC)); 58 p = AddInt(AddInt(&cl, 4 * CL_NAME), PQUAKEC_TO_PSTRING); 59 dprint("cl.name = ", @p, "\n"); 60 dprint("cl.colors = "); 61 hex32(cl[CL_COLORS]); 62 dprint("cl.ping_times = "); 63 64 for (i = 0 ; i < %16 ; i = i + %1) 65 dprint(ftos(cl[CL_PING_TIMES + i] * 1000), " "); 66 67 dprint("\n"); 68 dprint("cl.num_pings = "); 69 hex32(cl[CL_NUM_PINGS]); 70 dprint("cl.spawn_parms = "); 71 72 for (i = 0 ; i < %16 ; i = i + %1) 73 dprint(ftos(cl[CL_SPAWN_PARMS + i]), " "); 74 75 dprint("\n"); 76 dprint("cl.old_frags = "); 77 hex32(cl[CL_OLD_FRAGS]); 78 79 dprint("--- QSOCKET_S ---\n"); 80 cl = *AddInt(cl[CL_NETCONNECTION], PC_TO_PQUAKEC); 81 82 dprint("cl.netconnection.addr = "); 83 hex32(cl[QS_ADDR]); 84 hex32(cl[AddInt(QS_ADDR, %1)]); 85 hex32(cl[AddInt(QS_ADDR, %2)]); 86 hex32(cl[AddInt(QS_ADDR, %3)]); 87 dprint("cl.netconnection.in_addr = "); 88 hex32(cl[QS_IN_ADDR]); 89 p = AddInt(AddInt(&cl, 4 * QS_ADDRESS), PQUAKEC_TO_PSTRING); 90 dprint("cl.netconnection.address = ", @p, "\n"); 91}; 92 93// 94// Sample code: mask a player's IP address. 95// 96// Only coded for big endian machines! 97// 98void() FixAddress = 99{ 100 local string old, new; 101 local entity cl, qs; 102 103 cl = *SubInt(AddInt(PSTRING_TO_PQUAKEC, &self.netname), 4 * CL_NAME); 104 qs = *AddInt(cl[CL_NETCONNECTION], PC_TO_PQUAKEC); 105 106 new = @AddInt(AddInt(&qs, 4 * QS_ADDRESS), PQUAKEC_TO_PSTRING); 107 old = @AddInt(&new, %32); 108 109 strcpy(old, new); 110 111 local float dotcount; 112 local float pch; 113 local float px; 114 px = AddInt(&"xxx", PSTRING_TO_PQUAKEC); 115 pch = AddInt(&new, PSTRING_TO_PQUAKEC); 116 pch = AddInt(pch, %-3); 117 &%116 = 0; 118 for (dotcount = 0 ; dotcount < 3 ; pch = AddInt(pch, %1)) 119 { 120 &%113 = (*pch)[0]; 121 if (world[%5] == '.') 122 dotcount = dotcount + 1; 123 } 124 pch = AddInt(pch, %3); 125 (*pch)[0] = (*px)[0]; 126 127 dprint("old = ", old, "\n"); 128 dprint("new = ", new, "\n"); 129}; 130 131void() ClientConnect = 132{ 133 // enable dprint 134 cvar_set("developer", "1"); 135 136 DumpCL(); 137 FixAddress(); 138 139 // so that the view will be upright (not that it matters) 140 self.health = 100; 141 142 cvar_set("developer", "0"); 143}; 144 145// 146// Escape sequence test.. connect to the server and type "kill" 147// 148void() ClientKill = 149{ 150 centerprint(self, "\.This\. \b\<\.is\.\>\b a \[test\]\n", 151 "\(testing\) \(\1\=\2\=\3\)\n", 152 "\{1}\{2}\{3}\n", 153 "\{4}\-\{6}\n", 154 "\{7}\{8}\{9}\n", 155 "\b\{11}\{13}\b\n"); 156 157}; 158 159void() ClientDisconnect = 160{ 161}; 162 163