diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 95182299f..840c32c21 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "util_lib.h" -#define VERSION " 1.4.0 beta 1" +#define VERSION " 1.4.0svn" #define HEAD "EDuke32"VERSION" (shareware mode)" #define HEAD2 "EDuke32"VERSION diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index af0f1e228..aa0e0d037 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -435,6 +435,10 @@ char *keyw[] = { "save", // 288 "cansee", // 289 "canseespr", // 290 + "findnearactorz", // 291 + "findnearactorzvar", // 292 + "findnearspritez", // 293 + "findnearspritezvar", // 294 "" }; @@ -2921,6 +2925,8 @@ char parsecommand(void) case CON_FINDNEARACTOR3D: case CON_FINDNEARSPRITE: case CON_FINDNEARSPRITE3D: + case CON_FINDNEARACTORZ: + case CON_FINDNEARSPRITEZ: { // syntax findnearactor // gets the sprite ID of the nearest actor within max dist @@ -2932,8 +2938,8 @@ char parsecommand(void) switch(tw) { - case CON_FINDNEARACTOR3D: - case CON_FINDNEARSPRITE3D: + case CON_FINDNEARACTORZ: + case CON_FINDNEARSPRITEZ: transnum(LABEL_DEFINE); default: break; @@ -2949,6 +2955,8 @@ char parsecommand(void) case CON_FINDNEARACTOR3DVAR: case CON_FINDNEARSPRITEVAR: case CON_FINDNEARSPRITE3DVAR: + case CON_FINDNEARACTORZVAR: + case CON_FINDNEARSPRITEZVAR: { transnum(LABEL_DEFINE); // get @@ -2956,8 +2964,8 @@ char parsecommand(void) transvar(); switch(tw) { - case CON_FINDNEARACTOR3DVAR: - case CON_FINDNEARSPRITE3DVAR: + case CON_FINDNEARACTORZVAR: + case CON_FINDNEARSPRITEZVAR: transvar(); default: break; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 2bc79e39c..e85d19efa 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -720,5 +720,9 @@ enum keywords { CON_SAVE, // 288 CON_CANSEE, // 289 CON_CANSEESPR, // 290 + CON_FINDNEARACTORZ, // 291 + CON_FINDNEARACTORZVAR, // 292 + CON_FINDNEARSPRITEZ, // 293 + CON_FINDNEARSPRITEZVAR, // 294 END }; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index b5ba7d73d..e29460db8 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5494,18 +5494,15 @@ good: case CON_FINDNEARACTOR: case CON_FINDNEARSPRITE: + case CON_FINDNEARACTOR3D: + case CON_FINDNEARSPRITE3D: { // syntax findnearactorvar // gets the sprite ID of the nearest actor within max dist // that is of into // -1 for none found // - long lType; - long lMaxDist; - long lVarID; - long lTemp; - long lFound; - long lDist; + long lType, lMaxDist, lVarID, lTemp, lFound; short j, k; insptr++; @@ -5515,17 +5512,18 @@ good: lVarID=*insptr++; lFound=-1; - lDist=32767; // big number for (k=0;k=0) { if(sprite[j].picnum == lType && j != g_i) { - lTemp=ldist(&sprite[g_i], &sprite[j]); - if(lTemp < lMaxDist && lTemp < lDist) + if(tw==CON_FINDNEARACTOR3D || tw==CON_FINDNEARSPRITE3D) + lTemp=dist(&sprite[g_i], &sprite[j]); + else lTemp=ldist(&sprite[g_i], &sprite[j]); + if(lTemp < lMaxDist) { lFound=j; j = MAXSPRITES; @@ -5534,7 +5532,7 @@ good: } j = nextspritestat[j]; } - if(tw==CON_FINDNEARACTOR || j == MAXSPRITES) + if((tw==CON_FINDNEARACTOR||tw==CON_FINDNEARACTOR3D) || j == MAXSPRITES) break; } SetGameVarID(lVarID, lFound, g_i, g_p); @@ -5543,6 +5541,8 @@ good: case CON_FINDNEARACTORVAR: case CON_FINDNEARSPRITEVAR: + case CON_FINDNEARACTOR3DVAR: + case CON_FINDNEARSPRITE3DVAR: { // syntax findnearactorvar // gets the sprite ID of the nearest actor within max dist @@ -5564,12 +5564,14 @@ good: for (k=0;k=0) { if(sprite[j].picnum == lType && j != g_i) { - lTemp=ldist(&sprite[g_i], &sprite[j]); + if(tw==CON_FINDNEARACTOR3DVAR || tw==CON_FINDNEARSPRITE3DVAR) + lTemp=dist(&sprite[g_i], &sprite[j]); + else lTemp=ldist(&sprite[g_i], &sprite[j]); if( lTemp < lMaxDist && lTemp < lDist) { lFound=j; @@ -5579,7 +5581,7 @@ good: } j = nextspritestat[j]; } - if(tw==CON_FINDNEARACTORVAR || j == MAXSPRITES) + if((tw==CON_FINDNEARACTORVAR||tw==CON_FINDNEARACTOR3DVAR) || j == MAXSPRITES) break; } SetGameVarID(lVarID, lFound, g_i, g_p); @@ -5609,8 +5611,8 @@ good: break; } - case CON_FINDNEARACTOR3DVAR: - case CON_FINDNEARSPRITE3DVAR: + case CON_FINDNEARACTORZVAR: + case CON_FINDNEARSPRITEZVAR: { // syntax findnearactorvar // gets the sprite ID of the nearest actor within max dist @@ -5618,7 +5620,7 @@ good: // -1 for none found // long lType, lMaxDistVar, lMaxZDistVar, lMaxDist, lMaxZDist; - long lVarID, lTemp, lTemp2, lFound, lDist; + long lVarID, lTemp, lTemp2, lFound; short j, k; insptr++; @@ -5630,19 +5632,18 @@ good: lMaxDist=GetGameVarID(lMaxDistVar, g_i, g_p); lMaxZDist=GetGameVarID(lMaxZDistVar, g_i, g_p); lFound=-1; - lDist=32767; // big number for (k=0;k=0) { if(sprite[j].picnum == lType && j != g_i) { lTemp=ldist(&sprite[g_i], &sprite[j]); - if(lTemp < lMaxDist && lTemp < lDist) + if(lTemp < lMaxDist) { - lTemp2=txdist(&sprite[g_i], &sprite[j]); + lTemp2=klabs(sprite[g_i].z-sprite[j].z);//txdist(&sprite[g_i], &sprite[j]); if (lTemp2 < lMaxZDist) { lFound=j; @@ -5653,7 +5654,7 @@ good: } j = nextspritestat[j]; } - if(tw==CON_FINDNEARACTOR3DVAR || j == MAXSPRITES) + if(tw==CON_FINDNEARACTORZVAR || j == MAXSPRITES) break; } SetGameVarID(lVarID, lFound, g_i, g_p); @@ -5661,8 +5662,8 @@ good: break; } - case CON_FINDNEARACTOR3D: - case CON_FINDNEARSPRITE3D: + case CON_FINDNEARACTORZ: + case CON_FINDNEARSPRITEZ: { // syntax findnearactorvar // gets the sprite ID of the nearest actor within max dist @@ -5670,7 +5671,7 @@ good: // -1 for none found // long lType, lMaxDist, lMaxZDist, lVarID; - long lTemp, lTemp2, lFound, lDist; + long lTemp, lTemp2, lFound; short j, k; insptr++; @@ -5681,19 +5682,18 @@ good: lVarID=*insptr++; lFound=-1; - lDist=32767; // big number for (k=0;k=0) { if(sprite[j].picnum == lType && j != g_i) { lTemp=ldist(&sprite[g_i], &sprite[j]); - if(lTemp < lMaxDist && lTemp < lDist) + if(lTemp < lMaxDist) { - lTemp2=txdist(&sprite[g_i], &sprite[j]); + lTemp2=klabs(sprite[g_i].z-sprite[j].z); // txdist(&sprite[g_i], &sprite[j]); if (lTemp2 < lMaxZDist) { lFound=j; @@ -5704,7 +5704,7 @@ good: } j = nextspritestat[j]; } - if(tw==CON_FINDNEARACTOR3D || j == MAXSPRITES) + if(tw==CON_FINDNEARACTORZ || j == MAXSPRITES) break; } SetGameVarID(lVarID, lFound, g_i, g_p); diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 842c80e57..ecf175cc8 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -4958,7 +4958,7 @@ SHOOTINCODE: else *kb = 0; if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_RESET && - ((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( sb_snum&(1<<2) ) *kb = 1; else *kb = 0; @@ -4970,10 +4970,10 @@ SHOOTINCODE: { if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AUTOMATIC) { - if(( sb_snum&(1<<2) ) == 0 ) - { - *kb = 0; - } + if(( sb_snum&(1<<2) ) == 0 ) + { + *kb = 0; + } if ( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYTHIRD) { if( ((*(kb))%3) == 0 ) @@ -4996,8 +4996,8 @@ SHOOTINCODE: } } 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)) + (*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;