From d507a10397674dde1a8518614c79142a9cd63eb1 Mon Sep 17 00:00:00 2001 From: terminx Date: Fri, 3 Oct 2008 10:28:17 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1088 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/duke3d.h | 3 +- polymer/eduke32/source/game.c | 39 +++++++------ polymer/eduke32/source/namesdyn.c | 92 ------------------------------- polymer/eduke32/source/osdcmds.c | 2 +- polymer/eduke32/source/player.c | 20 +++++-- 5 files changed, 40 insertions(+), 116 deletions(-) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 782fdfcc7..90a4201a0 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -285,9 +285,10 @@ enum USRHOOKS_Errors { }; typedef struct { - unsigned int bits, extbits; + unsigned int bits; short fvel, svel; signed char avel, horz; + unsigned char extbits; } input_t; #define sync dsync // JBF 20040604: sync is a function on some platforms diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3ed54f022..e5bbe07e9 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -590,12 +590,12 @@ void getpackets(void) { if (g_player[i].playerquitflag == 0) continue; - l = packbuf[k++]; - l += (int)(packbuf[k++]<<8); + l = packbuf[k]+(int)(packbuf[k+1]<<8); + k += 2; if (i == myconnectindex) { - j += ((l&1)<<1)+(l&2)+((l&4)>>2)+((l&8)>>3)+((l&16)>>4)+((l&32)>>5)+((l&64)>>6)+((l&128)>>7)+((l&256)>>8)+((l&512)>>9)+((l&1024)>>10)+((l&2048)>>11); + j += ((l&1)<<1)+(l&2)+((l&4)>>2)+((l&8)>>3)+((l&16)>>4)+((l&32)>>5)+((l&64)>>6)+((l&128)>>7)+((l&256)>>8)/*+((l&512)>>9)+((l&1024)>>10)+((l&2048)>>11)*/; continue; } @@ -608,10 +608,11 @@ void getpackets(void) if (l&32) nsyn[i].bits = ((nsyn[i].bits&0xff00ffff)|((int)packbuf[j++])<<16); if (l&64) nsyn[i].bits = ((nsyn[i].bits&0x00ffffff)|((int)packbuf[j++])<<24); if (l&128) nsyn[i].horz = (signed char)packbuf[j++]; - if (l&256) nsyn[i].extbits = ((nsyn[i].extbits&0xffffff00)|((int)packbuf[j++])); + if (l&256) nsyn[i].extbits = (unsigned char)packbuf[j++]; +/* if (l&256) nsyn[i].extbits = ((nsyn[i].extbits&0xffffff00)|((int)packbuf[j++])); if (l&512) nsyn[i].extbits = ((nsyn[i].extbits&0xffff00ff)|((int)packbuf[j++])<<8); if (l&1024) nsyn[i].extbits = ((nsyn[i].extbits&0xff00ffff)|((int)packbuf[j++])<<16); - if (l&2048) nsyn[i].extbits = ((nsyn[i].extbits&0x00ffffff)|((int)packbuf[j++])<<24); + if (l&2048) nsyn[i].extbits = ((nsyn[i].extbits&0x00ffffff)|((int)packbuf[j++])<<24); */ if (nsyn[i].bits&(1<<26)) g_player[i].playerquitflag = 0; g_player[i].movefifoend++; @@ -655,10 +656,11 @@ void getpackets(void) if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((int)packbuf[j++])<<16); if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((int)packbuf[j++])<<24); if (k&128) nsyn[other].horz = (signed char)packbuf[j++]; - if (k&256) nsyn[other].extbits = ((nsyn[other].extbits&0xffffff00)|((int)packbuf[j++])); + if (k&256) nsyn[other].extbits = (unsigned char)packbuf[j++]; +/* if (k&256) nsyn[other].extbits = ((nsyn[other].extbits&0xffffff00)|((int)packbuf[j++])); if (k&512) nsyn[other].extbits = ((nsyn[other].extbits&0xffff00ff)|((int)packbuf[j++])<<8); if (k&1024) nsyn[other].extbits = ((nsyn[other].extbits&0xff00ffff)|((int)packbuf[j++])<<16); - if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((int)packbuf[j++])<<24); + if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((int)packbuf[j++])<<24); */ g_player[other].movefifoend++; while (j != packbufleng) @@ -694,8 +696,8 @@ void getpackets(void) nsyn = (input_t *)&inputfifo[(g_player[other].movefifoend)&(MOVEFIFOSIZ-1)][0]; copybufbyte(&osyn[other],&nsyn[other],sizeof(input_t)); - k = packbuf[j++]; - k += (int)(packbuf[j++]<<8); + k = packbuf[j] + (int)(packbuf[j+1]<<8); + j += 2; if (k&1) nsyn[other].fvel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; if (k&2) nsyn[other].svel = packbuf[j]+((short)packbuf[j+1]<<8), j += 2; @@ -705,10 +707,11 @@ void getpackets(void) if (k&32) nsyn[other].bits = ((nsyn[other].bits&0xff00ffff)|((int)packbuf[j++])<<16); if (k&64) nsyn[other].bits = ((nsyn[other].bits&0x00ffffff)|((int)packbuf[j++])<<24); if (k&128) nsyn[other].horz = (signed char)packbuf[j++]; - if (k&256) nsyn[other].extbits = ((nsyn[other].extbits&0xffffff00)|((int)packbuf[j++])); + if (k&256) nsyn[other].extbits = (unsigned char)packbuf[j++]; +/* if (k&256) nsyn[other].extbits = ((nsyn[other].extbits&0xffffff00)|((int)packbuf[j++])); if (k&512) nsyn[other].extbits = ((nsyn[other].extbits&0xffff00ff)|((int)packbuf[j++])<<8); if (k&1024) nsyn[other].extbits = ((nsyn[other].extbits&0xff00ffff)|((int)packbuf[j++])<<16); - if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((int)packbuf[j++])<<24); + if (k&2048) nsyn[other].extbits = ((nsyn[other].extbits&0x00ffffff)|((int)packbuf[j++])<<24); */ g_player[other].movefifoend++; for (i=movesperpacket-1;i>=1;i--) @@ -1157,10 +1160,11 @@ void faketimerhandler(void) } // k++; packbuf[++k] = 0; - if ((nsyn[0].extbits^osyn[0].extbits)&0x000000ff) packbuf[j++] = (nsyn[0].extbits&255), packbuf[k] |= 1; + if (nsyn[0].extbits != osyn[0].extbits) packbuf[j++] = nsyn[0].extbits, packbuf[k] |= 1; +/* if ((nsyn[0].extbits^osyn[0].extbits)&0x000000ff) packbuf[j++] = (nsyn[0].extbits&255), packbuf[k] |= 1; if ((nsyn[0].extbits^osyn[0].extbits)&0x0000ff00) packbuf[j++] = ((nsyn[0].extbits>>8)&255), packbuf[k] |= 2; if ((nsyn[0].extbits^osyn[0].extbits)&0x00ff0000) packbuf[j++] = ((nsyn[0].extbits>>16)&255), packbuf[k] |= 4; - if ((nsyn[0].extbits^osyn[0].extbits)&0xff000000) packbuf[j++] = ((nsyn[0].extbits>>24)&255), packbuf[k] |= 8; + if ((nsyn[0].extbits^osyn[0].extbits)&0xff000000) packbuf[j++] = ((nsyn[0].extbits>>24)&255), packbuf[k] |= 8; */ while (g_player[myconnectindex].syncvalhead != syncvaltail) { @@ -1227,10 +1231,11 @@ void faketimerhandler(void) packbuf[1] |= 128; } packbuf[2] = 0; - if ((nsyn[0].extbits^osyn[0].extbits)&0x000000ff) packbuf[j++] = (nsyn[0].extbits&255), packbuf[2] |= 1; + if (nsyn[0].extbits != osyn[0].extbits) packbuf[j++] = nsyn[0].extbits, packbuf[2] |= 1; +/* if ((nsyn[0].extbits^osyn[0].extbits)&0x000000ff) packbuf[j++] = (nsyn[0].extbits&255), packbuf[2] |= 1; if ((nsyn[0].extbits^osyn[0].extbits)&0x0000ff00) packbuf[j++] = ((nsyn[0].extbits>>8)&255), packbuf[2] |= 2; if ((nsyn[0].extbits^osyn[0].extbits)&0x00ff0000) packbuf[j++] = ((nsyn[0].extbits>>16)&255), packbuf[2] |= 4; - if ((nsyn[0].extbits^osyn[0].extbits)&0xff000000) packbuf[j++] = ((nsyn[0].extbits>>24)&255), packbuf[2] |= 8; + if ((nsyn[0].extbits^osyn[0].extbits)&0xff000000) packbuf[j++] = ((nsyn[0].extbits>>24)&255), packbuf[2] |= 8; */ while (g_player[myconnectindex].syncvalhead != syncvaltail) { @@ -1311,10 +1316,12 @@ void faketimerhandler(void) } k++; packbuf[k] = 0; + if (nsyn[i].extbits != osyn[i].extbits) packbuf[j++] = nsyn[i].extbits, packbuf[k] |= 1; + /* if ((nsyn[i].extbits^osyn[i].extbits)&0x000000ff) packbuf[j++] = (nsyn[i].extbits&255), packbuf[k] |= 1; if ((nsyn[i].extbits^osyn[i].extbits)&0x0000ff00) packbuf[j++] = ((nsyn[i].extbits>>8)&255), packbuf[k] |= 2; if ((nsyn[i].extbits^osyn[i].extbits)&0x00ff0000) packbuf[j++] = ((nsyn[i].extbits>>16)&255), packbuf[k] |= 4; - if ((nsyn[i].extbits^osyn[i].extbits)&0xff000000) packbuf[j++] = ((nsyn[i].extbits>>24)&255), packbuf[k] |= 8; + if ((nsyn[i].extbits^osyn[i].extbits)&0xff000000) packbuf[j++] = ((nsyn[i].extbits>>24)&255), packbuf[k] |= 8; */ k++; } diff --git a/polymer/eduke32/source/namesdyn.c b/polymer/eduke32/source/namesdyn.c index d908df6ff..48b01c122 100644 --- a/polymer/eduke32/source/namesdyn.c +++ b/polymer/eduke32/source/namesdyn.c @@ -1581,95 +1581,3 @@ void setupdynamictostatic(void) weapon_sprites[10] = HEAVYHBOMB; weapon_sprites[11] = SHRINKERSPRITE; } - -/* -void readnames() { - char buffer[1024], *p, *name, *number, *endptr; - int num, syms=0, line=0, a; - BFILE *fp; - - fp = fopenfrompath("NAMES.H","r"); - if (!fp) { - if ((fp = fopenfrompath("names.h","r")) == NULL) { - initprintf("Failed to open NAMES.H\n"); - return; - } - } - - //clearbufbyte(names, sizeof(names), 0); - //memset(names,0,sizeof(names)); - - initprintf("Loading NAMES.H\n"); - - while (Bfgets(buffer, 1024, fp)) { - a = Bstrlen(buffer); - if (a >= 1) { - if (a > 1) - if (buffer[a-2] == '\r') buffer[a-2] = 0; - if (buffer[a-1] == '\n') buffer[a-1] = 0; - } - - p = buffer; - line++; - while (*p == 32) p++; - if (*p == 0) continue; // blank line - - if (*p == '#') { - p++; - while (*p == 32) p++; - if (*p == 0) continue; // null directive - - else if (!Bstrncmp(p, "define ", 7)) { - // #define_... - p += 7; - while (*p == 32) p++; - if (*p == 0) { - initprintf("Error: Malformed #define at line %d\n", line-1); - continue; - } - - name = p; - while (*p != 32 && *p != 0) p++; - if (*p == 32) { - *(p++) = 0; - while (*p == 32) p++; - if (*p == 0) { // #define_NAME with no number - initprintf("Error: No number given for name \"%s\" (line %d)\n", name, line-1); - continue; - } - - number = p; - while (*p != 0) p++; - if (*p != 0) *p = 0; - - // add to list - num = Bstrtol(number, &endptr, 10); - if (*endptr != 0) { - p = endptr; - goto badline; - } - //initprintf("Grokked \"%s\" -> \"%d\"\n", name, num); - if (num < 0 || num >= MAXTILES) { - initprintf("Error: Constant %d for name \"%s\" out of range (line %d)\n", num, name, line-1); - continue; - } - processnames(name,num); - syms++; - - continue; - - } else { // #define_NAME with no number - initprintf("Error: No number given for name \"%s\" (line %d)\n", name, line-1); - continue; - } - } else goto badline; - } else if (*p == '/') { - if (*(p+1) == '/') continue; // comment - } -badline: - initprintf("Error: Invalid statement found at character %d on line %d\n", (p-buffer), line-1); - } - initprintf("Read %d lines, loaded %d names.\n", line, syms); - Bfclose(fp); -} -*/ diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index c53108a9a..09381400e 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1480,7 +1480,7 @@ int registerosdcommands(void) OSD_RegisterFunction("restartvid","restartvid: reinitializes the video mode",osdcmd_restartvid); OSD_RegisterFunction("r_ambientlight", "r_ambientlight: sets the global map light level",osdcmd_visibility); - OSD_RegisterFunction("r_maxfps", "r_maxfps: sets a fps cap",osdcmd_maxfps); + OSD_RegisterFunction("r_maxfps", "r_maxfps: sets a framerate cap",osdcmd_maxfps); OSD_RegisterFunction("sensitivity","sensitivity : changes the mouse sensitivity", osdcmd_sensitivity); OSD_RegisterFunction("addlogvar","addlogvar : prints the value of a gamevar", osdcmd_addlogvar); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index a7b01b9ee..a4161ecaa 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "duke3d.h" #include "osd.h" +#include "gamedef.h" int g_currentweapon; int g_gun_pos; @@ -3026,12 +3027,19 @@ void getinput(int snum) if (horiz < -MAXHORIZ) horiz = -MAXHORIZ; if (horiz > MAXHORIZ) horiz = MAXHORIZ; - loc.extbits = BUTTON(gamefunc_Move_Forward); - loc.extbits |= BUTTON(gamefunc_Move_Backward)<<1; - loc.extbits |= BUTTON(gamefunc_Strafe_Left)<<2; - loc.extbits |= BUTTON(gamefunc_Strafe_Right)<<3; - loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4; - loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5; + if(apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEFORWARD]) + loc.extbits = BUTTON(gamefunc_Move_Forward); + if(apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_MOVEBACKWARD]) + loc.extbits |= BUTTON(gamefunc_Move_Backward)<<1; + if(apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFELEFT]) + loc.extbits |= BUTTON(gamefunc_Strafe_Left)<<2; + if(apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_STRAFERIGHT]) + loc.extbits |= BUTTON(gamefunc_Strafe_Right)<<3; + if(apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNLEFT]) + loc.extbits |= BUTTON(gamefunc_Turn_Left)<<4; + if(apScriptGameEvent[EVENT_PROCESSINPUT] || apScriptGameEvent[EVENT_TURNRIGHT]) + loc.extbits |= BUTTON(gamefunc_Turn_Right)<<5; + // used for changing team loc.extbits |= (g_player[snum].pteam != g_player[snum].ps->team)<<6; if (ud.scrollmode && ud.overhead_on)