From 23dbb55689a629818c0c5d26621590f24d670aac Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 26 Feb 2007 01:46:38 +0000 Subject: [PATCH] Bug fixes git-svn-id: https://svn.eduke32.com/eduke32@508 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/build.c | 8 +-- polymer/build/src/engine.c | 2 +- polymer/eduke32/source/astub.c | 84 ++++++++++++++++++------------- polymer/eduke32/source/game.c | 37 ++++++++------ polymer/eduke32/source/gamevars.c | 8 +-- polymer/eduke32/source/menus.c | 4 +- polymer/eduke32/source/osdcmds.c | 2 +- polymer/eduke32/source/player.c | 5 +- 8 files changed, 86 insertions(+), 64 deletions(-) diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 1ed2b819d..5ace7c5ec 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -578,10 +578,10 @@ void editinput(void) osearchy = searchy; searchx += mousx; searchy += mousy; - if (searchx < 8) searchx = 8; - if (searchy < 8) searchy = 8; - if (searchx > xdim-9) searchx = xdim-9; - if (searchy > ydim-9) searchy = ydim-9; + if (searchx < 12) searchx = 12; + if (searchy < 12) searchy = 12; + if (searchx > xdim-13) searchx = xdim-13; + if (searchy > ydim-13) searchy = ydim-13; } showmouse(); diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 2902c2eaa..252bd4e84 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -2510,7 +2510,7 @@ static void parascan(long dax1, long dax2, long sectnum, char dastat, long bunch x++; } if (j <= x) - wallscan(j,x,topptr,botptr,swplc,lplc); + wallscan(j,x-1,topptr,botptr,swplc,lplc); } globalpicnum = l; } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index a91a770f0..127d82dea 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -1574,13 +1574,11 @@ static void message(char message[162]) static char lockbyte4094; -long lastupdate, mousecol, mouseadd = 1, bstatus; +static long lastupdate, mousecol, mouseadd = 1, bstatus; static void m32_showmouse(void) { - int i, j, col; - - j = (xdimgame > 640); + int i, col; if (totalclock > lastupdate) { @@ -1608,26 +1606,37 @@ static void m32_showmouse(void) if (col != whitecol) { - for (i=(j?3:2);i<=(j?7:3);i++) + for (i=((xdim > 640)?3:2);i<=((xdim > 640)?7:3);i++) { plotpixel(searchx+i,searchy,col); plotpixel(searchx-i,searchy,col); plotpixel(searchx,searchy-i,col); plotpixel(searchx,searchy+i,col); } - for (i=1;i<=(j?2:1);i++) + for (i=1;i<=((xdim > 640)?2:1);i++) { plotpixel(searchx+i,searchy,whitecol); plotpixel(searchx-i,searchy,whitecol); plotpixel(searchx,searchy-i,whitecol); plotpixel(searchx,searchy+i,whitecol); } - i=(j?8:4); + i=((xdim > 640)?8:4); plotpixel(searchx+i,searchy,0); plotpixel(searchx-i,searchy,0); plotpixel(searchx,searchy-i,0); plotpixel(searchx,searchy+i,0); } + + if (xdim > 640) + { + for (i=1;i<=4;i++) + { + plotpixel(searchx+i,searchy,whitecol); + plotpixel(searchx-i,searchy,whitecol); + plotpixel(searchx,searchy-i,whitecol); + plotpixel(searchx,searchy+i,whitecol); + } + } } static int AskIfSure(void) @@ -2993,7 +3002,7 @@ static void Keys3d(void) if (framerateon) { int p = 8; - + Bsprintf(tempbuf,"%ld",rate); if (rate > 9) p += 8; if (rate > 99) p += 8; @@ -3001,7 +3010,7 @@ static void Keys3d(void) if (xdimgame <= 640) p >>= 1; begindrawing(); - printext256(xdimgame-p-1,2,0,-1,tempbuf,!(xdimgame > 640)); + printext256(xdimgame-p-1,2,0,-1,tempbuf,!(xdimgame > 640)); printext256(xdimgame-p-2,1,rate < 40?248:whitecol,-1,tempbuf,!(xdimgame > 640)); enddrawing(); } @@ -4423,7 +4432,7 @@ static int getatoken(scriptfile *sf, tokenlist *tl, int ntokens) static tokenlist grptokens[] = { - { "include", T_INCLUDE }, + { "include", T_INCLUDE }, { "loadgrp", T_LOADGRP }, }; @@ -4458,14 +4467,18 @@ int loadgroupfiles(char *fn) case T_INCLUDE: { char *fn; - if (!scriptfile_getstring(script,&fn)) { + if (!scriptfile_getstring(script,&fn)) + { scriptfile *included; included = scriptfile_fromfile(fn); - if (!included) { + if (!included) + { initprintf("Warning: Failed including %s on line %s:%d\n", fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } else { + } + else + { loadgroupfiles((char *)included); scriptfile_close(included); } @@ -4491,6 +4504,16 @@ int ExtInit(void) long rv = 0; char cwd[BMAX_PATH]; +#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) + addsearchpath("/usr/share/games/jfduke3d"); + addsearchpath("/usr/local/share/games/jfduke3d"); + addsearchpath("/usr/share/games/eduke32"); + addsearchpath("/usr/local/share/games/eduke32"); +#elif defined(__APPLE__) + addsearchpath("/Library/Application Support/JFDuke3D"); + addsearchpath("/Library/Application Support/EDuke32"); +#endif + if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd); if (CommandPaths) @@ -4510,23 +4533,13 @@ int ExtInit(void) #if defined(_WIN32) if (!access("user_profiles_enabled", F_OK)) #else - if (usecwd == 0) + if (usecwd == 0 && access("user_profiles_disabled", F_OK)) #endif { char cwd[BMAX_PATH]; char *homedir; int asperr; -#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) - addsearchpath("/usr/share/games/jfduke3d"); - addsearchpath("/usr/local/share/games/jfduke3d"); - addsearchpath("/usr/share/games/eduke32"); - addsearchpath("/usr/local/share/games/eduke32"); -#elif defined(__APPLE__) - addsearchpath("/Library/Application Support/JFDuke3D"); - addsearchpath("/Library/Application Support/EDuke32"); -#endif - if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd); if ((homedir = Bgethomedir())) { Bsnprintf(cwd,sizeof(cwd),"%s/" @@ -4560,20 +4573,20 @@ int ExtInit(void) Bsprintf(tempbuf,"autoload/%s",duke3dgrp); getfilenames(tempbuf,"*.grp"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } Bsprintf(tempbuf,"autoload/%s",duke3dgrp); getfilenames(tempbuf,"*.zip"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } Bsprintf(tempbuf,"autoload/%s",duke3dgrp); getfilenames(tempbuf,"*.pk3"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } - + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + getfilenames("autoload","*.grp"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } getfilenames("autoload","*.zip"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } getfilenames("autoload","*.pk3"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } if (getenv("DUKE3DDEF")) { @@ -4587,7 +4600,7 @@ int ExtInit(void) #if defined(POLYMOST) && defined(USE_OPENGL) glusetexcache = glusetexcachecompression = -1; - initprintf("Using config file %s.\n",setupfilename); + initprintf("Using config file '%s'.\n",setupfilename); if (loadsetup(setupfilename) < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1; if (glusetexcache == -1 || glusetexcachecompression == -1) @@ -4889,8 +4902,11 @@ void ExtCheckKeys(void) if (qsetmode == 200) //In 3D mode { Keys3d(); - m32_showmouse(); - if (sidemode != 1) editinput(); + if (sidemode != 1) + { + editinput(); + m32_showmouse(); + } return; } Keys2d(); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 8970f5435..acd02c079 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -211,7 +211,7 @@ static void patchstatusbar(long x1, long y1, long x2, long y2) clofy = (ydim - scale(ydim,ud.statusbarscale,100)); // if (ud.statusbarmode == 0) - rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1+clofx,cly1+clofy,clx2+clofx-1,cly2+clofy-1); + rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1+clofx,cly1+clofy,clx2+clofx-1,cly2+clofy-1); // else rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1,cly1,clx2+clofx-1,cly2+clofy-1); } @@ -2337,13 +2337,13 @@ static void tics(void) // minitext(scale(windowx1,320,xdim)+1,scale(windowy1,200,ydim)+1,b,(timer*AVERAGEFRAMES)/(i-frameval[framecnt]) < 40?2:0,26); ii = scale(k,ydim,200)+windowy1; - + if (j > 9) p += 8; if (j > 99) p += 8; if (j > 999) p += 8; if (xdim <= 640) p >>= 1; - printext256(windowx2-p+1,ii+2,0,-1,b,!(xdim > 640)); + printext256(windowx2-p+1,ii+2,0,-1,b,!(xdim > 640)); printext256(windowx2-p,ii+1,(timer*AVERAGEFRAMES)/(i-frameval[framecnt]) < 40?248:31,-1,b,!(xdim > 640)); if (numplayers > 1) @@ -4009,7 +4009,7 @@ void displayrooms(int snum,long smoothratio) { if (ud.viewbob) ud.cameraz += p->opyoff+mulscale16((long)(p->pyoff-p->opyoff),smoothratio); - } + } else view(p,&ud.camerax,&ud.cameray,&ud.cameraz,&ud.camerasect,ud.cameraang,ud.camerahoriz); cz = hittype[p->i].ceilingz; @@ -8159,6 +8159,7 @@ static void comlinehelp(void) "-NUM\t\tLoad and run a game from slot NUM (0-9)\n" "-a\t\tUse fake player AI (fake multiplayer only)\n" "-cNUM\t\tUse MP mode NUM, 1 = DukeMatch(spawn), 2 = Coop, 3 = Dukematch(no spawn)\n" + "-cfg FILE\tUse configuration file FILE\n" "-dFILE\t\tStart to play demo FILE\n" /* "-fNUM\t\tSend fewer packets in multiplayer (1, 2, 4) (deprecated)\n" */ "-game_dir DIR\tSee -j\n" @@ -8425,14 +8426,18 @@ static int loadgroupfiles(const char *fn) case T_INCLUDE: { char *fn; - if (!scriptfile_getstring(script,&fn)) { + if (!scriptfile_getstring(script,&fn)) + { scriptfile *included; included = scriptfile_fromfile(fn); - if (!included) { + if (!included) + { initprintf("Warning: Failed including %s on line %s:%d\n", fn, script->filename,scriptfile_getlinum(script,cmdtokptr)); - } else { + } + else + { loadgroupfiles((const char *)included); scriptfile_close(included); } @@ -9762,7 +9767,7 @@ void app_main(int argc,char **argv) #if defined(_WIN32) if (!access("user_profiles_enabled", F_OK)) #else - if (usecwd == 0) + if (usecwd == 0 && access("user_profiles_disabled", F_OK)) #endif { char *homedir; @@ -9936,21 +9941,21 @@ void app_main(int argc,char **argv) Bsprintf(tempbuf,"autoload/%s",duke3dgrp); getfilenames(tempbuf,"*.grp"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } +while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } Bsprintf(tempbuf,"autoload/%s",duke3dgrp); getfilenames(tempbuf,"*.zip"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } Bsprintf(tempbuf,"autoload/%s",duke3dgrp); getfilenames(tempbuf,"*.pk3"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } - + while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",duke3dgrp,findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + getfilenames("autoload","*.grp"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } getfilenames("autoload","*.zip"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } getfilenames("autoload","*.pk3"); - while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } - + while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); initprintf("Using group file '%s'.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } + loadgroupfiles(duke3ddef); { diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 2a35c1286..a484f15f9 100755 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -1172,20 +1172,20 @@ static void AddSystemVars() AddGameVar("myxvel",(long)&myxvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myyvel",(long)&myyvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myzvel",(long)&myzvel, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PLONG | GAMEVAR_FLAG_SYNCCHECK); - + AddGameVar("myhoriz",(long)&myhoriz, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myhorizoff",(long)&myhorizoff, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("omyhoriz",(long)&omyhoriz, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); - AddGameVar("omyhorizoff",(long)&omyhorizoff, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); + AddGameVar("omyhorizoff",(long)&omyhorizoff, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myang",(long)&myang, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("omyang",(long)&omyang, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("mycursectnum",(long)&mycursectnum, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myjumpingcounter",(long)&myjumpingcounter, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PSHORT | GAMEVAR_FLAG_SYNCCHECK); - + AddGameVar("myjumpingtoggle",(long)&myjumpingtoggle, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myonground",(long)&myonground, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); AddGameVar("myhardlanding",(long)&myhardlanding, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); - AddGameVar("myreturntocenter",(long)&myreturntocenter, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); + AddGameVar("myreturntocenter",(long)&myreturntocenter, GAMEVAR_FLAG_SYSTEM | GAMEVAR_FLAG_PCHAR | GAMEVAR_FLAG_SYNCCHECK); } void InitGameVars(void) diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 1b59d3d28..306743fb2 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -2457,9 +2457,9 @@ cheat_for_port_credits: } if (glanisotropy == 1) strcpy(tempbuf,"NONE"); else sprintf(tempbuf,"%ldx",glanisotropy); - gametextpal(d,yy, tempbuf, MENUHIGHLIGHT(io), 0); + gametextpal(d,yy, tempbuf, MENUHIGHLIGHT(io), 0); break; - + case 2: if (x==io) usehightile = 1-usehightile; modval(0,1,(int *)&usehightile,1,probey==io); diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index b32b0bdac..a5daae25a 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -639,7 +639,7 @@ cvar[] = { "cl_showcoords", "cl_showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 }, { "cl_showfps", "cl_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 }, { "cl_smoothinput", "cl_smoothinput: enable/disable input smoothing\n", (void*)&SmoothInput, CVAR_BOOL, 0, 0, 1 }, - + { "cl_viewbob", "cl_viewbob: enable/disable player head bobbing\n", (void*)&ud.viewbob, CVAR_BOOL, 0, 0, 1 }, { "cl_weaponsway", "cl_weaponsway: enable/disable player weapon swaying\n", (void*)&ud.weaponsway, CVAR_BOOL, 0, 0, 1 }, diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 2ad7bfd1a..c17d15868 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2137,7 +2137,7 @@ void displayweapon(int snum) gun_pos = 80-(p->weapon_pos*p->weapon_pos); weapon_xoffset = (160)-90; - + if (ud.weaponsway) { weapon_xoffset -= (sintable[((p->weapon_sway>>1)+512)&2047]/(1024+512)); @@ -2145,7 +2145,8 @@ void displayweapon(int snum) if (sprite[p->i].xrepeat < 32) gun_pos -= klabs(sintable[(p->weapon_sway<<2)&2047]>>9); else gun_pos -= klabs(sintable[(p->weapon_sway>>1)&2047]>>10); - } else gun_pos -= 16; + } + else gun_pos -= 16; weapon_xoffset -= 58 + p->weapon_ang; gun_pos -= (p->hard_landing<<3);