diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 354c7be3d..ca6ec03e2 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1612,15 +1612,15 @@ void CL_Packet_f (void) if (Cmd_FromGamecode()) //some mvd servers stuffcmd a packet command which lets them know which ip the client is from. { //unfortunatly, 50% of servers are badly configured. if (adr.type == NA_IP) - if (adr.ip[0] == 127) - if (adr.ip[1] == 0) - if (adr.ip[2] == 0) - if (adr.ip[3] == 1) + if (adr.address.ip[0] == 127) + if (adr.address.ip[1] == 0) + if (adr.address.ip[2] == 0) + if (adr.address.ip[3] == 1) { - adr.ip[0] = cls.netchan.remote_address.ip[0]; - adr.ip[1] = cls.netchan.remote_address.ip[1]; - adr.ip[2] = cls.netchan.remote_address.ip[2]; - adr.ip[3] = cls.netchan.remote_address.ip[3]; + adr.address.ip[0] = cls.netchan.remote_address.address.ip[0]; + adr.address.ip[1] = cls.netchan.remote_address.address.ip[1]; + adr.address.ip[2] = cls.netchan.remote_address.address.ip[2]; + adr.address.ip[3] = cls.netchan.remote_address.address.ip[3]; adr.port = cls.netchan.remote_address.port; Con_Printf ("^b^1Server is broken. Trying to send to server instead.\n"); @@ -2056,7 +2056,7 @@ client_connect: //fixme: make function Con_TPrintf (TLC_CONLESS_CONCMD); if (net_from.type != net_local_cl_ipadr.type - || ((*(unsigned *)net_from.ip != *(unsigned *)net_local_cl_ipadr.ip) && (*(unsigned *)net_from.ip != htonl(INADDR_LOOPBACK)))) + || ((*(unsigned *)net_from.address.ip != *(unsigned *)net_local_cl_ipadr.address.ip) && (*(unsigned *)net_from.address.ip != htonl(INADDR_LOOPBACK)))) { Con_TPrintf (TLC_CMDFROMREMOTE); return; diff --git a/engine/client/in_raw.h b/engine/client/in_raw.h index e680783ac..3826f8746 100644 --- a/engine/client/in_raw.h +++ b/engine/client/in_raw.h @@ -73,7 +73,7 @@ typedef struct tagRAWMOUSE { USHORT usButtonFlags; USHORT usButtonData; }; - }; + } buttondata; ULONG ulRawButtons; LONG lLastX; LONG lLastY; diff --git a/engine/client/in_win.c b/engine/client/in_win.c index ca9f1dbfc..6468339ad 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -73,7 +73,7 @@ typedef struct { DWORD threadid; }; HANDLE rawinputhandle; // raw input - }; + } handles; int numbuttons; @@ -852,11 +852,11 @@ unsigned int _stdcall IN_SerialMSRun(void *param) char code[3]; DWORD read; int total=0; - IN_SetSerialBoad(mouse->comhandle, 1200); + IN_SetSerialBoad(mouse->handles.comhandle, 1200); total=0; while(1) { - ReadFile(mouse->comhandle, code, sizeof(code)-total, &read, NULL); + ReadFile(mouse->handles.comhandle, code, sizeof(code)-total, &read, NULL); total+=read; if (total == 3) { @@ -886,15 +886,15 @@ unsigned long __stdcall IN_SerialMSIntelliRun(void *param) mouse_t *mouse = param; unsigned char code[80]; DWORD read, total=0; - IN_SetSerialBoad(mouse->comhandle, 1200); + IN_SetSerialBoad(mouse->handles.comhandle, 1200); - ReadFile(mouse->comhandle, code, 11*4+2, &read, NULL); //header info which we choose to ignore + ReadFile(mouse->handles.comhandle, code, 11*4+2, &read, NULL); //header info which we choose to ignore mouse->numbuttons = 3; while(1) { - ReadFile(mouse->comhandle, code+total, 4-total, &read, NULL); + ReadFile(mouse->handles.comhandle, code+total, 4-total, &read, NULL); total+=read; if (total >= 4) { @@ -1073,7 +1073,7 @@ void IN_RawInput_Init(void) Con_SafePrintf("Raw input: [%i] %s\n", i, dname); // set handle - rawmice[rawmicecount].rawinputhandle = pRawInputDeviceList[i].hDevice; + rawmice[rawmicecount].handles.rawinputhandle = pRawInputDeviceList[i].hDevice; rawmice[rawmicecount].numbuttons = 10; rawmice[rawmicecount].pos[0] = RI_INVALID_POS; rawmicecount++; @@ -1160,17 +1160,17 @@ void IN_StartupMouse (void) IN_ActivateMouse (); #ifdef SERIALMOUSE - if (serialmouse.comhandle) + if (serialmouse.handles.comhandle) { - TerminateThread(serialmouse.threadhandle, 0); - CloseHandle(serialmouse.threadhandle); - CloseHandle(serialmouse.comhandle); + TerminateThread(serialmouse.handles.threadhandle, 0); + CloseHandle(serialmouse.handles.threadhandle); + CloseHandle(serialmouse.handles.comhandle); } serialmouse.numbuttons = 0; if (COM_CheckParm("-mouse2")) { - serialmouse.comhandle = CreateFile("\\\\.\\COM2", + serialmouse.handles.comhandle = CreateFile("\\\\.\\COM2", GENERIC_READ, 0, // share for reading NULL, // default security @@ -1178,17 +1178,17 @@ void IN_StartupMouse (void) FILE_ATTRIBUTE_NORMAL, // normal file NULL); // no attr. template - if (serialmouse.comhandle == INVALID_HANDLE_VALUE) + if (serialmouse.handles.comhandle == INVALID_HANDLE_VALUE) { - serialmouse.comhandle = NULL; + serialmouse.handles.comhandle = NULL; return; } - serialmouse.threadhandle = CreateThread(NULL, 1024, IN_SerialMSIntelliRun, (void *)&serialmouse, CREATE_SUSPENDED, &serialmouse.threadid); - SetThreadPriority(serialmouse.threadhandle, THREAD_PRIORITY_HIGHEST); - ResumeThread(serialmouse.threadhandle); + serialmouse.handles.threadhandle = CreateThread(NULL, 1024, IN_SerialMSIntelliRun, (void *)&serialmouse, CREATE_SUSPENDED, &serialmouse.handles.threadid); + SetThreadPriority(serialmouse.handles.threadhandle, THREAD_PRIORITY_HIGHEST); + ResumeThread(serialmouse.handles.threadhandle); } else - serialmouse.comhandle = NULL; + serialmouse.handles.comhandle = NULL; #endif } @@ -1765,7 +1765,7 @@ void IN_RawInput_MouseRead(HANDLE in_device_handle) // find mouse in our mouse list for (; i < rawmicecount; i++) { - if (rawmice[i].rawinputhandle == raw->header.hDevice) + if (rawmice[i].handles.rawinputhandle == raw->header.hDevice) break; } @@ -1791,34 +1791,37 @@ void IN_RawInput_MouseRead(HANDLE in_device_handle) } // buttons - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_DOWN) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_1_DOWN) Key_Event(K_MOUSE1, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_1_UP) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_1_UP) Key_Event(K_MOUSE1, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_DOWN) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_2_DOWN) Key_Event(K_MOUSE2, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_2_UP) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_2_UP) Key_Event(K_MOUSE2, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_DOWN) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_3_DOWN) Key_Event(K_MOUSE3, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_3_UP) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_3_UP) Key_Event(K_MOUSE3, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_4_DOWN) Key_Event(K_MOUSE4, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_4_UP) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_4_UP) Key_Event(K_MOUSE4, false); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_5_DOWN) Key_Event(K_MOUSE5, true); - if (raw->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_UP) + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_BUTTON_5_UP) Key_Event(K_MOUSE5, false); // mouse wheel - if (raw->data.mouse.usButtonFlags & RI_MOUSE_WHEEL) { // If the current message has a mouse_wheel message - if ((SHORT)raw->data.mouse.usButtonData > 0) { + if (raw->data.mouse.buttondata.usButtonFlags & RI_MOUSE_WHEEL) + { // If the current message has a mouse_wheel message + if ((SHORT)raw->data.mouse.buttondata.usButtonData > 0) + { Key_Event(K_MWHEELUP, true); Key_Event(K_MWHEELUP, false); } - if ((SHORT)raw->data.mouse.usButtonData < 0) { + if ((SHORT)raw->data.mouse.buttondata.usButtonData < 0) + { Key_Event(K_MWHEELDOWN, true); Key_Event(K_MWHEELDOWN, false); } diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 7671158e5..6d5c8b6ae 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -1596,10 +1596,10 @@ void CL_MasterListParse(int type, qboolean slashpad) info = Z_Malloc(sizeof(serverinfo_t)); info->adr.type = NA_IP; - info->adr.ip[0] = MSG_ReadByte(); - info->adr.ip[1] = MSG_ReadByte(); - info->adr.ip[2] = MSG_ReadByte(); - info->adr.ip[3] = MSG_ReadByte(); + info->adr.address.ip[0] = MSG_ReadByte(); + info->adr.address.ip[1] = MSG_ReadByte(); + info->adr.address.ip[2] = MSG_ReadByte(); + info->adr.address.ip[3] = MSG_ReadByte(); p1 = MSG_ReadByte(); p2 = MSG_ReadByte(); diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 98612c9d6..17d4406b1 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -2108,7 +2108,7 @@ int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, if (ptype->flags & PT_INVFRAMETIME) pcount /= host_frametime; if (ts) - pcount += ts->emittime; + pcount += ts->state2.emittime; switch (ptype->spawnmode) { @@ -2155,10 +2155,10 @@ int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, // time limit (for completeness) if (ptype->spawntime && ts) { - if (ts->statetime > particletime) + if (ts->state1.statetime > particletime) return 0; // timelimit still in effect - ts->statetime = particletime + ptype->spawntime; // record old time + ts->state1.statetime = particletime + ptype->spawntime; // record old time } // random chance for point effects @@ -2204,9 +2204,10 @@ int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, else p->alpha = ptype->alpha; // p->color = 0; - p->nextemit = particletime + ptype->emitstart - p->die; if (ptype->emittime < 0) - p->trailstate = NULL; + p->state.trailstate = NULL; + else + p->state.nextemit = particletime + ptype->emitstart - p->die; p->rotationspeed = ptype->rotationmin + frandom()*ptype->rotationrand; p->angle = ptype->rotationstartmin + frandom()*ptype->rotationstartrand; @@ -2428,7 +2429,7 @@ int P_RunParticleEffectState (vec3_t org, vec3_t dir, float count, int typenum, // save off emit times in trailstate if (ts) - ts->emittime = pcount - i; + ts->state2.emittime = pcount - i; // go to next associated effect if (ptype->assoc < 0) @@ -2780,10 +2781,10 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype // time limit for trails if (ptype->spawntime && ts) { - if (ts->statetime > particletime) + if (ts->state1.statetime > particletime) return; // timelimit still in effect - ts->statetime = particletime + ptype->spawntime; // record old time + ts->state1.statetime = particletime + ptype->spawntime; // record old time ts = NULL; // clear trailstate so we don't save length/lastseg } @@ -2834,8 +2835,8 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype // store last stop here for lack of a better solution besides vectors if (ts) { - ts->laststop = stop = ts->laststop + len; //when to stop - len = ts->lastdist; + ts->state2.laststop = stop = ts->state2.laststop + len; //when to stop + len = ts->state1.lastdist; } else { @@ -2946,9 +2947,10 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype p->rgb[2] += p->org[2]*ptype->rgbrand[2] + ptype->rgbchange[2]*p->die; VectorCopy (vec3_origin, p->vel); - p->nextemit = particletime + ptype->emitstart - p->die; if (ptype->emittime < 0) - p->trailstate = NULL; // init trailstate + p->state.trailstate = NULL; // init trailstate + else + p->state.nextemit = particletime + ptype->emitstart - p->die; p->rotationspeed = ptype->rotationmin + frandom()*ptype->rotationrand; p->angle = ptype->rotationstartmin + frandom()*ptype->rotationstartrand; @@ -3101,7 +3103,7 @@ static void P_ParticleTrailDraw (vec3_t startpos, vec3_t end, part_type_t *ptype if (ts) { - ts->lastdist = len; + ts->state1.lastdist = len; // update beamseg list if (ptype->type == PT_BEAM) @@ -4110,7 +4112,7 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void kill = type->particles; if (kill && kill->die < particletime) { - P_DelinkTrailstate(&kill->trailstate); + P_DelinkTrailstate(&kill->state.trailstate); type->particles = kill->next; kill->next = kill_list; kill_list = kill; @@ -4151,7 +4153,7 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void kill = p->next; if (kill && kill->die < particletime) { - P_DelinkTrailstate(&kill->trailstate); + P_DelinkTrailstate(&kill->state.trailstate); p->next = kill->next; kill->next = kill_list; kill_list = kill; @@ -4225,10 +4227,10 @@ void DrawParticleTypes (void texturedparticles(particle_t *,part_type_t*), void if (type->emit >= 0) { if (type->emittime < 0) - P_ParticleTrail(oldorg, p->org, type->emit, &p->trailstate); - else if (p->nextemit < particletime) + P_ParticleTrail(oldorg, p->org, type->emit, &p->state.trailstate); + else if (p->state.nextemit < particletime) { - p->nextemit = particletime + type->emittime + frandom()*type->emitrand; + p->state.nextemit = particletime + type->emittime + frandom()*type->emitrand; P_RunParticleEffectType(p->org, p->vel, 1, type->emit); } } diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 1997e1ae0..9841e8eb5 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -1640,8 +1640,8 @@ TRACE(("dbg: R_ApplyRenderer: clearing world\n")); { for (i = 0; i < MAX_MODELS; i++) { - if (sv.model_precache[i] && *sv.model_precache[i] && (!strcmp(sv.model_precache[i] + strlen(sv.model_precache[i]) - 4, ".bsp") || i-1 < sv.worldmodel->numsubmodels)) - sv.models[i] = Mod_FindName(sv.model_precache[i]); + if (sv.strings.model_precache[i] && *sv.strings.model_precache[i] && (!strcmp(sv.strings.model_precache[i] + strlen(sv.strings.model_precache[i]) - 4, ".bsp") || i-1 < sv.worldmodel->numsubmodels)) + sv.models[i] = Mod_FindName(sv.strings.model_precache[i]); else sv.models[i] = NULL; } diff --git a/engine/client/winamp.h b/engine/client/winamp.h index 6feb71208..800a20cce 100644 --- a/engine/client/winamp.h +++ b/engine/client/winamp.h @@ -1,442 +1,884 @@ /* + ** Winamp frontend/plug-in control API documentation v1.1. + ** By Justin Frankel. Updates by Christophe Thibault. + ** Copyright (C) 1997-2000, Nullsoft Inc. + ** Last updated: JUL.12.2000. + ** + ** Introduction + ** ----------------------- + ** This file describes a means to easily communicate to Winamp + ** via the classic Win32 Message API. + ** + ** These definitions/code assume C/C++. Porting to VB/Delphi shouldn't + ** be too hard. + ** + ** First, you find the HWND of the Winamp main window. From a plug-in + ** you can easily extract this from the plug-in structure (hMainWindow, + ** hwndParent, whatever). For external apps, use: + ** + ** HWND hwnd_winamp = FindWindow("Winamp v1.x",NULL); + ** + ** (note: I know, we're in Winamp 2.x, but it's 1.x for compatibility) + ** + ** Once you have the hwnd_winamp, it's a good idea to check the version + ** number. To do this, you send a WM_WA_IPC message to hwnd_winamp. + ** Note that WM_WA_IPC is defined as Win32's WM_USER. + ** + ** Note that sometimes you might want to use PostMessage instead of + ** SendMessage. + */ + + #ifndef _WAFE_H_ + #define _WAFE_H_ + + #define WM_WA_IPC WM_USER + + /**************************************************************************/ + + #define IPC_GETVERSION 0 + + /* + ** int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); + ** + ** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0 + ** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know. + ** + ** The basic format for sending messages to Winamp is: + ** int result=SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command); + ** (for the version check, command_data is 0). + */ + + + #define IPC_DELETE 101 + + /* + ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); + ** + ** You can use IPC_DELETE to clear Winamp's internal playlist. + */ + + + #define IPC_STARTPLAY 102 + + /* + ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY); + ** + ** Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly. + */ + + + #define IPC_ISPLAYING 104 + + /* + ** int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); + ** + ** IPC_ISPLAYING returns the status of playback. + ** If it returns 1, it is playing. if it returns 3, it is paused, + ** if it returns 0, it is not playing. + */ + + + #define IPC_GETOUTPUTTIME 105 + + /* + ** int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME); + ** + ** IPC_GETOUTPUTTIME returns the position in milliseconds of the + ** current song (mode = 0), or the song length, in seconds (mode = 1). + ** Returns -1 if not playing or error. + */ + + + #define IPC_JUMPTOTIME 106 + + /* (requires Winamp 1.60+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME); + ** IPC_JUMPTOTIME sets the position in milliseconds of the + ** current song (approximately). + ** Returns -1 if not playing, 1 on eof, or 0 if successful + */ + + + #define IPC_WRITEPLAYLIST 120 + + /* (requires Winamp 1.666+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST); + ** + ** IPC_WRITEPLAYLIST writes the current playlist to \\Winamp.m3u, + ** and returns the current playlist position. + ** Kinda obsoleted by some of the 2.x new stuff, but still good for when + ** using a front-end (instead of a plug-in) + */ + + + #define IPC_SETPLAYLISTPOS 121 + + /* (requires Winamp 2.0+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS) + ** + ** IPC_SETPLAYLISTPOS sets the playlsit position to 'position'. + */ + + + #define IPC_SETVOLUME 122 + + /* (requires Winamp 2.0+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME); + ** + ** IPC_SETVOLUME sets the volume of Winamp (from 0-255). + */ + + + #define IPC_SETPANNING 123 + + /* (requires Winamp 2.0+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING); + ** + ** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)). + */ + + + #define IPC_GETLISTLENGTH 124 + + /* (requires Winamp 2.0+) + ** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH); + ** + ** IPC_GETLISTLENGTH returns the length of the current playlist, in + ** tracks. + */ + + + #define IPC_SETSKIN 200 + + /* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN); + ** + ** IPC_SETSKIN sets the current skin to "skinname". Note that skinname + ** can be the name of a skin, a skin .zip file, with or without path. + ** If path isn't specified, the default search path is the winamp skins + ** directory. + */ + + + #define IPC_GETSKIN 201 + + /* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN); + ** + ** IPC_GETSKIN puts the directory where skin bitmaps can be found + ** into skinname_buffer. + ** skinname_buffer must be MAX_PATH characters in length. + ** When using a .zip'd skin file, it'll return a temporary directory + ** where the ZIP was decompressed. + */ + + + #define IPC_EXECPLUG 202 + + /* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG); + ** + ** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM. + ** the format of this string can be: + ** "vis_whatever.dll" + ** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir) + ** "C:\\dir\\vis_whatever.dll,1" + */ + + + #define IPC_GETPLAYLISTFILE 211 + + /* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) + ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE); + ** + ** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index]. + ** returns a pointer to it. returns NULL on error. + */ + + + #define IPC_GETPLAYLISTTITLE 212 + + /* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) + ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE); + ** + ** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index]. + ** returns a pointer to it. returns NULL on error. + */ + + + #define IPC_GETLISTPOS 125 + + /* (requires Winamp 2.05+) + ** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS); + ** + ** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST + ** only faster since it doesn't have to write out the list. Heh, silly me. + */ + + + #define IPC_GETINFO 126 + + /* (requires Winamp 2.05+) + ** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO); + ** + ** IPC_GETINFO returns info about the current playing song. The value + ** it returns depends on the value of 'mode'. + ** Mode Meaning + ** ------------------ + ** 0 Samplerate (i.e. 44100) + ** 1 Bitrate (i.e. 128) + ** 2 Channels (i.e. 2) + */ + + + #define IPC_GETEQDATA 127 + + /* (requires Winamp 2.05+) + ** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); + ** + ** IPC_GETEQDATA queries the status of the EQ. + ** The value returned depends on what 'pos' is set to: + ** Value Meaning + ** ------------------ + ** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db) + ** 10 The preamp value. 0-63 (+20db - -20db) + ** 11 Enabled. zero if disabled, nonzero if enabled. + ** 12 Autoload. zero if disabled, nonzero if enabled. + */ + + + #define IPC_SETEQDATA 128 + /* (requires Winamp 2.05+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); + ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA); + ** + ** IPC_SETEQDATA sets the value of the last position retrieved + ** by IPC_GETEQDATA. + */ + + #define IPC_ADDBOOKMARK 129 + /* (requires Winamp 2.4+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_ADDBOOKMARK); + ** + ** IPC_ADDBOOKMARK will add the specified file to the Winamp bookmark list. + */ + + #define IPC_RESTARTWINAMP 135 + /* (requires Winamp 2.2+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP); + ** + ** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :) + */ + + #define IPC_MBOPEN 241 + /* (requires Winamp 2.05+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN); + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN); + ** + ** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window. + */ + + #define IPC_INETAVAILABLE 242 + /* (requires Winamp 2.05+) + ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE); + ** + ** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp. + */ + + #define IPC_UPDTITLE 243 + /* (requires Winamp 2.2+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE); + ** + ** IPC_UPDTITLE will ask Winamp to update the informations about the current title. + */ + + #define IPC_CHANGECURRENTFILE 245 + /* (requires Winamp 2.05+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE); + ** + ** IPC_CHANGECURRENTFILE will set the current playlist item. + */ + + #define IPC_GETMBURL 246 + /* (requires Winamp 2.2+) + ** char buffer[4096]; // Urls can be VERY long + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL); + ** + ** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer. + */ + + #define IPC_REFRESHPLCACHE 247 + /* (requires Winamp 2.2+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE); + ** + ** IPC_REFRESHPLCACHE will flush the playlist cache buffer. + */ + + #define IPC_MBBLOCK 248 + /* (requires Winamp 2.4+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK); + ** + ** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1 + */ + + #define IPC_MBOPENREAL 249 + /* (requires Winamp 2.4+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL); + ** + ** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if + ** IPC_MBBLOCK has been set to 1 + */ + + #define IPC_GET_SHUFFLE 250 + /* (requires Winamp 2.4+) + ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE); + ** + ** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set) + */ + + #define IPC_GET_REPEAT 251 + /* (requires Winamp 2.4+) + ** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT); + ** + ** IPC_GET_REPEAT returns the status of the Repeat option (1 if set) + */ + + #define IPC_SET_SHUFFLE 252 + /* (requires Winamp 2.4+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE); + ** + ** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on) + */ + + #define IPC_SET_REPEAT 253 + /* (requires Winamp 2.4+) + ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT); + ** + ** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on) + */ + + /**************************************************************************/ + + /* + ** Some API calls tend to require that you send data via WM_COPYDATA + ** instead of WM_USER. Such as IPC_PLAYFILE: + */ + + #define IPC_PLAYFILE 100 + + /* + ** COPYDATASTRUCT cds; + ** cds.dwData = IPC_PLAYFILE; + ** cds.lpData = (void *) "file.mp3"; + ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char + ** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); + ** + ** This will play the file "file.mp3". + ** + */ + + + #define IPC_CHDIR 103 + + /* + ** COPYDATASTRUCT cds; + ** cds.dwData = IPC_CHDIR; + ** cds.lpData = (void *) "c:\\download"; + ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char + ** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); + ** + ** This will make Winamp change to the directory C:\\download + ** + */ + + + /**************************************************************************/ + + /* + ** Finally there are some WM_COMMAND messages that you can use to send + ** Winamp misc commands. + ** + ** To send these, use: + ** + ** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0); + */ + + #define WINAMP_OPTIONS_EQ 40036 // toggles the EQ window + #define WINAMP_OPTIONS_PLEDIT 40040 // toggles the playlist window + #define WINAMP_VOLUMEUP 40058 // turns the volume up a little + #define WINAMP_VOLUMEDOWN 40059 // turns the volume down a little + #define WINAMP_FFWD5S 40060 // fast forwards 5 seconds + #define WINAMP_REW5S 40061 // rewinds 5 seconds + + // the following are the five main control buttons, with optionally shift + // or control pressed + // (for the exact functions of each, just try it out) + #define WINAMP_BUTTON1 40044 + #define WINAMP_BUTTON2 40045 + #define WINAMP_BUTTON3 40046 + #define WINAMP_BUTTON4 40047 + #define WINAMP_BUTTON5 40048 + #define WINAMP_BUTTON1_SHIFT 40144 + #define WINAMP_BUTTON2_SHIFT 40145 + #define WINAMP_BUTTON3_SHIFT 40146 + #define WINAMP_BUTTON4_SHIFT 40147 + #define WINAMP_BUTTON5_SHIFT 40148 + #define WINAMP_BUTTON1_CTRL 40154 + #define WINAMP_BUTTON2_CTRL 40155 + #define WINAMP_BUTTON3_CTRL 40156 + #define WINAMP_BUTTON4_CTRL 40157 + #define WINAMP_BUTTON5_CTRL 40158 + + #define WINAMP_FILE_PLAY 40029 // pops up the load file(s) box + #define WINAMP_OPTIONS_PREFS 40012 // pops up the preferences + #define WINAMP_OPTIONS_AOT 40019 // toggles always on top + #define WINAMP_HELP_ABOUT 40041 // pops up the about box :) + + + /* + ** EOF.. Enjoy. + */ + + #endif //_WAFE_H_ + diff --git a/engine/common/net.h b/engine/common/net.h index 0a3ce1bee..e24cb0a3a 100644 --- a/engine/common/net.h +++ b/engine/common/net.h @@ -33,7 +33,7 @@ typedef struct qbyte ip[4]; qbyte ip6[16]; qbyte ipx[10]; - }; + } address; unsigned short port; } netadr_t; diff --git a/engine/common/net_wins.c b/engine/common/net_wins.c index 9a267dfa2..4edfd09ba 100644 --- a/engine/common/net_wins.c +++ b/engine/common/net_wins.c @@ -105,7 +105,7 @@ int NetadrToSockadr (netadr_t *a, struct sockaddr_qstorage *s) memset (s, 0, sizeof(struct sockaddr_in)); ((struct sockaddr_in*)s)->sin_family = AF_INET; - *(int *)&((struct sockaddr_in*)s)->sin_addr = *(int *)&a->ip; + *(int *)&((struct sockaddr_in*)s)->sin_addr = *(int *)&a->address.ip; ((struct sockaddr_in*)s)->sin_port = a->port; return sizeof(struct sockaddr_in); #ifdef IPPROTO_IPV6 @@ -124,15 +124,15 @@ int NetadrToSockadr (netadr_t *a, struct sockaddr_qstorage *s) memset (s, 0, sizeof(struct sockaddr_in)); ((struct sockaddr_in6*)s)->sin6_family = AF_INET6; - memcpy(&((struct sockaddr_in6*)s)->sin6_addr, a->ip6, sizeof(struct in6_addr)); + memcpy(&((struct sockaddr_in6*)s)->sin6_addr, a->address.ip6, sizeof(struct in6_addr)); ((struct sockaddr_in6*)s)->sin6_port = a->port; return sizeof(struct sockaddr_in6); #endif #ifdef USEIPX case NA_IPX: ((struct sockaddr_ipx *)s)->sa_family = AF_IPX; - memcpy(((struct sockaddr_ipx *)s)->sa_netnum, &a->ipx[0], 4); - memcpy(((struct sockaddr_ipx *)s)->sa_nodenum, &a->ipx[4], 6); + memcpy(((struct sockaddr_ipx *)s)->sa_netnum, &a->address.ipx[0], 4); + memcpy(((struct sockaddr_ipx *)s)->sa_nodenum, &a->address.ipx[4], 6); ((struct sockaddr_ipx *)s)->sa_socket = a->port; return sizeof(struct sockaddr_ipx); case NA_BROADCAST_IPX: @@ -155,22 +155,22 @@ void SockadrToNetadr (struct sockaddr_qstorage *s, netadr_t *a) { case AF_INET: a->type = NA_IP; - *(int *)&a->ip = ((struct sockaddr_in *)s)->sin_addr.s_addr; + *(int *)&a->address.ip = ((struct sockaddr_in *)s)->sin_addr.s_addr; a->port = ((struct sockaddr_in *)s)->sin_port; break; #ifdef IPPROTO_IPV6 case AF_INET6: a->type = NA_IPV6; - memcpy(&a->ip6, &((struct sockaddr_in6 *)s)->sin6_addr, sizeof(a->ip6)); + memcpy(&a->address.ip6, &((struct sockaddr_in6 *)s)->sin6_addr, sizeof(a->address.ip6)); a->port = ((struct sockaddr_in6 *)s)->sin6_port; break; #endif #ifdef USEIPX case AF_IPX: a->type = NA_IPX; - *(int *)a->ip = 0xffffffff; - memcpy(&a->ipx[0], ((struct sockaddr_ipx *)s)->sa_netnum, 4); - memcpy(&a->ipx[4], ((struct sockaddr_ipx *)s)->sa_nodenum, 6); + *(int *)a->address.ip = 0xffffffff; + memcpy(&a->address.ipx[0], ((struct sockaddr_ipx *)s)->sa_netnum, 4); + memcpy(&a->address.ipx[4], ((struct sockaddr_ipx *)s)->sa_nodenum, 6); a->port = ((struct sockaddr_ipx *)s)->sa_socket; break; #endif @@ -193,7 +193,7 @@ qboolean NET_CompareAdr (netadr_t a, netadr_t b) if (a.type == NA_IP || a.type == NA_BROADCAST_IP) { - if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3] && a.port == b.port) + if ((memcmp(a.address.ip, b.address.ip, sizeof(a.address.ip)) == 0) && a.port == b.port) return true; return false; } @@ -201,7 +201,7 @@ qboolean NET_CompareAdr (netadr_t a, netadr_t b) #ifdef IPPROTO_IPV6 if (a.type == NA_IPV6 || a.type == NA_BROADCAST_IP6) { - if ((memcmp(a.ip6, b.ip6, 16) == 0) && a.port == b.port) + if ((memcmp(a.address.ip6, b.address.ip6, sizeof(a.address.ip6)) == 0) && a.port == b.port) return true; return false; } @@ -209,7 +209,7 @@ qboolean NET_CompareAdr (netadr_t a, netadr_t b) if (a.type == NA_IPX || a.type == NA_BROADCAST_IPX) { - if ((memcmp(a.ipx, b.ipx, 10) == 0) && a.port == b.port) + if ((memcmp(a.address.ipx, b.address.ipx, sizeof(a.address.ipx)) == 0) && a.port == b.port) return true; return false; } @@ -235,21 +235,21 @@ qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b) if (a.type == NA_IP) { - if (a.ip[0] == b.ip[0] && a.ip[1] == b.ip[1] && a.ip[2] == b.ip[2] && a.ip[3] == b.ip[3]) + if ((memcmp(a.address.ip, b.address.ip, sizeof(a.address.ip)) == 0)) return true; return false; } #ifdef IPPROTO_IPV6 if (a.type == NA_IPV6 || a.type == NA_BROADCAST_IP6) { - if ((memcmp(a.ip6, b.ip6, 16) == 0)) + if ((memcmp(a.address.ip6, b.address.ip6, 16) == 0)) return true; return false; } #endif if (a.type == NA_IPX) { - if ((memcmp(a.ipx, b.ipx, 10) == 0)) + if ((memcmp(a.address.ipx, b.address.ipx, 10) == 0)) return true; return false; } @@ -266,18 +266,51 @@ char *NET_AdrToString (netadr_t a) { case NA_BROADCAST_IP: case NA_IP: - sprintf (s, "%i.%i.%i.%i:%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3], ntohs(a.port)); + sprintf (s, "%i.%i.%i.%i:%i", + a.address.ip[0], + a.address.ip[1], + a.address.ip[2], + a.address.ip[3], + ntohs(a.port)); break; #ifdef IPPROTO_IPV6 case NA_BROADCAST_IP6: case NA_IPV6: - sprintf (s, "[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%i", a.ip6[0], a.ip6[1], a.ip6[2], a.ip6[3], a.ip6[4], a.ip6[5], a.ip6[6], a.ip6[7], a.ip6[8], a.ip6[9], a.ip6[10], a.ip6[11], a.ip6[12], a.ip6[13], a.ip6[14], a.ip6[15], ntohs(a.port)); + sprintf (s, "[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]:%i", + a.address.ip6[0], + a.address.ip6[1], + a.address.ip6[2], + a.address.ip6[3], + a.address.ip6[4], + a.address.ip6[5], + a.address.ip6[6], + a.address.ip6[7], + a.address.ip6[8], + a.address.ip6[9], + a.address.ip6[10], + a.address.ip6[11], + a.address.ip6[12], + a.address.ip6[13], + a.address.ip6[14], + a.address.ip6[15], + ntohs(a.port)); break; #endif #ifdef USEIPX case NA_BROADCAST_IPX: case NA_IPX: - sprintf (s, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%i", a.ipx[0], a.ipx[1], a.ipx[2], a.ipx[3], a.ipx[4], a.ipx[5], a.ipx[6], a.ipx[7], a.ipx[8], a.ipx[9], ntohs(a.port)); + sprintf (s, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%i", + a.address.ipx[0], + a.address.ipx[1], + a.address.ipx[2], + a.address.ipx[3], + a.address.ipx[4], + a.address.ipx[5], + a.address.ipx[6], + a.address.ipx[7], + a.address.ipx[8], + a.address.ipx[9], + ntohs(a.port)); break; #endif case NA_LOOPBACK: @@ -299,18 +332,48 @@ char *NET_BaseAdrToString (netadr_t a) { case NA_BROADCAST_IP: case NA_IP: - sprintf (s, "%i.%i.%i.%i", a.ip[0], a.ip[1], a.ip[2], a.ip[3]); + sprintf (s, "%i.%i.%i.%i", + a.address.ip[0], + a.address.ip[1], + a.address.ip[2], + a.address.ip[3]); break; #ifdef IPPROTO_IPV6 case NA_BROADCAST_IP6: case NA_IPV6: - sprintf (s, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", a.ip6[0], a.ip6[1], a.ip6[2], a.ip6[3], a.ip6[4], a.ip6[5], a.ip6[6], a.ip6[7], a.ip6[8], a.ip6[9], a.ip6[10], a.ip6[11], a.ip6[12], a.ip6[13], a.ip6[14], a.ip6[15]); + sprintf (s, "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x", + a.address.ip6[0], + a.address.ip6[1], + a.address.ip6[2], + a.address.ip6[3], + a.address.ip6[4], + a.address.ip6[5], + a.address.ip6[6], + a.address.ip6[7], + a.address.ip6[8], + a.address.ip6[9], + a.address.ip6[10], + a.address.ip6[11], + a.address.ip6[12], + a.address.ip6[13], + a.address.ip6[14], + a.address.ip6[15]); break; #endif #ifdef USEIPX case NA_BROADCAST_IPX: case NA_IPX: - sprintf (s, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x", a.ipx[0], a.ipx[1], a.ipx[2], a.ipx[3], a.ipx[4], a.ipx[5], a.ipx[6], a.ipx[7], a.ipx[8], a.ipx[9]); + sprintf (s, "%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x", + a.address.ipx[0], + a.address.ipx[1], + a.address.ipx[2], + a.address.ipx[3], + a.address.ipx[4], + a.address.ipx[5], + a.address.ipx[6], + a.address.ipx[7], + a.address.ipx[8], + a.address.ipx[9]); break; #endif case NA_LOOPBACK: @@ -1385,8 +1448,8 @@ void NET_GetLocalAddress (int socket, netadr_t *out) } SockadrToNetadr(&address, out); - if (!*(int*)out->ip) //socket was set to auto - *(int *)out->ip = *(int *)adr.ip; //change it to what the machine says it is, rather than the socket. + if (!*(int*)out->address.ip) //socket was set to auto + *(int *)out->address.ip = *(int *)adr.address.ip; //change it to what the machine says it is, rather than the socket. if (notvalid) Con_Printf("Couldn't detect local ip\n"); diff --git a/engine/common/particles.h b/engine/common/particles.h index 5ccb339c2..3f56b942b 100644 --- a/engine/common/particles.h +++ b/engine/common/particles.h @@ -68,11 +68,11 @@ typedef struct trailstate_s { union { float lastdist; // last distance used with particle effect float statetime; // time to emit effect again (used by spawntime field) - }; + } state1; union { float laststop; // last stopping point for particle effect float emittime; // used by r_effect emitters - }; + } state2; } trailstate_t; // !!! if this is changed, it must be changed in d_ifacea.h too !!! @@ -93,7 +93,7 @@ typedef struct particle_s union { float nextemit; trailstate_t *trailstate; - }; + } state; // drivers never touch the following fields float rotationspeed; } particle_t; diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index a0f655e6b..ee1dcaf25 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -1917,21 +1917,21 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals) i = 0; else { - for (i=1; sv.model_precache[i] ; i++) + for (i=1; sv.strings.model_precache[i] ; i++) { - if (!strcmp(sv.model_precache[i], m)) + if (!strcmp(sv.strings.model_precache[i], m)) { - m = sv.model_precache[i]; + m = sv.strings.model_precache[i]; break; } } - if (i==MAX_MODELS || !sv.model_precache[i]) + if (i==MAX_MODELS || !sv.strings.model_precache[i]) { if (i!=MAX_MODELS) { - sv.model_precache[i] = PR_AddString(prinst, m, 0); + sv.strings.model_precache[i] = PR_AddString(prinst, m, 0); if (!strcmp(m + strlen(m) - 4, ".bsp")) - sv.models[i] = Mod_FindName(sv.model_precache[i]); + sv.models[i] = Mod_FindName(sv.strings.model_precache[i]); Con_Printf("WARNING: SV_ModelIndex: model %s not precached\n", m); if (sv.state != ss_loading) @@ -1954,7 +1954,7 @@ void PF_setmodel (progfuncs_t *prinst, struct globalvars_s *pr_globals) } } - e->v->model = PR_SetString(prinst, sv.model_precache[i]); + e->v->model = PR_SetString(prinst, sv.strings.model_precache[i]); e->v->modelindex = i; // if it is an inline model, get the size information for it @@ -2662,11 +2662,11 @@ void PF_ambientsound (progfuncs_t *prinst, struct globalvars_s *pr_globals) attenuation = G_FLOAT(OFS_PARM3); // check to see if samp was properly precached - for (soundnum=1 ; *sv.sound_precache[soundnum] ; soundnum++) - if (!strcmp(sv.sound_precache[soundnum],samp)) + for (soundnum=1 ; *sv.strings.sound_precache[soundnum] ; soundnum++) + if (!strcmp(sv.strings.sound_precache[soundnum],samp)) break; - if (!*sv.sound_precache[soundnum]) + if (!*sv.strings.sound_precache[soundnum]) { Con_TPrintf (STL_NOPRECACHE, samp); return; @@ -3664,9 +3664,9 @@ void PF_precache_sound (progfuncs_t *prinst, struct globalvars_s *pr_globals) for (i=1 ; i=MAX_QPATH-1) //probably safest to keep this. { PR_BIError (prinst, "Precache name too long"); return; } - sv.model_precache[i] = PR_AddString(prinst, s, 0); + sv.strings.model_precache[i] = PR_AddString(prinst, s, 0); if (!strcmp(s + strlen(s) - 4, ".bsp")) - sv.models[i] = Mod_FindName(sv.model_precache[i]); + sv.models[i] = Mod_FindName(sv.strings.model_precache[i]); if (sv.state != ss_loading) { @@ -3737,7 +3737,7 @@ void PF_precache_model (progfuncs_t *prinst, struct globalvars_s *pr_globals) return; } - if (!strcmp(sv.model_precache[i], s)) + if (!strcmp(sv.strings.model_precache[i], s)) { return; } @@ -3773,7 +3773,7 @@ void PF_WeapIndex (progfuncs_t *prinst, struct globalvars_s *pr_globals) for (i=1 ; i= MAX_LIGHTSTYLES || !sv.lightstyles[style]) + if(style < 0 || style >= MAX_LIGHTSTYLES || !sv.strings.lightstyles[style]) { G_FLOAT(OFS_RETURN) = 0; return; } - G_FLOAT(OFS_RETURN) = *sv.lightstyles[style] - 'a'; + G_FLOAT(OFS_RETURN) = *sv.strings.lightstyles[style] - 'a'; } void PF_lightstylestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals) @@ -4057,13 +4057,13 @@ void PF_lightstylestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals) // change the string in sv - if (sv.lightstyles[style]) - Z_Free(sv.lightstyles[style]); - sv.lightstyles[style] = Z_Malloc(strlen(val)+1); - strcpy(sv.lightstyles[style], val); + if (sv.strings.lightstyles[style]) + Z_Free(sv.strings.lightstyles[style]); + sv.strings.lightstyles[style] = Z_Malloc(strlen(val)+1); + strcpy(sv.strings.lightstyles[style], val); // sv.lightstyles[style] = val; #ifdef PEXT_LIGHTSTYLECOL - sv.lightstylecolours[style] = col; + sv.strings.lightstylecolours[style] = col; #endif // send message to all clients on this server @@ -8824,7 +8824,7 @@ int SV_TagForName(int modelindex, char *tagname) #if 1 model_t *model = sv.models[modelindex]; if (!model) - model = Mod_ForName(sv.model_precache[modelindex], false); + model = Mod_ForName(sv.strings.model_precache[modelindex], false); if (!model) return 0; @@ -8894,7 +8894,7 @@ void PF_setattachment(progfuncs_t *prinst, struct globalvars_s *pr_globals) if (modelindex > 0 && modelindex < MAX_MODELS) { if (!sv.models[modelindex]) - sv.models[modelindex] = Mod_ForName(sv.model_precache[modelindex], false); + sv.models[modelindex] = Mod_ForName(sv.strings.model_precache[modelindex], false); if (sv.models[modelindex]) { tagidx = SV_TagForName(modelindex, tagname); @@ -8928,7 +8928,7 @@ void PF_gettagindex(progfuncs_t *prinst, struct globalvars_s *pr_globals) if (tagname && tagname[0]) { modelindex = (int)e->v->modelindex; - if (modelindex > 0 && modelindex < MAX_MODELS && sv.model_precache[modelindex]) + if (modelindex > 0 && modelindex < MAX_MODELS && sv.strings.model_precache[modelindex]) { tagidx = SV_TagForName(modelindex, tagname); if (tagidx == 0) @@ -8967,7 +8967,7 @@ void PF_gettaginfo(progfuncs_t *prinst, struct globalvars_s *pr_globals) axis[2] = P_VEC(v_right); if (!model) - model = Mod_FindName(sv.model_precache[(int)ent->v->modelindex]); + model = Mod_FindName(sv.strings.model_precache[(int)ent->v->modelindex]); if (!Mod_GetTag(model, tagnum, ent->v->frame, ent->v->frame, 0, 0, 0, transtag)) { diff --git a/engine/server/savegame.c b/engine/server/savegame.c index 85b5ae6c3..e97095e67 100644 --- a/engine/server/savegame.c +++ b/engine/server/savegame.c @@ -457,14 +457,14 @@ void LoadModelsAndSounds(vfsfile_t *f) char str[32768]; int i; - sv.model_precache[0] = PR_AddString(svprogfuncs, "", 0); + sv.strings.model_precache[0] = PR_AddString(svprogfuncs, "", 0); for (i=1; i < MAX_MODELS; i++) { VFS_GETS(f, str, sizeof(str)); if (!*str) break; - sv.model_precache[i] = PR_AddString(svprogfuncs, str, 0); + sv.strings.model_precache[i] = PR_AddString(svprogfuncs, str, 0); } if (i == MAX_MODELS) { @@ -472,8 +472,8 @@ void LoadModelsAndSounds(vfsfile_t *f) if (*str) SV_Error("Too many model precaches in loadgame cache"); } - for (; i < MAX_SOUNDS; i++) - sv.model_precache[i] = NULL; + for (; i < MAX_MODELS; i++) + sv.strings.model_precache[i] = NULL; // sv.sound_precache[0] = PR_AddString(svprogfuncs, "", 0); for (i=1; i < MAX_SOUNDS; i++) @@ -491,7 +491,7 @@ void LoadModelsAndSounds(vfsfile_t *f) SV_Error("Too many sound precaches in loadgame cache"); } for (; i < MAX_SOUNDS; i++) - *sv.sound_precache[i] = 0; + *sv.strings.sound_precache[i] = 0; } qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers) @@ -631,10 +631,10 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers) for (i=0 ; idelta_sequence != -1) { - fromframe = &client->frames[client->delta_sequence & UPDATE_MASK]; + fromframe = &client->frameunion.frames[client->delta_sequence & UPDATE_MASK]; from = &fromframe->entities; oldmax = from->num_entities; @@ -1015,7 +1015,7 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t client->netchan.incoming_sequence++; // this is the frame that we are going to delta update from - fromframe = &client->frames[(client->netchan.incoming_sequence-2) & UPDATE_MASK]; + fromframe = &client->frameunion.frames[(client->netchan.incoming_sequence-2) & UPDATE_MASK]; from = &fromframe->entities; oldmax = from->num_entities; @@ -1953,10 +1953,10 @@ void SV_GibFilterAdd(char *modelname, int min, int max) int i; gibfilter_t *gf; - for (i=1; sv.model_precache[i] ; i++) - if (!strcmp(sv.model_precache[i], modelname)) + for (i=1; sv.strings.model_precache[i] ; i++) + if (!strcmp(sv.strings.model_precache[i], modelname)) break; - if (!sv.model_precache[i]) + if (!sv.strings.model_precache[i]) { Con_Printf("Filtered model \"%s\" was not precached\n", modelname); return; //model not in use. @@ -2106,7 +2106,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore client_t *split; // this is the frame we are creating - frame = &client->frames[client->netchan.incoming_sequence & UPDATE_MASK]; + frame = &client->frameunion.frames[client->netchan.incoming_sequence & UPDATE_MASK]; // find the client's PVS @@ -2520,7 +2520,7 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore if ((int)ent->v->flags & FL_CLASS_DEPENDENT && client->playerclass) //hexen2 wierdness. { char modname[MAX_QPATH]; - Q_strncpyz(modname, sv.model_precache[state->modelindex], sizeof(modname)); + Q_strncpyz(modname, sv.strings.model_precache[state->modelindex], sizeof(modname)); if (strlen(modname)>5) { modname[strlen(modname)-5] = client->playerclass+'0'; diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index dfe56939f..118f6810a 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -52,16 +52,16 @@ int SV_ModelIndex (char *name) if (!name || !name[0]) return 0; - for (i=1 ; inumsubmodels ; i++) { - sv.model_precache[1+i] = PR_AddString(svprogfuncs, localmodels[i], 0); + sv.strings.model_precache[1+i] = PR_AddString(svprogfuncs, localmodels[i], 0); sv.models[i+1] = Mod_ForName (localmodels[i], false); } @@ -813,11 +813,11 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us #ifdef Q2SERVER else if (svs.gametype == GT_QUAKE2) { - memset(sv.configstring, 0, sizeof(sv.configstring)); - strcpy(sv.configstring[Q2CS_MODELS+1], sv.modelname); + memset(sv.strings.configstring, 0, sizeof(sv.strings.configstring)); + strcpy(sv.strings.configstring[Q2CS_MODELS+1], sv.modelname); for (i=1; inumsubmodels; i++) { - strcpy(sv.configstring[Q2CS_MODELS+1+i], localmodels[i]); + strcpy(sv.strings.configstring[Q2CS_MODELS+1+i], localmodels[i]); sv.models[i+1] = Mod_ForName (localmodels[i], false); } } diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index da4247d6e..535a82438 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -473,10 +473,10 @@ void SV_DropClient (client_t *drop) memset (drop->userinfo, 0, sizeof(drop->userinfo)); memset (drop->userinfobasic, 0, sizeof(drop->userinfobasic)); - if (drop->frames) //union of the same sort of structure + if (drop->frameunion.frames) //union of the same sort of structure { - Z_Free(drop->frames); - drop->frames = NULL; + Z_Free(drop->frameunion.frames); + drop->frameunion.frames = NULL; } if (svs.gametype != GT_PROGS) //gamecode should do it all for us. @@ -639,7 +639,7 @@ int SV_CalcPing (client_t *cl) int count; register client_frame_t *frame; - if (!cl->frames) + if (!cl->frameunion.frames) return 0; switch (cl->protocol) @@ -650,7 +650,7 @@ int SV_CalcPing (client_t *cl) case SCP_QUAKEWORLD: ping = 0; count = 0; - for (frame = cl->frames, i=0 ; iframeunion.frames, i=0 ; iping_time > 0) { @@ -1779,15 +1779,15 @@ client_t *SVC_DirectConnect(void) // build a new connection // accept the new client // this is the only place a client_t is ever initialized - temp.frames = newcl->frames; //don't touch these. - if (temp.frames) - Z_Free(temp.frames); + temp.frameunion.frames = newcl->frameunion.frames; //don't touch these. + if (temp.frameunion.frames) + Z_Free(temp.frameunion.frames); - temp.frames = Z_Malloc((sizeof(client_frame_t)+sizeof(entity_state_t)*maxpacketentities)*UPDATE_BACKUP); + temp.frameunion.frames = Z_Malloc((sizeof(client_frame_t)+sizeof(entity_state_t)*maxpacketentities)*UPDATE_BACKUP); for (i = 0; i < UPDATE_BACKUP; i++) { - temp.frames[i].entities.max_entities = maxpacketentities; - temp.frames[i].entities.entities = (entity_state_t*)(temp.frames+UPDATE_BACKUP) + i*temp.frames[i].entities.max_entities; + temp.frameunion.frames[i].entities.max_entities = maxpacketentities; + temp.frameunion.frames[i].entities.entities = (entity_state_t*)(temp.frameunion.frames+UPDATE_BACKUP) + i*temp.frameunion.frames[i].entities.max_entities; } break; @@ -1805,11 +1805,11 @@ client_t *SVC_DirectConnect(void) // build a new connection // accept the new client // this is the only place a client_t is ever initialized - temp.q2frames = newcl->q2frames; //don't touch these. - if (temp.q2frames) - Z_Free(temp.q2frames); + temp.frameunion.q2frames = newcl->frameunion.q2frames; //don't touch these. + if (temp.frameunion.q2frames) + Z_Free(temp.frameunion.q2frames); - temp.q2frames = Z_Malloc(sizeof(q2client_frame_t)*Q2UPDATE_BACKUP); + temp.frameunion.q2frames = Z_Malloc(sizeof(q2client_frame_t)*Q2UPDATE_BACKUP); break; #endif default: @@ -2010,10 +2010,10 @@ client_t *SVC_DirectConnect(void) newcl->fteprotocolextensions |= PEXT_SPLITSCREEN; - temp.frames = cl->frames; //don't touch these. + temp.frameunion.frames = cl->frameunion.frames; //don't touch these. temp.edict = cl->edict; memcpy(cl, newcl, sizeof(client_t)); - cl->frames = temp.frames; + cl->frameunion.frames = temp.frameunion.frames; cl->edict = temp.edict; cl->fteprotocolextensions |= PEXT_SPLITSCREEN; @@ -2553,7 +2553,7 @@ qboolean SV_FilterPacket (void) int i; unsigned in; - in = *(unsigned *)net_from.ip; + in = *(unsigned *)net_from.address.ip; for (i=0 ; icursize + 6 >= sb->maxsize) break; - MSG_WriteByte(sb, server->adr.ip[0]); - MSG_WriteByte(sb, server->adr.ip[1]); - MSG_WriteByte(sb, server->adr.ip[2]); - MSG_WriteByte(sb, server->adr.ip[3]); + MSG_WriteByte(sb, server->adr.address.ip[0]); + MSG_WriteByte(sb, server->adr.address.ip[1]); + MSG_WriteByte(sb, server->adr.address.ip[2]); + MSG_WriteByte(sb, server->adr.address.ip[3]); MSG_WriteShort(sb, server->adr.port); number++; diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index e5e7273c3..78a9b5977 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -1224,12 +1224,12 @@ static qboolean SV_MVD_Record (mvddest_t *dest) if (!sv.mvdrecording) { memset(&demo, 0, sizeof(demo)); - demo.recorder.frames = demo_frames; + demo.recorder.frameunion.frames = demo_frames; demo.recorder.protocol = SCP_QUAKEWORLD; for (i = 0; i < UPDATE_BACKUP; i++) { - demo.recorder.frames[i].entities.max_entities = MAX_MVDPACKET_ENTITIES; - demo.recorder.frames[i].entities.entities = demo_entities[i]; + demo.recorder.frameunion.frames[i].entities.max_entities = MAX_MVDPACKET_ENTITIES; + demo.recorder.frameunion.frames[i].entities.entities = demo_entities[i]; } MVDBuffer_Init(&demo.dbuffer, demo.buffer, sizeof(demo.buffer)); @@ -1308,7 +1308,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest) MSG_WriteByte (&buf, 0); n = 0; - s = sv.sound_precache[n+1]; + s = sv.strings.sound_precache[n+1]; while (*s) { MSG_WriteString (&buf, s); @@ -1322,7 +1322,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest) MSG_WriteByte (&buf, n + 1); } n++; - s = sv.sound_precache[n+1]; + s = sv.strings.sound_precache[n+1]; } if (buf.cursize) @@ -1338,7 +1338,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest) MSG_WriteByte (&buf, 0); n = 0; - s = sv.model_precache[n+1]; + s = sv.strings.model_precache[n+1]; while (s) { MSG_WriteString (&buf, s); @@ -1352,7 +1352,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest) MSG_WriteByte (&buf, n + 1); } n++; - s = sv.model_precache[n+1]; + s = sv.strings.model_precache[n+1]; } if (buf.cursize) { @@ -1498,7 +1498,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest) { MSG_WriteByte (&buf, svc_lightstyle); MSG_WriteByte (&buf, (char)i); - MSG_WriteString (&buf, sv.lightstyles[i]); + MSG_WriteString (&buf, sv.strings.lightstyles[i]); } // get the client to check and download skins diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index cb034351b..00d57fe58 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -789,11 +789,11 @@ void SV_StartSound (edict_t *entity, int channel, char *sample, int volume, // find precache number for sound for (sound_num=1 ; sound_numnetchan.message,message); - for (i = 1; sv.model_precache[i] ; i++) - MSG_WriteString (&host_client->netchan.message, sv.model_precache[i]); + for (i = 1; sv.strings.model_precache[i] ; i++) + MSG_WriteString (&host_client->netchan.message, sv.strings.model_precache[i]); MSG_WriteByte (&host_client->netchan.message, 0); - for (i = 1; *sv.sound_precache[i] ; i++) - MSG_WriteString (&host_client->netchan.message, sv.sound_precache[i]); + for (i = 1; *sv.strings.sound_precache[i] ; i++) + MSG_WriteString (&host_client->netchan.message, sv.strings.sound_precache[i]); MSG_WriteByte (&host_client->netchan.message, 0); @@ -382,7 +382,7 @@ void SVQ2_ConfigStrings_f (void) while ( host_client->netchan.message.cursize < MAX_QWMSGLEN/2 && start < Q2MAX_CONFIGSTRINGS) { - str = sv.configstring[start]; + str = sv.strings.configstring[start]; if (*str) { MSG_WriteByte (&host_client->netchan.message, svcq2_configstring); @@ -724,11 +724,11 @@ void SV_Soundlist_f (void) else { for (i = 1+n; - *sv.sound_precache[i] && host_client->netchan.message.cursize < (MAX_QWMSGLEN/2); + *sv.strings.sound_precache[i] && host_client->netchan.message.cursize < (MAX_QWMSGLEN/2); i++, n++) - MSG_WriteString (&host_client->netchan.message, sv.sound_precache[i]); + MSG_WriteString (&host_client->netchan.message, sv.strings.sound_precache[i]); - if (!*sv.sound_precache[i]) + if (!*sv.strings.sound_precache[i]) n = 0; } MSG_WriteByte (&host_client->netchan.message, 0); @@ -808,16 +808,16 @@ void SV_Modellist_f (void) else { for (i = 1+n; - i < maxclientsupportedmodels && sv.model_precache[i] && host_client->netchan.message.cursize < (MAX_QWMSGLEN/2); //make sure we don't send a 0 next... + i < maxclientsupportedmodels && sv.strings.model_precache[i] && host_client->netchan.message.cursize < (MAX_QWMSGLEN/2); //make sure we don't send a 0 next... i++) { - MSG_WriteString (&host_client->netchan.message, sv.model_precache[i]); + MSG_WriteString (&host_client->netchan.message, sv.strings.model_precache[i]); if (((n&255)==255) && n != i-1) break; } n = i-1; - if (!sv.model_precache[i]) + if (!sv.strings.model_precache[i]) n = 0; } @@ -1123,24 +1123,24 @@ void SV_Spawn_f (void) else { if (i >= MAX_STANDARDLIGHTSTYLES) - if (!sv.lightstyles[i]) + if (!sv.strings.lightstyles[i]) continue; #ifdef PEXT_LIGHTSTYLECOL - if (host_client->fteprotocolextensions & PEXT_LIGHTSTYLECOL && sv.lightstylecolours[i]!=7) + if (host_client->fteprotocolextensions & PEXT_LIGHTSTYLECOL && sv.strings.lightstylecolours[i]!=7) { ClientReliableWrite_Begin (host_client, svc_lightstylecol, - 3 + (sv.lightstyles[i] ? strlen(sv.lightstyles[i]) : 1)); + 3 + (sv.strings.lightstyles[i] ? strlen(sv.strings.lightstyles[i]) : 1)); ClientReliableWrite_Byte (host_client, (char)i); - ClientReliableWrite_Char (host_client, sv.lightstylecolours[i]); - ClientReliableWrite_String (host_client, sv.lightstyles[i]); + ClientReliableWrite_Char (host_client, sv.strings.lightstylecolours[i]); + ClientReliableWrite_String (host_client, sv.strings.lightstyles[i]); } else #endif { ClientReliableWrite_Begin (host_client, svc_lightstyle, - 3 + (sv.lightstyles[i] ? strlen(sv.lightstyles[i]) : 1)); + 3 + (sv.strings.lightstyles[i] ? strlen(sv.strings.lightstyles[i]) : 1)); ClientReliableWrite_Byte (host_client, (char)i); - ClientReliableWrite_String (host_client, sv.lightstyles[i]); + ClientReliableWrite_String (host_client, sv.strings.lightstyles[i]); } } } @@ -3254,9 +3254,9 @@ void SVNQ_Spawn_f (void) break; //dp7 clients support more lightstyles. ClientReliableWrite_Begin (host_client, svc_lightstyle, - 3 + (sv.lightstyles[i] ? strlen(sv.lightstyles[i]) : 1)); + 3 + (sv.strings.lightstyles[i] ? strlen(sv.strings.lightstyles[i]) : 1)); ClientReliableWrite_Byte (host_client, (char)i); - ClientReliableWrite_String (host_client, sv.lightstyles[i]); + ClientReliableWrite_String (host_client, sv.strings.lightstyles[i]); } // set up the edict @@ -4428,9 +4428,9 @@ void SV_ExecuteClientMessage (client_t *cl) int seq_hash, i; // calc ping time - if (cl->frames) + if (cl->frameunion.frames) { //split screen doesn't always have frames. - frame = &cl->frames[cl->netchan.incoming_acknowledged & UPDATE_MASK]; + frame = &cl->frameunion.frames[cl->netchan.incoming_acknowledged & UPDATE_MASK]; if (cl->lastsequence_acknoledged + UPDATE_BACKUP > cl->netchan.incoming_acknowledged) frame->ping_time = realtime - frame->senttime; //no more phenomanally low pings please @@ -4460,10 +4460,10 @@ void SV_ExecuteClientMessage (client_t *cl) cl->send_message = false; // don't reply, sequences have slipped // save time for ping calculations - if (cl->frames) + if (cl->frameunion.frames) { //split screen doesn't always have frames. - cl->frames[cl->netchan.outgoing_sequence & UPDATE_MASK].senttime = realtime; - cl->frames[cl->netchan.outgoing_sequence & UPDATE_MASK].ping_time = -1; + cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].senttime = realtime; + cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].ping_time = -1; } host_client = cl; @@ -4712,7 +4712,7 @@ void SVQ2_ExecuteClientMessage (client_t *cl) } // calc ping time - frame = &cl->q2frames[cl->netchan.incoming_acknowledged & Q2UPDATE_MASK]; + frame = &cl->frameunion.q2frames[cl->netchan.incoming_acknowledged & Q2UPDATE_MASK]; // make sure the reply sequence number matches the incoming // sequence number @@ -4722,7 +4722,7 @@ void SVQ2_ExecuteClientMessage (client_t *cl) cl->send_message = false; // don't reply, sequences have slipped // save time for ping calculations - cl->q2frames[cl->netchan.outgoing_sequence & Q2UPDATE_MASK].senttime = realtime; + cl->frameunion.q2frames[cl->netchan.outgoing_sequence & Q2UPDATE_MASK].senttime = realtime; // cl->q2frames[cl->netchan.outgoing_sequence & UPDATE_MASK].ping_time = -1; host_client = cl; @@ -4854,7 +4854,7 @@ void SVNQ_ReadClientMove (usercmd_t *move) int bits; client_frame_t *frame; - frame = &host_client->frames[host_client->netchan.incoming_acknowledged & UPDATE_MASK]; + frame = &host_client->frameunion.frames[host_client->netchan.incoming_acknowledged & UPDATE_MASK]; if (host_client->protocol == SCP_DARKPLACES7) host_client->last_sequence = MSG_ReadLong (); @@ -4965,7 +4965,7 @@ void SVNQ_ExecuteClientMessage (client_t *cl) cl->netchan.incoming_acknowledged = cl->netchan.outgoing_sequence-1; // calc ping time - frame = &cl->frames[cl->netchan.incoming_acknowledged & UPDATE_MASK]; + frame = &cl->frameunion.frames[cl->netchan.incoming_acknowledged & UPDATE_MASK]; frame->ping_time = 999; // make sure the reply sequence number matches the incoming @@ -4976,8 +4976,8 @@ void SVNQ_ExecuteClientMessage (client_t *cl) // cl->send_message = false; // don't reply, sequences have slipped // save time for ping calculations - cl->frames[cl->netchan.outgoing_sequence & UPDATE_MASK].senttime = realtime; - cl->frames[cl->netchan.outgoing_sequence & UPDATE_MASK].ping_time = -1; + cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].senttime = realtime; + cl->frameunion.frames[cl->netchan.outgoing_sequence & UPDATE_MASK].ping_time = -1; host_client = cl; sv_player = host_client->edict; diff --git a/engine/server/svq2_ents.c b/engine/server/svq2_ents.c index eeff029e0..83318c5c5 100644 --- a/engine/server/svq2_ents.c +++ b/engine/server/svq2_ents.c @@ -543,7 +543,7 @@ void SV_WriteFrameToClient (client_t *client, sizebuf_t *msg) //Com_Printf ("%i -> %i\n", client->lastframe, sv.framenum); // this is the frame we are creating - frame = &client->q2frames[sv.framenum & Q2UPDATE_MASK]; + frame = &client->frameunion.q2frames[sv.framenum & Q2UPDATE_MASK]; if (client->delta_sequence <= 0) { // client is asking for a retransmit @@ -558,7 +558,7 @@ void SV_WriteFrameToClient (client_t *client, sizebuf_t *msg) } else { // we have a valid message to delta from - oldframe = &client->q2frames[client->delta_sequence & Q2UPDATE_MASK]; + oldframe = &client->frameunion.q2frames[client->delta_sequence & Q2UPDATE_MASK]; lastframe = client->delta_sequence; } @@ -629,7 +629,7 @@ void SV_BuildClientFrame (client_t *client) #endif // this is the frame we are creating - frame = &client->q2frames[sv.framenum & Q2UPDATE_MASK]; + frame = &client->frameunion.q2frames[sv.framenum & Q2UPDATE_MASK]; frame->senttime = realtime; // save it for ping calc later diff --git a/engine/server/svq2_game.c b/engine/server/svq2_game.c index 1e34256bc..361ab508e 100644 --- a/engine/server/svq2_game.c +++ b/engine/server/svq2_game.c @@ -175,7 +175,7 @@ static void VARGS PFQ2_Configstring (int i, char *val) if (!val) val = ""; - strcpy(sv.configstring[i], val); + strcpy(sv.strings.configstring[i], val); if (i == Q2CS_NAME) Q_strncpyz(sv.mapname, val, sizeof(sv.name)); @@ -237,7 +237,7 @@ static int SVQ2_FindIndex (char *name, int start, int max, qboolean create) { int i; int stringlength = MAX_QPATH; - char *strings = sv.configstring[start]; + char *strings = sv.strings.configstring[start]; strings += stringlength; if (!name || !name[0]) diff --git a/engine/server/svq3_game.c b/engine/server/svq3_game.c index 742bc0cff..17244ea9c 100644 --- a/engine/server/svq3_game.c +++ b/engine/server/svq3_game.c @@ -158,7 +158,7 @@ int Q_stricmp(char *a, char *b) { return stricmp(a, b); } -#if MSC_VER < 700 +#if _MSC_VER < 700 int _ftol2 (float f) { return (int)f; @@ -2053,7 +2053,7 @@ void SVQ3_WriteSnapshotToClient(client_t *client, sizebuf_t *msg) int i; // this is a frame we are creating - snap = &client->q3frames[client->netchan.outgoing_sequence & Q3UPDATE_MASK]; + snap = &client->frameunion.q3frames[client->netchan.outgoing_sequence & Q3UPDATE_MASK]; if(client->state < cs_spawned) { @@ -2079,7 +2079,7 @@ void SVQ3_WriteSnapshotToClient(client_t *client, sizebuf_t *msg) { // we have a valid message to delta from delta = client->netchan.outgoing_sequence - client->delta_sequence; - oldsnap = &client->q3frames[client->delta_sequence & Q3UPDATE_MASK]; + oldsnap = &client->frameunion.q3frames[client->delta_sequence & Q3UPDATE_MASK]; if(oldsnap->first_entity <= q3_next_snapshot_entities - q3_num_snapshot_entities) { @@ -2250,7 +2250,7 @@ void SVQ3_BuildClientSnapshot( client_t *client ) ps = PS_FOR_NUM( clientNum ); // this is the frame we are creating - snap = &client->q3frames[client->netchan.outgoing_sequence & Q3UPDATE_MASK]; + snap = &client->frameunion.q3frames[client->netchan.outgoing_sequence & Q3UPDATE_MASK]; snap->serverTime = Sys_DoubleTime()*1000;//svs.levelTime; // save it for ping calc later snap->flags = 0; @@ -2916,8 +2916,8 @@ void SVQ3_DirectConnect(void) //Actually connect the client, use up a slot, and } else { - if (cl->q3frames) - BZ_Free(cl->q3frames); + if (cl->frameunion.q3frames) + BZ_Free(cl->frameunion.q3frames); memset(cl, 0, sizeof(*cl)); challenge = atoi(Info_ValueForKey(userinfo, "challenge")); @@ -2966,7 +2966,7 @@ void SVQ3_DirectConnect(void) //Actually connect the client, use up a slot, and Huff_PreferedCompressionCRC(); - cl->q3frames = BZ_Malloc(Q3UPDATE_BACKUP*sizeof(*cl->q3frames)); + cl->frameunion.q3frames = BZ_Malloc(Q3UPDATE_BACKUP*sizeof(*cl->frameunion.q3frames)); } int SVQ3_AddBot(void) diff --git a/engine/server/world.c b/engine/server/world.c index 2a3e93cfb..c8e85bbbf 100644 --- a/engine/server/world.c +++ b/engine/server/world.c @@ -1062,7 +1062,7 @@ trace_t SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t max if (!model) { //if the model isn't loaded, load it. //this saves on memory requirements with mods that don't ever use this. - model = sv.models[(int)ent->v->modelindex] = Mod_ForName(sv.model_precache[(int)ent->v->modelindex], false); + model = sv.models[(int)ent->v->modelindex] = Mod_ForName(sv.strings.model_precache[(int)ent->v->modelindex], false); } if (model && model->funcs.Trace) diff --git a/engine/sw/r_surf.c b/engine/sw/r_surf.c index a2229d262..a220e22d2 100644 --- a/engine/sw/r_surf.c +++ b/engine/sw/r_surf.c @@ -909,9 +909,9 @@ void SWR_BuildLightMapRGB (void) { for (y = 0; y < smax; y++, i+=3, stain++) { - r = (255*256*256-127*256-(int)blocklights[i]*(*stain)) >> 16 - VID_CBITS; - g = (255*256*256-127*256-(int)blocklights[i+1]*(*stain)) >> 16 - VID_CBITS; - b = (255*256*256-127*256-(int)blocklights[i+2]*(*stain)) >> 16 - VID_CBITS; + r = (255*256*256-127*256-(int)blocklights[i]*(*stain)) >> (16 - VID_CBITS); + g = (255*256*256-127*256-(int)blocklights[i+1]*(*stain)) >> (16 - VID_CBITS); + b = (255*256*256-127*256-(int)blocklights[i+2]*(*stain)) >> (16 - VID_CBITS); #define MINL (1<<6) #define MAXL ((255*256) >> (8 - VID_CBITS))