mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Rework findnearactor3d/findnearsprite3d/findnearactor3dvar/findnearsprite3dvar and add a findnearactorz/findnearspritez/findnearactorzvar/findnearspritezvar. This breaks the previous syntax of all of the "3d" variants.
git-svn-id: https://svn.eduke32.com/eduke32@169 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
bfa46aa711
commit
ac14852079
5 changed files with 54 additions and 42 deletions
|
@ -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
|
||||
|
|
|
@ -435,6 +435,10 @@ char *keyw[] = {
|
|||
"save", // 288
|
||||
"cansee", // 289
|
||||
"canseespr", // 290
|
||||
"findnearactorz", // 291
|
||||
"findnearactorzvar", // 292
|
||||
"findnearspritez", // 293
|
||||
"findnearspritezvar", // 294
|
||||
"<null>"
|
||||
};
|
||||
|
||||
|
@ -2921,6 +2925,8 @@ char parsecommand(void)
|
|||
case CON_FINDNEARACTOR3D:
|
||||
case CON_FINDNEARSPRITE:
|
||||
case CON_FINDNEARSPRITE3D:
|
||||
case CON_FINDNEARACTORZ:
|
||||
case CON_FINDNEARSPRITEZ:
|
||||
{
|
||||
// syntax findnearactor <type> <maxdist> <getvar>
|
||||
// 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 <type>
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -5494,18 +5494,15 @@ good:
|
|||
|
||||
case CON_FINDNEARACTOR:
|
||||
case CON_FINDNEARSPRITE:
|
||||
case CON_FINDNEARACTOR3D:
|
||||
case CON_FINDNEARSPRITE3D:
|
||||
{
|
||||
// syntax findnearactorvar <type> <maxdist> <getvar>
|
||||
// gets the sprite ID of the nearest actor within max dist
|
||||
// that is of <type> into <getvar>
|
||||
// -1 for none found
|
||||
// <type> <maxdist> <varid>
|
||||
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<MAXSTATUS;k++)
|
||||
{
|
||||
j=headspritestat[tw==CON_FINDNEARACTOR?1:k]; // all sprites
|
||||
j=headspritestat[(tw==CON_FINDNEARACTOR||tw==CON_FINDNEARACTOR3D)?1:k]; // all sprites
|
||||
while(j>=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 <type> <maxdistvar> <getvar>
|
||||
// gets the sprite ID of the nearest actor within max dist
|
||||
|
@ -5564,12 +5564,14 @@ good:
|
|||
|
||||
for (k=0;k<MAXSTATUS;k++)
|
||||
{
|
||||
j=headspritestat[tw==CON_FINDNEARACTORVAR?1:k]; // all sprites
|
||||
j=headspritestat[(tw==CON_FINDNEARACTORVAR||tw==CON_FINDNEARACTOR3DVAR)?1:k]; // all sprites
|
||||
while(j>=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 <type> <maxdistvar> <getvar>
|
||||
// gets the sprite ID of the nearest actor within max dist
|
||||
|
@ -5618,7 +5620,7 @@ good:
|
|||
// -1 for none found
|
||||
// <type> <maxdistvarid> <varid>
|
||||
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<MAXSTATUS;k++)
|
||||
{
|
||||
j=headspritestat[tw==CON_FINDNEARACTOR3DVAR?1:k]; // all sprites
|
||||
j=headspritestat[tw==CON_FINDNEARACTORZVAR?1:k]; // all sprites
|
||||
while(j>=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 <type> <maxdist> <getvar>
|
||||
// gets the sprite ID of the nearest actor within max dist
|
||||
|
@ -5670,7 +5671,7 @@ good:
|
|||
// -1 for none found
|
||||
// <type> <maxdist> <varid>
|
||||
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<MAXSTATUS;k++)
|
||||
{
|
||||
j=headspritestat[tw==CON_FINDNEARACTOR3D?1:k]; // all sprites
|
||||
j=headspritestat[tw==CON_FINDNEARACTORZ?1:k]; // all sprites
|
||||
while(j>=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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue