From bfa46aa711cd15f1108e01f32e2501199cbbe9b7 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 14 May 2006 21:15:55 +0000 Subject: [PATCH] More weapon changes + don't apply ratio correction to HUD models (because people are whiners) git-svn-id: https://svn.eduke32.com/eduke32@168 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/polymost.c | 11 +++--- polymer/eduke32/source/gamedef.c | 2 +- polymer/eduke32/source/gameexec.c | 3 +- polymer/eduke32/source/player.c | 63 ++++++++++++++++--------------- 4 files changed, 41 insertions(+), 38 deletions(-) diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 5fb18bf76..3ca91b39c 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -4043,9 +4043,10 @@ void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum, if ((dastat&10) == 2) { - ratioratio = 1.6 / (((float)(windowx2-windowx1+1)) / (windowy2-windowy1)); // computes the ratio between 16/10 and current resolution ratio - fovcorrect = (ratioratio > 1) ? (((windowx2-windowx1+1) * ratioratio) - windowx2-windowx1+1) * ((float)glratiocorrection / 63) * 2 : 0; - bglViewport(windowx1 - (fovcorrect / 2),yres-(windowy2+1),windowx2-windowx1+1 + fovcorrect,windowy2-windowy1+1); +// ratioratio = 1.6 / (((float)(windowx2-windowx1+1)) / (windowy2-windowy1)); // computes the ratio between 16/10 and current resolution ratio +// fovcorrect = (ratioratio > 1) ? (((windowx2-windowx1+1) * ratioratio) - windowx2-windowx1+1) * ((float)glratiocorrection / 63) * 2 : 0; +// bglViewport(windowx1 - (fovcorrect / 2),yres-(windowy2+1),windowx2-windowx1+1 + fovcorrect,windowy2-windowy1+1); + bglViewport(windowx1,yres-(windowy2+1),windowx2-windowx1+1,windowy2-windowy1+1); } else { @@ -4057,9 +4058,9 @@ void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum, memset(m,0,sizeof(m)); if ((dastat&10) == 2) { - m[0][0] = (float)ydimen / ((ratioratio > 1)?1.2:1); m[0][2] = 1.0; + m[0][0] = (float)ydimen/* / ((ratioratio > 1)?1.2:1)*/; m[0][2] = 1.0; m[1][1] = (float)xdimen; m[1][2] = 1.0; - m[2][2] = 1.0; m[2][3] = (float)ydimen / ((ratioratio > 1)?1.2:1); + m[2][2] = 1.0; m[2][3] = (float)ydimen/* / ((ratioratio > 1)?1.2:1)*/; m[3][2] =-1.0; } else { m[0][0] = m[2][3] = 1.0; m[1][1] = ((float)xdim)/((float)ydim); m[2][2] = 1.0001; m[3][2] = 1-m[2][2]; } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index ff5123b98..af0f1e228 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -5075,7 +5075,7 @@ void AddSystemVars() Bsprintf(aszBuf,"WEAPON%d_TOTALTIME",CHAINGUN_WEAPON); AddGameVar(aszBuf, 12, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_HOLDDELAY",CHAINGUN_WEAPON); - AddGameVar(aszBuf, 0, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); + AddGameVar(aszBuf, 3, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_FLAGS",CHAINGUN_WEAPON); AddGameVar(aszBuf, WEAPON_FLAG_AUTOMATIC | WEAPON_FLAG_FIREEVERYTHIRD | WEAPON_FLAG_AMMOPERSHOT | WEAPON_FLAG_SPAWNTYPE3 | WEAPON_FLAG_RESET, GAMEVAR_FLAG_PERPLAYER | GAMEVAR_FLAG_SYSTEM); Bsprintf(aszBuf,"WEAPON%d_SHOOTS",CHAINGUN_WEAPON); diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index f4c253687..b5ba7d73d 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4538,8 +4538,7 @@ SKIPJIBS: insptr++; if(g_sp->sectnum >= 0 && g_sp->sectnum < MAXSECTORS) - lReturn = shoot(g_i,*insptr); - insptr++; + lReturn = shoot(g_i,*insptr++); SetGameVarID(g_iReturnVarID, lReturn, g_i, g_p); break; } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index be9e7855e..842c80e57 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -361,7 +361,7 @@ short aim(spritetype *s,short aang,short atwith) short shoot(short i,short atwith) { - short sect, hitsect, hitspr, hitwall, l, sa, p, j, k, wh, scount; + short sect, hitsect, hitspr, hitwall, l, sa, p, j, k=-1, wh, scount; long sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal; unsigned char sizx,sizy; spritetype *s; @@ -462,14 +462,14 @@ short shoot(short i,short atwith) while(k >= 0) { if(sprite[k].statnum == 3 && sprite[k].lotag == 13) - return 0; + return -1; k = nextspritesect[k]; } } if( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) - return 0; + return -1; if(wall[hitwall].hitag == 0) { @@ -541,16 +541,16 @@ short shoot(short i,short atwith) // sprite[k].pal = 6; } } - return 0; + return -1; } - if(hitsect < 0) return 0; + if(hitsect < 0) return -1; if ((projectile[atwith].range == 0) && (projectile[atwith].workslike & PROJECTILE_FLAG_KNEE)) projectile[atwith].range = 1024; if( (projectile[atwith].range > 0) && (( klabs(sx-hitx)+klabs(sy-hity) ) > projectile[atwith].range) ) - return 0; + return -1; else { if(hitwall >= 0 || hitspr >= 0) @@ -605,7 +605,7 @@ short shoot(short i,short atwith) } } - return 0; + return -1; } if(projectile[atwith].workslike & PROJECTILE_FLAG_HITSCAN) @@ -630,7 +630,7 @@ short shoot(short i,short atwith) if (((sprite[j].picnum >= GREENSLIME)&&(sprite[j].picnum <= GREENSLIME+7))||(sprite[j].picnum ==ROTATEGUN) ) { dal -= (8<<8); - return 0; + return -1; } zvel = ( ( sprite[j].z-sz-dal )<<8 ) / ldist(&sprite[ps[p].i], &sprite[j]) ; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); @@ -683,9 +683,9 @@ short shoot(short i,short atwith) if (projectile[atwith].cstat >= 0) s->cstat |= projectile[atwith].cstat; else s->cstat |= 257; - if(hitsect < 0) return 0; + if(hitsect < 0) return -1; - if( (projectile[atwith].range > 0) && (( klabs(sx-hitx)+klabs(sy-hity) ) > projectile[atwith].range) ) return 0; + if( (projectile[atwith].range > 0) && (( klabs(sx-hitx)+klabs(sy-hity) ) > projectile[atwith].range) ) return -1; if (projectile[atwith].trail > -1) hitscantrail(sx,sy,sz,hitx,hity,hitz,sa,atwith); @@ -716,7 +716,7 @@ short shoot(short i,short atwith) { sprite[k].xrepeat = 0; sprite[k].yrepeat = 0; - return 0; + return -1; } else checkhitceiling(hitsect); @@ -760,7 +760,7 @@ short shoot(short i,short atwith) sprite[hitspr].picnum == HANDSWITCH+1) ) { checkhitswitch(p,hitspr,1); - return 0; + return -1; } } else if( hitwall >= 0 ) @@ -784,7 +784,7 @@ short shoot(short i,short atwith) wall[hitwall].picnum == HANDSWITCH+1) ) { checkhitswitch(p,hitwall,0); - return 0; + return -1; } if(wall[hitwall].hitag != 0 || ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) ) @@ -884,7 +884,7 @@ DOSKIPBULLETHOLE: if (projectile[atwith].isound >= 0) xyzsound(projectile[atwith].isound,k,hitx,hity,hitz); - return 0; + return -1; } if(projectile[atwith].workslike & PROJECTILE_FLAG_RPG) @@ -989,7 +989,7 @@ DOSKIPBULLETHOLE: // sa = s->ang+32-(TRAND&63); // zvel = oldzvel+512-(TRAND&1023); - return 0; + return j; } } @@ -1050,14 +1050,14 @@ DOSKIPBULLETHOLE: while(k >= 0) { if(sprite[k].statnum == 3 && sprite[k].lotag == 13) - return 0; + return -1; k = nextspritesect[k]; } } if( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) - return 0; + return -1; if(wall[hitwall].hitag == 0) { @@ -1075,7 +1075,7 @@ DOSKIPBULLETHOLE: sprite[k].pal = 6; } } - return 0; + return -1; } if(hitsect < 0) break; @@ -1203,7 +1203,7 @@ DOSKIPBULLETHOLE: zvel<<6,&hitsect,&hitwall,&hitspr,&hitx,&hity,&hitz,CLIPMASK1); s->cstat |= 257; - if(hitsect < 0) return 0; + if(hitsect < 0) return -1; if( (TRAND&15) == 0 && sector[hitsect].lotag == 2 ) tracers(hitx,hity,hitz,sx,sy,sz,8-(ud.multimode>>1)); @@ -1227,7 +1227,7 @@ DOSKIPBULLETHOLE: { sprite[k].xrepeat = 0; sprite[k].yrepeat = 0; - return 0; + return -1; } else checkhitceiling(hitsect); @@ -1260,7 +1260,7 @@ DOSKIPBULLETHOLE: sprite[hitspr].picnum == HANDSWITCH+1) ) { checkhitswitch(p,hitspr,1); - return 0; + return -1; } } else if( hitwall >= 0 ) @@ -1280,7 +1280,7 @@ DOSKIPBULLETHOLE: wall[hitwall].picnum == HANDSWITCH+1) ) { checkhitswitch(p,hitwall,0); - return 0; + return -1; } if(wall[hitwall].hitag != 0 || ( wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0 ) ) @@ -1358,7 +1358,7 @@ SKIPBULLETHOLE: if( (TRAND&255) < 4 ) xyzsound(PISTOL_RICOCHET,k,hitx,hity,hitz); - return 0; + return -1; case FIRELASER__STATIC: case SPIT__STATIC: @@ -1466,7 +1466,7 @@ SKIPBULLETHOLE: scount--; } - return 0; + return j; case FREEZEBLAST__STATIC: sz += (3<<8); @@ -1655,7 +1655,7 @@ SKIPBULLETHOLE: } - return 0; + return j?k:-1; case BOUNCEMINE__STATIC: case MORTER__STATIC: @@ -1806,10 +1806,10 @@ SKIPBULLETHOLE: sprite[j].clipdist = 32; - return 0; + return j; } } - return (long) s; + return -1; } void displayloogie(short snum) @@ -4957,7 +4957,8 @@ SHOOTINCODE: } else *kb = 0; - if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET) + if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && + ((aplWeaponWorksLike[p->curr_weapon][snum] & KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0)) { if( sb_snum&(1<<2) ) *kb = 1; else *kb = 0; @@ -4965,7 +4966,7 @@ SHOOTINCODE: } } else if ( *kb >= aplWeaponFireDelay[p->curr_weapon][snum] && (*kb) < aplWeaponTotalTime[p->curr_weapon][snum] - && (aplWeaponWorksLike[p->curr_weapon][snum] & KNEE_WEAPON ? 1 : p->ammo_amount[p->curr_weapon] > 0)) + && ((aplWeaponWorksLike[p->curr_weapon][snum] & KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0)) { if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AUTOMATIC) { @@ -4994,7 +4995,9 @@ SHOOTINCODE: DoSpawn(p); } } - if(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && (*kb) > aplWeaponTotalTime[p->curr_weapon][snum]-3) + if(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && + (*kb) > aplWeaponTotalTime[p->curr_weapon][snum]-aplWeaponHoldDelay[p->curr_weapon][snum] && + ((aplWeaponWorksLike[p->curr_weapon][snum] & KNEE_WEAPON)?1:p->ammo_amount[p->curr_weapon] > 0)) { if( sb_snum&(1<<2) ) *kb = 1; else *kb = 0;