2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
2010-05-25 10:56:00 +00:00
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
This file is part of EDuke32.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-04-13 20:47:06 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <time.h>
|
2009-07-12 23:41:16 +00:00
|
|
|
#include <stdlib.h>
|
2012-09-02 14:05:23 +00:00
|
|
|
#include <math.h> // sqrt
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-11-15 14:28:04 +00:00
|
|
|
#include "compat.h"
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "duke3d.h"
|
|
|
|
#include "gamedef.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "gameexec.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "scriplib.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "savegame.h"
|
|
|
|
#include "premap.h"
|
2008-08-11 10:38:46 +00:00
|
|
|
#include "osdcmds.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
#include "osd.h"
|
2010-08-02 08:13:51 +00:00
|
|
|
#include "menus.h"
|
2014-06-13 09:04:05 +00:00
|
|
|
#include "input.h"
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-06-03 15:45:59 +00:00
|
|
|
#ifdef LUNATIC
|
2012-11-10 20:59:00 +00:00
|
|
|
# include "lunatic_game.h"
|
2012-02-09 22:45:18 +00:00
|
|
|
#endif
|
|
|
|
|
2010-01-24 23:33:17 +00:00
|
|
|
#if KRANDDEBUG
|
|
|
|
# define GAMEEXEC_INLINE
|
|
|
|
# define GAMEEXEC_STATIC
|
|
|
|
#else
|
|
|
|
# define GAMEEXEC_INLINE inline
|
|
|
|
# define GAMEEXEC_STATIC static
|
|
|
|
#endif
|
|
|
|
|
2013-07-13 21:04:45 +00:00
|
|
|
vmstate_t vm;
|
|
|
|
|
|
|
|
#if !defined LUNATIC
|
2012-11-29 12:49:34 +00:00
|
|
|
enum vmflags_t {
|
|
|
|
VM_RETURN = 0x00000001,
|
|
|
|
VM_KILL = 0x00000002,
|
|
|
|
VM_NOEXECUTE = 0x00000004,
|
|
|
|
};
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t g_tw;
|
2013-02-07 21:00:52 +00:00
|
|
|
int32_t g_errorLineNum;
|
2011-08-03 17:22:46 +00:00
|
|
|
int32_t g_currentEventExec = -1;
|
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
GAMEEXEC_STATIC void VM_Execute(int32_t loop);
|
2008-02-16 22:18:48 +00:00
|
|
|
|
2013-01-01 15:24:18 +00:00
|
|
|
# include "gamestructures.c"
|
|
|
|
#endif
|
2008-12-13 08:02:22 +00:00
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
#define VM_CONDITIONAL(xxx) { if ((xxx) || ((insptr = (intptr_t *)*(insptr+1)) && (((*insptr) & 0xfff) == CON_ELSE))) \
|
|
|
|
{ insptr += 2; VM_Execute(0); } }
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
void VM_ScriptInfo(void)
|
2008-08-25 20:25:49 +00:00
|
|
|
{
|
2013-01-19 18:29:00 +00:00
|
|
|
#if !defined LUNATIC
|
2010-05-05 07:31:38 +00:00
|
|
|
intptr_t *p;
|
|
|
|
|
|
|
|
if (!script)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (insptr)
|
2008-08-25 20:25:49 +00:00
|
|
|
{
|
2012-01-01 04:14:06 +00:00
|
|
|
initprintf("\n");
|
|
|
|
|
2010-05-05 07:31:38 +00:00
|
|
|
for (p=insptr-20; p<insptr+20; p++)
|
|
|
|
{
|
2012-01-01 04:14:06 +00:00
|
|
|
initprintf("%5d: %3d: ",(int32_t)(p - script),(int32_t)(p - insptr));
|
|
|
|
|
2010-05-05 07:31:38 +00:00
|
|
|
if (*p>>12&&(*p&0xFFF)<CON_END)
|
2012-01-01 04:14:06 +00:00
|
|
|
initprintf("%5d %s",(int32_t)(*p>>12),keyw[*p&0xFFF]);
|
2010-05-05 07:31:38 +00:00
|
|
|
else
|
2012-01-01 04:14:06 +00:00
|
|
|
initprintf("%d",(int32_t)*p);
|
|
|
|
|
|
|
|
initprintf("\n");
|
2010-05-05 07:31:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
initprintf("\n");
|
2008-08-25 20:25:49 +00:00
|
|
|
}
|
2010-05-05 07:31:38 +00:00
|
|
|
|
|
|
|
if (vm.g_i)
|
2012-11-26 08:26:04 +00:00
|
|
|
initprintf_nowarn("current actor: %d (%d)\n",vm.g_i,TrackerCast(vm.g_sp->picnum));
|
2010-05-05 07:31:38 +00:00
|
|
|
|
|
|
|
initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw);
|
2013-01-01 15:24:18 +00:00
|
|
|
#endif
|
2008-08-25 20:25:49 +00:00
|
|
|
}
|
|
|
|
|
2013-02-21 18:54:07 +00:00
|
|
|
static void VM_KillIt(int32_t iActor, int32_t iPlayer)
|
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned) iActor >= MAXSPRITES))
|
2013-08-06 23:51:51 +00:00
|
|
|
return;
|
2013-02-21 18:54:07 +00:00
|
|
|
|
2013-08-06 23:51:51 +00:00
|
|
|
// if player was set to squish, first stop that...
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(iPlayer >= 0 && g_player[iPlayer].ps->actorsqu == iActor))
|
2013-08-06 23:51:51 +00:00
|
|
|
g_player[iPlayer].ps->actorsqu = -1;
|
|
|
|
|
|
|
|
A_DeleteSprite(iActor);
|
2013-02-21 18:54:07 +00:00
|
|
|
}
|
|
|
|
|
2012-05-29 20:01:55 +00:00
|
|
|
// May recurse, e.g. through EVENT_XXX -> ... -> EVENT_KILLIT
|
2014-10-25 03:33:53 +00:00
|
|
|
int32_t VM_OnEvent_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-06-03 15:45:59 +00:00
|
|
|
#ifdef LUNATIC
|
2014-10-25 03:33:53 +00:00
|
|
|
const double t = gethiticks();
|
|
|
|
int32_t ret = El_CallEvent(&g_ElState, iEventID, iActor, iPlayer, lDist, &iReturn);
|
2013-07-13 21:04:45 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
// NOTE: the run times are those of the called event plus any events
|
|
|
|
// called by it, *not* "self" time.
|
|
|
|
g_eventTotalMs[iEventID] += gethiticks()-t;
|
|
|
|
g_eventCalls[iEventID]++;
|
2013-02-21 18:54:07 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
if (ret == 1)
|
|
|
|
VM_KillIt(iActor, iPlayer);
|
2013-02-21 18:54:07 +00:00
|
|
|
#else
|
2014-10-25 03:33:53 +00:00
|
|
|
intptr_t *oinsptr=insptr;
|
|
|
|
vmstate_t vm_backup;
|
2013-01-01 15:24:18 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
vmstate_t tempvm ={ iActor, iPlayer, lDist,
|
|
|
|
iActor >= 0 ? &actor[iActor].t_data[0] : NULL,
|
|
|
|
iActor >= 0 ? &sprite[iActor] : NULL,
|
|
|
|
0 };
|
2012-05-14 18:12:27 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
int32_t backupReturnVar = aGameVars[g_iReturnVarID].val.lValue;
|
|
|
|
int32_t backupEventExec = g_currentEventExec;
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
aGameVars[g_iReturnVarID].val.lValue = iReturn;
|
|
|
|
g_currentEventExec = iEventID;
|
|
|
|
insptr = apScriptGameEvent[iEventID];
|
2011-02-27 18:01:49 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t));
|
|
|
|
Bmemcpy(&vm, &tempvm, sizeof(vmstate_t));
|
2006-12-21 09:33:26 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
VM_Execute(1);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
if (vm.g_flags & VM_KILL)
|
|
|
|
VM_KillIt(iActor, iPlayer);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t));
|
|
|
|
insptr = oinsptr;
|
2011-08-03 17:22:46 +00:00
|
|
|
|
2014-10-25 03:33:53 +00:00
|
|
|
g_currentEventExec = backupEventExec;
|
|
|
|
iReturn = aGameVars[g_iReturnVarID].val.lValue;
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = backupReturnVar;
|
2013-01-01 15:24:18 +00:00
|
|
|
#endif
|
2012-05-16 00:45:10 +00:00
|
|
|
|
2012-08-19 12:52:18 +00:00
|
|
|
return iReturn;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
static int32_t VM_CheckSquished(void)
|
2006-12-10 03:15:56 +00:00
|
|
|
{
|
2013-04-05 17:52:59 +00:00
|
|
|
const sectortype *sc = §or[vm.g_sp->sectnum];
|
2006-12-10 03:15:56 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (sc->lotag == ST_23_SWINGING_DOOR || EDUKE32_PREDICT_FALSE(vm.g_sp->picnum == APLAYER && ud.noclip))
|
2010-05-02 23:27:30 +00:00
|
|
|
return 0;
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2011-10-03 17:44:06 +00:00
|
|
|
{
|
|
|
|
int32_t fz=sc->floorz, cz=sc->ceilingz;
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
int16_t cb, fb;
|
|
|
|
|
|
|
|
yax_getbunches(vm.g_sp->sectnum, &cb, &fb);
|
|
|
|
if (cb >= 0 && (sc->ceilingstat&512)==0) // if ceiling non-blocking...
|
2013-04-05 17:52:59 +00:00
|
|
|
cz -= (32<<8); // unconditionally don't squish... yax_getneighborsect is slowish :/
|
2011-10-03 17:44:06 +00:00
|
|
|
if (fb >= 0 && (sc->floorstat&512)==0)
|
|
|
|
fz += (32<<8);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (vm.g_sp->pal == 1 ?
|
|
|
|
(fz - cz >= (32<<8) || (sc->lotag&32768)) :
|
|
|
|
(fz - cz >= (12<<8)))
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
P_DoQuote(QUOTE_SQUISHED, g_player[vm.g_p].ps);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2013-04-05 17:52:59 +00:00
|
|
|
if (A_CheckEnemySprite(vm.g_sp))
|
|
|
|
vm.g_sp->xvel = 0;
|
2006-12-10 03:15:56 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(vm.g_sp->pal == 1)) // frozen
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
actor[vm.g_i].picnum = SHOTSPARK1;
|
|
|
|
actor[vm.g_i].extra = 1;
|
|
|
|
return 0;
|
2006-12-10 03:15:56 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
return 1;
|
2006-12-10 03:15:56 +00:00
|
|
|
}
|
|
|
|
|
2014-04-19 22:42:22 +00:00
|
|
|
#if !defined LUNATIC
|
2010-01-24 23:33:17 +00:00
|
|
|
GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *p)
|
2006-12-10 06:49:01 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t n = 128-(krand()&255);
|
2006-12-10 06:49:01 +00:00
|
|
|
|
|
|
|
p->horiz += 64;
|
|
|
|
p->return_to_center = 9;
|
2011-02-25 21:50:19 +00:00
|
|
|
p->look_ang = p->rotscrnang = n>>1;
|
2006-12-10 06:49:01 +00:00
|
|
|
}
|
2014-04-19 22:42:22 +00:00
|
|
|
#endif
|
2006-12-10 06:49:01 +00:00
|
|
|
|
2012-12-03 18:24:30 +00:00
|
|
|
int32_t A_Dodge(spritetype *s)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
int32_t bx,by,bxvect,byvect,i;
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t mx = s->x, my = s->y;
|
|
|
|
int32_t mxvect = sintable[(s->ang+512)&2047];
|
|
|
|
int32_t myvect = sintable[s->ang&2047];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2008-12-01 10:44:18 +00:00
|
|
|
if (A_CheckEnemySprite(s) && s->extra <= 0) // hack
|
|
|
|
return 0;
|
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
if (OW == i)
|
2006-04-13 20:47:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
bx = SX-mx;
|
|
|
|
by = SY-my;
|
2006-11-15 01:16:55 +00:00
|
|
|
bxvect = sintable[(SA+512)&2047];
|
|
|
|
byvect = sintable[SA&2047];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
if ((mxvect * bx) + (myvect * by) >= 0 && (bxvect * bx) + (byvect * by) < 0)
|
|
|
|
{
|
|
|
|
if (klabs((bxvect * by) - (byvect * bx)) < 65536<<6)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2011-02-25 21:50:19 +00:00
|
|
|
s->ang -= 512+(krand()&1024);
|
|
|
|
return 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2011-02-25 21:50:19 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
int32_t A_GetFurthestAngle(int32_t iActor, int32_t angs)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-12-20 03:27:25 +00:00
|
|
|
spritetype *s = &sprite[iActor];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
if (s->picnum != APLAYER && (AC_COUNT(actor[iActor].t_data)&63) > 2)
|
|
|
|
return s->ang + 1024;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t furthest_angle=0;
|
2013-06-30 20:38:48 +00:00
|
|
|
int32_t d, j;
|
|
|
|
int32_t greatestd = INT32_MIN;
|
2014-10-25 03:29:21 +00:00
|
|
|
int32_t angincs=tabledivide32_noinline(2048, angs);
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=s->ang; j<(2048+s->ang); j+=angincs)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-13 12:23:18 +00:00
|
|
|
s->z -= (8<<8);
|
|
|
|
hitscan((const vec3_t *)s, s->sectnum,
|
2008-09-03 04:20:46 +00:00
|
|
|
sintable[(j+512)&2047],
|
|
|
|
sintable[j&2047],0,
|
2012-08-10 19:12:01 +00:00
|
|
|
&hit,CLIPMASK1);
|
2009-01-13 12:23:18 +00:00
|
|
|
s->z += (8<<8);
|
2012-08-10 19:12:01 +00:00
|
|
|
d = klabs(hit.pos.x-s->x) + klabs(hit.pos.y-s->y);
|
2008-09-03 04:20:46 +00:00
|
|
|
|
|
|
|
if (d > greatestd)
|
|
|
|
{
|
|
|
|
greatestd = d;
|
|
|
|
furthest_angle = j;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-06-30 20:38:48 +00:00
|
|
|
|
|
|
|
return furthest_angle&2047;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
int32_t A_FurthestVisiblePoint(int32_t iActor, spritetype *ts, int32_t *dax, int32_t *day)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
if (AC_COUNT(actor[iActor].t_data)&63)
|
2012-05-14 18:12:27 +00:00
|
|
|
return -1;
|
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-13 12:23:18 +00:00
|
|
|
int32_t d, da;//, d, cd, ca,tempx,tempy,cx,cy;
|
|
|
|
int32_t j, angincs;
|
2008-09-03 04:20:46 +00:00
|
|
|
spritetype *s = &sprite[iActor];
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if ((!g_netServer && ud.multimode < 2) && ud.player_skill < 3)
|
2008-09-03 04:20:46 +00:00
|
|
|
angincs = 2048/2;
|
2014-10-25 03:29:21 +00:00
|
|
|
else angincs = tabledivide32_noinline(2048, 1+(krand()&1));
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-02-19 16:47:54 +00:00
|
|
|
for (j=ts->ang; j<(2048+ts->ang); j+=(angincs-(krand()&511)))
|
2008-09-03 04:20:46 +00:00
|
|
|
{
|
2009-01-13 12:23:18 +00:00
|
|
|
ts->z -= (16<<8);
|
|
|
|
hitscan((const vec3_t *)ts, ts->sectnum,
|
2008-09-03 04:20:46 +00:00
|
|
|
sintable[(j+512)&2047],
|
2008-11-20 14:06:36 +00:00
|
|
|
sintable[j&2047],16384-(krand()&32767),
|
2012-08-10 19:12:01 +00:00
|
|
|
&hit,CLIPMASK1);
|
2009-01-13 12:23:18 +00:00
|
|
|
|
|
|
|
ts->z += (16<<8);
|
2008-09-03 04:20:46 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
d = klabs(hit.pos.x-ts->x)+klabs(hit.pos.y-ts->y);
|
|
|
|
da = klabs(hit.pos.x-s->x)+klabs(hit.pos.y-s->y);
|
2008-09-03 04:20:46 +00:00
|
|
|
|
2012-08-10 19:12:01 +00:00
|
|
|
if (d < da && hit.sect > -1)
|
|
|
|
if (cansee(hit.pos.x,hit.pos.y,hit.pos.z,
|
|
|
|
hit.sect,s->x,s->y,s->z-(16<<8),s->sectnum))
|
2008-09-03 04:20:46 +00:00
|
|
|
{
|
2012-08-10 19:12:01 +00:00
|
|
|
*dax = hit.pos.x;
|
|
|
|
*day = hit.pos.y;
|
|
|
|
return hit.sect;
|
2008-09-03 04:20:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_GetZLimits(int32_t iActor)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-12-20 03:27:25 +00:00
|
|
|
spritetype *s = &sprite[iActor];
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
int32_t hz,lz,zr = 127;
|
|
|
|
int32_t cstat = s->cstat;
|
2009-01-19 06:41:28 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
s->cstat = 0;
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (s->statnum == STAT_PROJECTILE)
|
|
|
|
zr = 4;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
s->z -= ZOFFSET;
|
|
|
|
getzrange((vec3_t *)s,s->sectnum,&actor[iActor].ceilingz,&hz,&actor[iActor].floorz,&lz,zr,CLIPMASK0);
|
|
|
|
s->z += ZOFFSET;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
s->cstat = cstat;
|
2009-01-19 06:41:28 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
actor[iActor].flags &= ~SFLAG_NOFLOORSHADOW;
|
2012-01-12 20:48:00 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if ((lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0)
|
|
|
|
{
|
|
|
|
const spritetype *hitspr = &sprite[lz&(MAXSPRITES-1)];
|
2011-12-21 18:42:49 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
lz &= (MAXSPRITES-1);
|
2011-12-21 18:42:49 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if ((A_CheckEnemySprite(hitspr) && hitspr->pal != 1 && s->statnum != STAT_PROJECTILE)
|
|
|
|
|| (hitspr->picnum == APLAYER && A_CheckEnemySprite(s)))
|
|
|
|
{
|
|
|
|
actor[iActor].flags |= SFLAG_NOFLOORSHADOW; // No shadows on actors
|
|
|
|
s->xvel = -256;
|
|
|
|
A_SetSprite(iActor,CLIPMASK0);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (s->statnum == STAT_PROJECTILE && hitspr->picnum == APLAYER && s->owner==lz)
|
2010-08-02 08:13:51 +00:00
|
|
|
{
|
|
|
|
actor[iActor].ceilingz = sector[s->sectnum].ceilingz;
|
|
|
|
actor[iActor].floorz = sector[s->sectnum].floorz;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_Fall(int32_t iActor)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-12-20 03:27:25 +00:00
|
|
|
spritetype *s = &sprite[iActor];
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t hz,lz,c = g_spriteGravity;
|
2011-05-07 18:23:34 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
int16_t fbunch;
|
|
|
|
#endif
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceFloor(s->sectnum)))
|
2006-04-13 20:47:06 +00:00
|
|
|
c = 0;
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (sector[s->sectnum].lotag == ST_2_UNDERWATER || EDUKE32_PREDICT_FALSE(G_CheckForSpaceCeiling(s->sectnum)))
|
|
|
|
c = g_spriteGravity/6;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-08-28 23:08:00 +00:00
|
|
|
if (s->statnum == STAT_ACTOR || s->statnum == STAT_PLAYER || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_STANDABLE)
|
2009-01-13 12:23:18 +00:00
|
|
|
{
|
2009-01-19 06:41:28 +00:00
|
|
|
int32_t cstat = s->cstat;
|
|
|
|
s->cstat = 0;
|
2010-08-02 08:13:51 +00:00
|
|
|
s->z -= ZOFFSET;
|
2010-05-02 23:27:30 +00:00
|
|
|
getzrange((vec3_t *)s,s->sectnum,&actor[iActor].ceilingz,&hz,&actor[iActor].floorz,&lz,127L,CLIPMASK0);
|
2010-08-02 08:13:51 +00:00
|
|
|
s->z += ZOFFSET;
|
2009-01-19 06:41:28 +00:00
|
|
|
s->cstat = cstat;
|
2009-01-13 12:23:18 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[iActor].ceilingz = sector[s->sectnum].ceilingz;
|
|
|
|
actor[iActor].floorz = sector[s->sectnum].floorz;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2011-05-07 18:23:34 +00:00
|
|
|
#ifdef YAX_ENABLE
|
2014-10-25 03:36:34 +00:00
|
|
|
fbunch = (sector[s->sectnum].floorstat&512) ? -1 : yax_getbunch(s->sectnum, YAX_FLOOR);
|
2011-05-07 18:23:34 +00:00
|
|
|
#endif
|
2013-04-15 10:48:18 +00:00
|
|
|
|
|
|
|
if (s->z < actor[iActor].floorz-ZOFFSET
|
2011-05-07 18:23:34 +00:00
|
|
|
#ifdef YAX_ENABLE
|
2013-04-15 10:48:18 +00:00
|
|
|
|| fbunch >= 0
|
2011-05-07 18:23:34 +00:00
|
|
|
#endif
|
2012-05-14 18:12:27 +00:00
|
|
|
)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-10-14 20:41:21 +00:00
|
|
|
if (sector[s->sectnum].lotag == ST_2_UNDERWATER && s->zvel > 3122)
|
2006-04-13 20:47:06 +00:00
|
|
|
s->zvel = 3144;
|
2008-12-13 21:01:33 +00:00
|
|
|
s->z += s->zvel = min(6144, s->zvel+c);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-04-15 10:48:18 +00:00
|
|
|
|
2011-05-07 18:23:34 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
if (fbunch >= 0)
|
|
|
|
setspritez(iActor, (vec3_t *)s);
|
2013-04-15 10:48:18 +00:00
|
|
|
else
|
2011-05-07 18:23:34 +00:00
|
|
|
#endif
|
2013-04-15 10:48:18 +00:00
|
|
|
if (s->z >= actor[iActor].floorz-ZOFFSET)
|
2012-05-14 18:12:27 +00:00
|
|
|
{
|
2013-04-15 10:48:18 +00:00
|
|
|
s->z = actor[iActor].floorz-ZOFFSET;
|
2012-05-14 18:12:27 +00:00
|
|
|
s->zvel = 0;
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t G_GetAngleDelta(int32_t a,int32_t na)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
|
|
|
a &= 2047;
|
|
|
|
na &= 2047;
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (klabs(a-na) < 1024)
|
2007-03-11 00:20:32 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a);
|
2006-04-13 20:47:06 +00:00
|
|
|
return (na-a);
|
2007-03-11 00:47:32 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-12-18 08:37:12 +00:00
|
|
|
if (na > 1024) na -= 2048;
|
|
|
|
if (a > 1024) a -= 2048;
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
// OSD_Printf("G_GetAngleDelta() returning %d\n",na-a);
|
2006-12-18 08:37:12 +00:00
|
|
|
return (na-a);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
GAMEEXEC_STATIC void VM_AlterAng(int32_t movflags)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
const int32_t ticselapsed = (AC_COUNT(vm.g_t))&31;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-02-07 21:00:48 +00:00
|
|
|
#if !defined LUNATIC
|
2011-12-21 18:40:47 +00:00
|
|
|
const intptr_t *moveptr;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)AC_MOVE_ID(vm.g_t) >= (unsigned)g_scriptSize-1))
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2010-08-07 22:52:58 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_MOVE_ID(vm.g_t) = 0;
|
2012-11-26 08:26:04 +00:00
|
|
|
OSD_Printf_nowarn(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, TrackerCast(vm.g_sp->picnum));
|
2010-08-07 22:59:46 +00:00
|
|
|
return;
|
2010-08-07 22:52:58 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
moveptr = script + AC_MOVE_ID(vm.g_t);
|
2011-12-21 18:40:47 +00:00
|
|
|
|
2014-03-16 14:37:50 +00:00
|
|
|
vm.g_sp->xvel += (moveptr[0] - vm.g_sp->xvel)/5;
|
2012-08-06 20:00:29 +00:00
|
|
|
if (vm.g_sp->zvel < 648)
|
2014-03-16 14:37:50 +00:00
|
|
|
vm.g_sp->zvel += ((moveptr[1]<<4) - vm.g_sp->zvel)/5;
|
2012-06-03 15:46:08 +00:00
|
|
|
#else
|
2012-08-06 20:00:29 +00:00
|
|
|
vm.g_sp->xvel += (actor[vm.g_i].mv.hvel - vm.g_sp->xvel)/5;
|
|
|
|
if (vm.g_sp->zvel < 648)
|
|
|
|
vm.g_sp->zvel += ((actor[vm.g_i].mv.vvel<<4) - vm.g_sp->zvel)/5;
|
2012-06-03 15:46:08 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack
|
2008-12-01 10:44:18 +00:00
|
|
|
return;
|
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&seekplayer)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t aang = vm.g_sp->ang, angdif, goalang;
|
|
|
|
int32_t j = g_player[vm.g_p].ps->holoduke_on;
|
2008-09-03 04:20:46 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
// NOTE: looks like 'owner' is set to target sprite ID...
|
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (j >= 0 && cansee(sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].sectnum,vm.g_sp->x,vm.g_sp->y,vm.g_sp->z,vm.g_sp->sectnum))
|
|
|
|
vm.g_sp->owner = j;
|
|
|
|
else vm.g_sp->owner = g_player[vm.g_p].ps->i;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (sprite[vm.g_sp->owner].picnum == APLAYER)
|
2010-05-02 23:27:30 +00:00
|
|
|
goalang = getangle(actor[vm.g_i].lastvx-vm.g_sp->x,actor[vm.g_i].lastvy-vm.g_sp->y);
|
2006-04-13 20:47:06 +00:00
|
|
|
else
|
2009-01-07 14:05:13 +00:00
|
|
|
goalang = getangle(sprite[vm.g_sp->owner].x-vm.g_sp->x,sprite[vm.g_sp->owner].y-vm.g_sp->y);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_sp->xvel && vm.g_sp->picnum != DRONE)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
angdif = G_GetAngleDelta(aang,goalang);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ticselapsed < 2)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2006-11-14 21:35:50 +00:00
|
|
|
if (klabs(angdif) < 256)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
j = 128-(krand()&256);
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp->ang += j;
|
|
|
|
if (A_GetHitscanRange(vm.g_i) < 844)
|
|
|
|
vm.g_sp->ang -= j;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2009-04-26 05:57:42 +00:00
|
|
|
else if (ticselapsed > 18 && ticselapsed < GAMETICSPERSEC) // choose
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
if (klabs(angdif>>2) < 128) vm.g_sp->ang = goalang;
|
|
|
|
else vm.g_sp->ang += angdif>>2;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-07 14:05:13 +00:00
|
|
|
else vm.g_sp->ang = goalang;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2006-11-13 23:12:47 +00:00
|
|
|
if (ticselapsed < 1)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&furthestdir)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
vm.g_sp->ang = A_GetFurthestAngle(vm.g_i, 2);
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp->owner = g_player[vm.g_p].ps->i;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&fleeenemy)
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
vm.g_sp->ang = A_GetFurthestAngle(vm.g_i, 2);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
static inline void VM_AddAngle(int32_t shr, int32_t goalang)
|
2012-06-07 17:38:01 +00:00
|
|
|
{
|
|
|
|
int32_t angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>shr;
|
|
|
|
|
|
|
|
if ((angdif > -8 && angdif < 0) || (angdif < 8 && angdif > 0))
|
|
|
|
angdif *= 2;
|
|
|
|
|
|
|
|
vm.g_sp->ang += angdif;
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:00:48 +00:00
|
|
|
static void VM_FacePlayer(int32_t shr)
|
2012-06-07 17:38:01 +00:00
|
|
|
{
|
|
|
|
int32_t goalang;
|
|
|
|
const DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
|
|
|
|
if (g_player[vm.g_p].ps->newowner >= 0)
|
|
|
|
goalang = getangle(ps->opos.x-vm.g_sp->x, ps->opos.y-vm.g_sp->y);
|
|
|
|
else
|
|
|
|
goalang = getangle(ps->pos.x-vm.g_sp->x, ps->pos.y-vm.g_sp->y);
|
|
|
|
|
2013-02-07 21:00:48 +00:00
|
|
|
VM_AddAngle(shr, goalang);
|
2012-06-07 17:38:01 +00:00
|
|
|
}
|
|
|
|
|
2013-04-12 11:59:35 +00:00
|
|
|
////////// TROR get*zofslope //////////
|
|
|
|
// These rather belong into the engine.
|
|
|
|
|
|
|
|
static int32_t yax_getceilzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
|
|
|
{
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
if ((sector[sectnum].ceilingstat&512)==0)
|
|
|
|
{
|
|
|
|
int32_t nsect = yax_getneighborsect(dax, day, sectnum, YAX_CEILING);
|
|
|
|
if (nsect >= 0)
|
|
|
|
return getceilzofslope(nsect, dax, day);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return getceilzofslope(sectnum, dax, day);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int32_t yax_getflorzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
|
|
|
{
|
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
if ((sector[sectnum].floorstat&512)==0)
|
|
|
|
{
|
|
|
|
int32_t nsect = yax_getneighborsect(dax, day, sectnum, YAX_FLOOR);
|
|
|
|
if (nsect >= 0)
|
|
|
|
return getflorzofslope(nsect, dax, day);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return getflorzofslope(sectnum, dax, day);
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
GAMEEXEC_STATIC void VM_Move(void)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-07 21:00:48 +00:00
|
|
|
#if !defined LUNATIC
|
2011-12-21 18:40:47 +00:00
|
|
|
const intptr_t *moveptr;
|
2012-06-03 15:46:08 +00:00
|
|
|
#endif
|
2013-06-30 20:38:48 +00:00
|
|
|
// NOTE: commented out condition is dead since r3159 (making hi/lotag unsigned).
|
|
|
|
// XXX: Does it break anything? Where are movflags with all bits set created?
|
2013-06-30 20:38:52 +00:00
|
|
|
const uint16_t *movflagsptr = &AC_MOVFLAGS(vm.g_sp, &actor[vm.g_i]);
|
|
|
|
const int32_t movflags = /*(*movflagsptr==-1) ? 0 :*/ *movflagsptr;
|
2013-02-07 21:00:48 +00:00
|
|
|
const int32_t deadflag = (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0);
|
2013-06-30 20:38:45 +00:00
|
|
|
int32_t badguyp, angdif;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_COUNT(vm.g_t)++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:44 +00:00
|
|
|
// If the move ID is zero, or the movflags are 0
|
2013-06-30 20:38:48 +00:00
|
|
|
if (AC_MOVE_ID(vm.g_t) == 0 || movflags == 0)
|
2008-12-01 10:44:18 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
if (deadflag || (actor[vm.g_i].bpos.x != vm.g_sp->x) || (actor[vm.g_i].bpos.y != vm.g_sp->y))
|
2008-12-01 10:44:18 +00:00
|
|
|
{
|
2012-12-23 14:00:08 +00:00
|
|
|
actor[vm.g_i].bpos.x = vm.g_sp->x;
|
|
|
|
actor[vm.g_i].bpos.y = vm.g_sp->y;
|
2012-06-07 17:38:01 +00:00
|
|
|
setsprite(vm.g_i, (vec3_t *)vm.g_sp);
|
2008-12-01 10:44:18 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (deadflag)
|
|
|
|
goto dead;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&face_player)
|
2013-02-07 21:00:48 +00:00
|
|
|
VM_FacePlayer(2);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&spin)
|
2013-06-30 20:38:48 +00:00
|
|
|
vm.g_sp->ang += sintable[((AC_COUNT(vm.g_t)<<3)&2047)]>>6;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&face_player_slow)
|
2013-02-07 21:00:48 +00:00
|
|
|
VM_FacePlayer(4);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-03-16 14:37:52 +00:00
|
|
|
if ((movflags&jumptoplayer_bits) == jumptoplayer_bits)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
if (AC_COUNT(vm.g_t) < 16)
|
|
|
|
vm.g_sp->zvel -= (sintable[(512+(AC_COUNT(vm.g_t)<<4))&2047]>>5);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&face_player_smart)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
int32_t newx = ps->pos.x + (ps->vel.x/768);
|
|
|
|
int32_t newy = ps->pos.y + (ps->vel.y/768);
|
2007-03-11 00:47:32 +00:00
|
|
|
|
2013-02-07 21:00:48 +00:00
|
|
|
int32_t goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
|
|
|
|
VM_AddAngle(2, goalang);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
dead:
|
2013-02-07 21:00:48 +00:00
|
|
|
#if !defined LUNATIC
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)AC_MOVE_ID(vm.g_t) >= (unsigned)g_scriptSize-1))
|
2010-08-07 22:52:58 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_MOVE_ID(vm.g_t) = 0;
|
2012-11-26 08:26:04 +00:00
|
|
|
OSD_Printf_nowarn(OSD_ERROR "clearing bad moveptr for actor %d (%d)\n", vm.g_i, TrackerCast(vm.g_sp->picnum));
|
2010-08-07 22:59:46 +00:00
|
|
|
return;
|
2010-08-07 22:38:15 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
moveptr = script + AC_MOVE_ID(vm.g_t);
|
2011-12-21 18:40:47 +00:00
|
|
|
|
2014-03-16 14:37:50 +00:00
|
|
|
if (movflags&geth) vm.g_sp->xvel += ((moveptr[0])-vm.g_sp->xvel)>>1;
|
|
|
|
if (movflags&getv) vm.g_sp->zvel += ((moveptr[1]<<4)-vm.g_sp->zvel)>>1;
|
2012-06-03 15:46:08 +00:00
|
|
|
#else
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&geth) vm.g_sp->xvel += (actor[vm.g_i].mv.hvel - vm.g_sp->xvel)>>1;
|
2013-07-04 19:38:32 +00:00
|
|
|
if (movflags&getv) vm.g_sp->zvel += (16*actor[vm.g_i].mv.vvel - vm.g_sp->zvel)>>1;
|
2012-06-03 15:46:08 +00:00
|
|
|
#endif
|
2011-03-04 08:50:58 +00:00
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (movflags&dodgebullet && !deadflag)
|
2009-01-07 14:05:13 +00:00
|
|
|
A_Dodge(vm.g_sp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_sp->picnum != APLAYER)
|
2013-06-30 20:38:45 +00:00
|
|
|
VM_AlterAng(movflags);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (vm.g_sp->xvel > -6 && vm.g_sp->xvel < 6)
|
|
|
|
vm.g_sp->xvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
badguyp = A_CheckEnemySprite(vm.g_sp);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_sp->xvel || vm.g_sp->zvel)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-06-07 17:38:01 +00:00
|
|
|
int32_t daxvel;
|
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (badguyp && vm.g_sp->picnum != ROTATEGUN)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
if ((vm.g_sp->picnum == DRONE || vm.g_sp->picnum == COMMANDER) && vm.g_sp->extra > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_sp->picnum == COMMANDER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-06-07 17:38:01 +00:00
|
|
|
int32_t l;
|
2013-04-12 11:59:26 +00:00
|
|
|
// NOTE: COMMANDER updates both actor[].floorz and
|
|
|
|
// .ceilingz regardless of its zvel.
|
2013-04-12 11:59:35 +00:00
|
|
|
actor[vm.g_i].floorz = l = yax_getflorzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y);
|
2012-06-07 17:38:01 +00:00
|
|
|
if (vm.g_sp->z > l-(8<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-06-07 17:38:01 +00:00
|
|
|
vm.g_sp->z = l-(8<<8);
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp->zvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-04-12 11:59:35 +00:00
|
|
|
actor[vm.g_i].ceilingz = l = yax_getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y);
|
2013-04-12 11:59:26 +00:00
|
|
|
if (vm.g_sp->z < l+(80<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp->z = l+(80<<8);
|
|
|
|
vm.g_sp->zvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-07 17:38:01 +00:00
|
|
|
int32_t l;
|
2013-04-12 11:59:26 +00:00
|
|
|
// The DRONE updates either .floorz or .ceilingz, not both.
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_sp->zvel > 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-12 11:59:35 +00:00
|
|
|
actor[vm.g_i].floorz = l = yax_getflorzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y);
|
2012-06-07 17:38:01 +00:00
|
|
|
if (vm.g_sp->z > l-(30<<8))
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp->z = l-(30<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-04-12 11:59:35 +00:00
|
|
|
actor[vm.g_i].ceilingz = l = yax_getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y);
|
2013-04-12 11:59:26 +00:00
|
|
|
if (vm.g_sp->z < l+(50<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp->z = l+(50<<8);
|
|
|
|
vm.g_sp->zvel = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-01-07 14:05:13 +00:00
|
|
|
else if (vm.g_sp->picnum != ORGANTIC)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-12 11:59:26 +00:00
|
|
|
// All other actors besides ORGANTIC don't update .floorz or
|
|
|
|
// .ceilingz here.
|
2010-05-02 23:27:30 +00:00
|
|
|
if (vm.g_sp->zvel > 0 && actor[vm.g_i].floorz < vm.g_sp->z)
|
|
|
|
vm.g_sp->z = actor[vm.g_i].floorz;
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_sp->zvel < 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-04-12 11:59:35 +00:00
|
|
|
const int32_t l = yax_getceilzofslope(vm.g_sp->sectnum,vm.g_sp->x,vm.g_sp->y);
|
2012-06-07 17:38:01 +00:00
|
|
|
|
2013-04-12 11:59:26 +00:00
|
|
|
if (vm.g_sp->z < l+(66<<8))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp->z = l+(66<<8);
|
|
|
|
vm.g_sp->zvel >>= 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-01-07 14:05:13 +00:00
|
|
|
else if (vm.g_sp->picnum == APLAYER)
|
2013-04-12 11:59:26 +00:00
|
|
|
if (vm.g_sp->z < actor[vm.g_i].ceilingz+(32<<8))
|
2010-05-02 23:27:30 +00:00
|
|
|
vm.g_sp->z = actor[vm.g_i].ceilingz+(32<<8);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
daxvel = vm.g_sp->xvel;
|
|
|
|
angdif = vm.g_sp->ang;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (badguyp && vm.g_sp->picnum != ROTATEGUN)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_x < 960 && vm.g_sp->xrepeat > 16)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
daxvel = -(1024-vm.g_x);
|
2012-06-07 17:38:01 +00:00
|
|
|
angdif = getangle(ps->pos.x-vm.g_sp->x, ps->pos.y-vm.g_sp->y);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_x < 512)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-06-07 17:38:01 +00:00
|
|
|
ps->vel.x = 0;
|
|
|
|
ps->vel.y = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-06-07 17:38:01 +00:00
|
|
|
ps->vel.x = mulscale16(ps->vel.x, ps->runspeed-0x2000);
|
|
|
|
ps->vel.y = mulscale16(ps->vel.y, ps->runspeed-0x2000);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-07 14:05:13 +00:00
|
|
|
else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
if (ps->actorsqu == vm.g_i)
|
|
|
|
return;
|
2012-10-30 15:54:35 +00:00
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (!A_CheckSpriteFlags(vm.g_i, SFLAG_SMOOTHMOVE))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
if (AC_COUNT(vm.g_t)&1)
|
|
|
|
return;
|
2012-10-30 15:54:35 +00:00
|
|
|
daxvel <<= 1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-13 04:40:56 +00:00
|
|
|
{
|
2010-08-02 08:13:51 +00:00
|
|
|
vec3_t tmpvect = { (daxvel*(sintable[(angdif+512)&2047]))>>14,
|
2013-06-30 20:38:48 +00:00
|
|
|
(daxvel*(sintable[angdif&2047]))>>14,
|
|
|
|
vm.g_sp->zvel
|
2010-08-02 08:13:51 +00:00
|
|
|
};
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2011-12-17 18:51:50 +00:00
|
|
|
actor[vm.g_i].movflag = A_MoveSprite(
|
2014-02-22 19:38:52 +00:00
|
|
|
vm.g_i,&tmpvect, (A_CheckSpriteFlags(vm.g_i, SFLAG_NOCLIP) ? 0 : CLIPMASK0));
|
2009-01-13 04:40:56 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:45 +00:00
|
|
|
if (!badguyp)
|
2012-06-07 17:38:01 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-07-22 20:29:09 +00:00
|
|
|
if (sector[vm.g_sp->sectnum].ceilingstat&1)
|
|
|
|
vm.g_sp->shade += (sector[vm.g_sp->sectnum].ceilingshade-vm.g_sp->shade)>>1;
|
|
|
|
else vm.g_sp->shade += (sector[vm.g_sp->sectnum].floorshade-vm.g_sp->shade)>>1;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-02-24 16:05:47 +00:00
|
|
|
static void P_AddWeaponMaybeSwitch(DukePlayer_t *ps, int32_t weap)
|
2012-08-10 19:11:47 +00:00
|
|
|
{
|
2012-08-27 03:52:38 +00:00
|
|
|
if ((ps->weaponswitch & 1) && (ps->weaponswitch & 4))
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
const int32_t snum = P_Get(ps->i);
|
2013-12-26 19:44:56 +00:00
|
|
|
int32_t i, new_wchoice = -1, curr_wchoice = -1;
|
2012-08-27 03:52:38 +00:00
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
for (i=0; i<=FREEZE_WEAPON && (new_wchoice < 0 || curr_wchoice < 0); i++)
|
2012-08-27 03:52:38 +00:00
|
|
|
{
|
2013-12-26 19:44:56 +00:00
|
|
|
int32_t w = g_player[snum].wchoice[i];
|
2012-08-27 03:52:38 +00:00
|
|
|
|
2013-12-26 19:44:56 +00:00
|
|
|
if (w == KNEE_WEAPON)
|
|
|
|
w = FREEZE_WEAPON;
|
2012-08-27 03:52:38 +00:00
|
|
|
else w--;
|
|
|
|
|
|
|
|
if (w == ps->curr_weapon)
|
|
|
|
curr_wchoice = i;
|
|
|
|
if (w == weap)
|
|
|
|
new_wchoice = i;
|
|
|
|
}
|
|
|
|
|
2013-12-26 19:45:00 +00:00
|
|
|
P_AddWeapon(ps, weap, (new_wchoice < curr_wchoice));
|
2012-08-27 03:52:38 +00:00
|
|
|
}
|
|
|
|
else
|
2013-12-26 19:45:00 +00:00
|
|
|
{
|
|
|
|
P_AddWeapon(ps, weap, (ps->weaponswitch & 1));
|
|
|
|
}
|
2012-08-10 19:11:47 +00:00
|
|
|
}
|
|
|
|
|
2013-02-24 16:05:47 +00:00
|
|
|
#if defined LUNATIC
|
|
|
|
void P_AddWeaponMaybeSwitchI(int32_t snum, int32_t weap)
|
|
|
|
{
|
|
|
|
P_AddWeaponMaybeSwitch(g_player[snum].ps, weap);
|
|
|
|
}
|
|
|
|
#else
|
2012-11-30 18:57:55 +00:00
|
|
|
static void P_AddWeaponAmmoCommon(DukePlayer_t *ps, int32_t weap, int32_t amount)
|
2012-08-10 19:11:47 +00:00
|
|
|
{
|
|
|
|
P_AddAmmo(weap, ps, amount);
|
|
|
|
|
2014-10-25 03:25:57 +00:00
|
|
|
if (PWEAPON(vm.g_p, ps->curr_weapon, WorksLike) == KNEE_WEAPON && (ps->gotweapon & (1 << weap)))
|
2012-11-30 18:57:55 +00:00
|
|
|
P_AddWeaponMaybeSwitch(ps, weap);
|
2012-08-10 19:11:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int32_t VM_AddWeapon(int32_t weap, int32_t amount, DukePlayer_t *ps)
|
|
|
|
{
|
|
|
|
if ((unsigned)weap >= MAX_WEAPONS)
|
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid weapon ID %d\n", weap);
|
2012-08-10 19:11:47 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((ps->gotweapon & (1 << weap)) == 0)
|
|
|
|
{
|
2012-11-30 18:57:55 +00:00
|
|
|
P_AddWeaponMaybeSwitch(ps, weap);
|
2012-08-10 19:11:47 +00:00
|
|
|
}
|
|
|
|
else if (ps->ammo_amount[weap] >= ps->max_ammo_amount[weap])
|
|
|
|
{
|
|
|
|
vm.g_flags |= VM_NOEXECUTE;
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2012-11-30 18:57:55 +00:00
|
|
|
P_AddWeaponAmmoCommon(ps, weap, amount);
|
2012-08-10 19:11:47 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2013-01-01 15:24:18 +00:00
|
|
|
#endif
|
2012-08-10 19:11:47 +00:00
|
|
|
|
2013-02-07 21:00:52 +00:00
|
|
|
static void VM_Fall(int32_t g_i, spritetype *g_sp)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
2013-04-15 10:48:22 +00:00
|
|
|
int32_t grav = g_spriteGravity;
|
2012-12-03 18:24:20 +00:00
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
g_sp->xoffset = g_sp->yoffset = 0;
|
2012-12-03 18:24:20 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (sector[g_sp->sectnum].lotag == ST_2_UNDERWATER || EDUKE32_PREDICT_FALSE(G_CheckForSpaceCeiling(g_sp->sectnum)))
|
2013-04-15 10:48:22 +00:00
|
|
|
grav = g_spriteGravity/6;
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE(G_CheckForSpaceFloor(g_sp->sectnum)))
|
2013-04-15 10:48:22 +00:00
|
|
|
grav = 0;
|
2012-12-03 18:24:20 +00:00
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
if (!actor[g_i].cgg-- || (sector[g_sp->sectnum].floorstat&2))
|
|
|
|
{
|
|
|
|
A_GetZLimits(g_i);
|
|
|
|
actor[g_i].cgg = 3;
|
|
|
|
}
|
2012-12-03 18:24:20 +00:00
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
if (g_sp->z < actor[g_i].floorz-ZOFFSET)
|
|
|
|
{
|
|
|
|
// Free fall.
|
|
|
|
g_sp->zvel = min(g_sp->zvel+grav, ACTOR_MAXFALLINGZVEL);
|
|
|
|
g_sp->z += g_sp->zvel;
|
2012-12-03 18:24:20 +00:00
|
|
|
#ifdef YAX_ENABLE
|
2013-04-15 10:48:22 +00:00
|
|
|
if (yax_getbunch(g_sp->sectnum, YAX_FLOOR) >= 0 &&
|
|
|
|
(sector[g_sp->sectnum].floorstat&512)==0)
|
|
|
|
setspritez(g_i, (vec3_t *)g_sp);
|
|
|
|
else
|
2012-12-03 18:24:20 +00:00
|
|
|
#endif
|
2013-04-15 10:48:22 +00:00
|
|
|
if (g_sp->z > actor[g_i].floorz - ZOFFSET)
|
|
|
|
g_sp->z = actor[g_i].floorz - ZOFFSET;
|
|
|
|
return;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
// SET_SPRITE_Z
|
|
|
|
g_sp->z = actor[g_i].floorz - ZOFFSET;
|
2012-12-03 18:24:20 +00:00
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
if (A_CheckEnemySprite(g_sp) || (g_sp->picnum == APLAYER && g_sp->owner >= 0))
|
|
|
|
{
|
|
|
|
if (g_sp->zvel > 3084 && g_sp->extra <= 1)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
2013-04-15 10:48:22 +00:00
|
|
|
// I'm guessing this DRONE check is from a beta version of the game
|
|
|
|
// where they crashed into the ground when killed
|
|
|
|
if (!(g_sp->picnum == APLAYER && g_sp->extra > 0) && g_sp->pal != 1 && g_sp->picnum != DRONE)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
2013-04-15 10:48:22 +00:00
|
|
|
A_DoGuts(g_i,JIBS6,15);
|
|
|
|
A_PlaySound(SQUISHED,g_i);
|
|
|
|
A_Spawn(g_i,BLOODPOOL);
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
actor[g_i].picnum = SHOTSPARK1;
|
|
|
|
actor[g_i].extra = 1;
|
|
|
|
g_sp->zvel = 0;
|
|
|
|
}
|
|
|
|
else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != ST_1_ABOVE_WATER)
|
|
|
|
{
|
|
|
|
int16_t newsect = g_sp->sectnum;
|
2013-04-15 10:48:09 +00:00
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
pushmove((vec3_t *)g_sp, &newsect, 128, 4<<8, 4<<8, CLIPMASK0);
|
|
|
|
if ((unsigned)newsect < MAXSECTORS)
|
|
|
|
changespritesect(g_i, newsect);
|
|
|
|
|
|
|
|
A_PlaySound(THUD, g_i);
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-15 10:48:22 +00:00
|
|
|
#if 0
|
|
|
|
if (g_sp->z > actor[g_i].floorz - ZOFFSET)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
2013-04-15 10:48:22 +00:00
|
|
|
// Unreachable because of SET_SPRITE_Z.
|
2013-02-07 21:00:52 +00:00
|
|
|
A_GetZLimits(g_i);
|
|
|
|
if (actor[g_i].floorz != sector[g_sp->sectnum].floorz)
|
|
|
|
g_sp->z = (actor[g_i].floorz - ZOFFSET);
|
2012-12-03 18:24:20 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-04-15 10:48:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (sector[g_sp->sectnum].lotag == ST_1_ABOVE_WATER)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
2013-02-07 21:00:52 +00:00
|
|
|
switch (DYNAMICTILEMAP(g_sp->picnum))
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
2013-04-15 10:48:09 +00:00
|
|
|
case OCTABRAIN__STATIC:
|
|
|
|
case COMMANDER__STATIC:
|
|
|
|
case DRONE__STATIC:
|
|
|
|
break;
|
|
|
|
|
2012-12-03 18:24:20 +00:00
|
|
|
default:
|
|
|
|
{
|
2013-02-07 21:00:48 +00:00
|
|
|
#if !defined LUNATIC
|
2013-06-30 20:38:48 +00:00
|
|
|
int32_t moveScriptOfs = AC_MOVE_ID(vm.g_t);
|
2012-12-03 18:24:20 +00:00
|
|
|
#endif
|
2013-04-15 10:48:09 +00:00
|
|
|
// fix for flying/jumping monsters getting stuck in water
|
2014-08-20 17:58:21 +00:00
|
|
|
if ((AC_MOVFLAGS(g_sp, &actor[vm.g_i]) & jumptoplayer_only) ||
|
2013-02-07 21:00:52 +00:00
|
|
|
(G_HaveActor(g_sp->picnum) &&
|
2013-02-07 21:00:48 +00:00
|
|
|
#if !defined LUNATIC
|
2014-08-20 17:58:21 +00:00
|
|
|
(unsigned)moveScriptOfs < (unsigned)g_scriptSize-1 && script[moveScriptOfs + 1] != 0
|
2012-12-03 18:24:20 +00:00
|
|
|
#else
|
2013-02-07 21:00:52 +00:00
|
|
|
actor[g_i].mv.vvel != 0
|
2012-12-03 18:24:20 +00:00
|
|
|
#endif
|
|
|
|
))
|
|
|
|
{
|
2014-08-20 17:58:21 +00:00
|
|
|
// OSD_Printf("%d\n", (int)script[moveScriptOfs + 1]);
|
2012-12-03 18:24:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-08-20 17:58:21 +00:00
|
|
|
// OSD_Printf("movflags: %d | %d\n", AC_MOVFLAGS(g_sp, &actor[vm.g_i]), totalclock);
|
2013-04-15 10:48:09 +00:00
|
|
|
g_sp->z += ACTOR_ONWATER_ADDZ;
|
2012-12-03 18:24:20 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-04-15 10:48:09 +00:00
|
|
|
}
|
|
|
|
|
2012-12-03 18:24:20 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-02-07 21:00:48 +00:00
|
|
|
|
2013-02-07 21:00:52 +00:00
|
|
|
g_sp->zvel = 0;
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
|
|
|
|
2013-02-07 21:00:52 +00:00
|
|
|
static int32_t VM_ResetPlayer(int32_t g_p, int32_t g_flags)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
|
|
|
//AddLog("resetplayer");
|
2013-02-07 21:00:52 +00:00
|
|
|
if (!g_netServer && ud.multimode < 2)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
|
|
|
if (g_lastSaveSlot >= 0 && ud.recstat != 2)
|
|
|
|
{
|
2013-02-07 21:00:52 +00:00
|
|
|
g_player[g_p].ps->gm |= MODE_MENU;
|
2012-12-03 18:24:20 +00:00
|
|
|
KB_ClearKeyDown(sc_Space);
|
2014-06-13 09:04:05 +00:00
|
|
|
I_AdvanceTriggerClear();
|
2014-03-26 09:14:01 +00:00
|
|
|
M_ChangeMenu(MENU_RESETPLAYER);
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
2013-02-07 21:00:52 +00:00
|
|
|
else g_player[g_p].ps->gm = MODE_RESTART;
|
2013-07-13 21:04:45 +00:00
|
|
|
#if !defined LUNATIC
|
2013-02-07 21:00:52 +00:00
|
|
|
g_flags |= VM_NOEXECUTE;
|
2013-07-13 21:04:45 +00:00
|
|
|
#endif
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-02-07 21:00:52 +00:00
|
|
|
if (g_p == myconnectindex)
|
2012-12-03 18:24:20 +00:00
|
|
|
{
|
2013-01-19 18:28:32 +00:00
|
|
|
CAMERADIST = 0;
|
|
|
|
CAMERACLOCK = totalclock;
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (g_fakeMultiMode)
|
2013-02-07 21:00:52 +00:00
|
|
|
P_ResetPlayer(g_p);
|
2012-12-09 13:24:44 +00:00
|
|
|
#ifndef NETCODE_DISABLE
|
2012-12-03 18:24:20 +00:00
|
|
|
if (g_netServer)
|
|
|
|
{
|
2013-02-07 21:00:52 +00:00
|
|
|
P_ResetPlayer(g_p);
|
2013-08-06 23:54:09 +00:00
|
|
|
Net_SpawnPlayer(g_p);
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
2012-12-09 13:24:44 +00:00
|
|
|
#endif
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
2013-02-07 21:00:52 +00:00
|
|
|
|
|
|
|
P_UpdateScreenPal(g_player[g_p].ps);
|
2012-12-03 18:24:20 +00:00
|
|
|
//AddLog("EOF: resetplayer");
|
2013-02-07 21:00:52 +00:00
|
|
|
|
|
|
|
return g_flags;
|
2012-12-03 18:24:20 +00:00
|
|
|
}
|
|
|
|
|
2013-02-16 18:53:00 +00:00
|
|
|
void G_GetTimeDate(int32_t *vals)
|
|
|
|
{
|
|
|
|
time_t rawtime;
|
|
|
|
struct tm *ti;
|
|
|
|
|
|
|
|
time(&rawtime);
|
|
|
|
ti=localtime(&rawtime);
|
|
|
|
// initprintf("Time&date: %s\n",asctime (ti));
|
|
|
|
|
|
|
|
vals[0] = ti->tm_sec;
|
|
|
|
vals[1] = ti->tm_min;
|
|
|
|
vals[2] = ti->tm_hour;
|
|
|
|
vals[3] = ti->tm_mday;
|
|
|
|
vals[4] = ti->tm_mon;
|
|
|
|
vals[5] = ti->tm_year+1900;
|
|
|
|
vals[6] = ti->tm_wday;
|
|
|
|
vals[7] = ti->tm_yday;
|
|
|
|
}
|
|
|
|
|
2013-02-16 18:53:18 +00:00
|
|
|
int32_t G_StartTrack(int32_t level)
|
|
|
|
{
|
|
|
|
if ((unsigned)level < MAXLEVELS)
|
|
|
|
{
|
|
|
|
int32_t musicIndex = MAXLEVELS*ud.volume_number + level;
|
|
|
|
|
2013-03-03 16:06:40 +00:00
|
|
|
if (MapInfo[musicIndex].musicfn != NULL)
|
2013-02-16 18:53:18 +00:00
|
|
|
{
|
2013-03-03 16:06:40 +00:00
|
|
|
// Only set g_musicIndex on success.
|
2013-02-16 18:53:18 +00:00
|
|
|
g_musicIndex = musicIndex;
|
2013-03-03 16:06:40 +00:00
|
|
|
S_PlayMusic(MapInfo[musicIndex].musicfn, g_musicIndex);
|
2013-02-16 18:53:18 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-06-07 14:26:32 +00:00
|
|
|
LUNATIC_EXTERN void G_ShowView(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t sect,
|
|
|
|
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t unbiasedp)
|
|
|
|
{
|
|
|
|
int32_t smoothratio = calc_smoothratio(totalclock, ototalclock);
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
int32_t oprojhacks;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (g_screenCapture)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (offscreenrendering)
|
|
|
|
{
|
|
|
|
clearview(0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x1 > x2) swaplong(&x1,&x2);
|
|
|
|
if (y1 > y2) swaplong(&y1,&y2);
|
|
|
|
|
|
|
|
if (!unbiasedp)
|
|
|
|
{
|
|
|
|
// The showview command has a rounding bias towards zero,
|
|
|
|
// e.g. floor((319*1680)/320) == 1674
|
|
|
|
x1 = scale(x1,xdim,320);
|
|
|
|
y1 = scale(y1,ydim,200);
|
|
|
|
x2 = scale(x2,xdim,320);
|
|
|
|
y2 = scale(y2,ydim,200);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// This will map the maximum 320-based coordinate to the
|
|
|
|
// maximum real screen coordinate:
|
|
|
|
// floor((319*1679)/319) == 1679
|
|
|
|
x1 = scale(x1,xdim-1,319);
|
|
|
|
y1 = scale(y1,ydim-1,199);
|
|
|
|
x2 = scale(x2,xdim-1,319);
|
|
|
|
y2 = scale(y2,ydim-1,199);
|
|
|
|
}
|
|
|
|
|
|
|
|
horiz = clamp(horiz, HORIZ_MIN, HORIZ_MAX);
|
|
|
|
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
oprojhacks = glprojectionhacks;
|
|
|
|
glprojectionhacks = 0;
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
int32_t o = newaspect_enable;
|
|
|
|
newaspect_enable = r_usenewaspect;
|
|
|
|
setaspect_new_use_dimen = 1;
|
|
|
|
|
|
|
|
setview(x1,y1,x2,y2);
|
|
|
|
|
|
|
|
setaspect_new_use_dimen = 0;
|
|
|
|
newaspect_enable = o;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_DoInterpolations(smoothratio);
|
|
|
|
|
|
|
|
G_HandleMirror(x, y, z, a, horiz, smoothratio);
|
|
|
|
#ifdef POLYMER
|
|
|
|
if (getrendermode() == REND_POLYMER)
|
|
|
|
polymer_setanimatesprites(G_DoSpriteAnimations, x,y,a,smoothratio);
|
|
|
|
#endif
|
|
|
|
yax_preparedrawrooms();
|
|
|
|
drawrooms(x,y,z,a,horiz,sect);
|
|
|
|
yax_drawrooms(G_DoSpriteAnimations, sect, 0, smoothratio);
|
|
|
|
|
|
|
|
display_mirror = 2;
|
|
|
|
G_DoSpriteAnimations(x,y,a,smoothratio);
|
|
|
|
display_mirror = 0;
|
|
|
|
drawmasks();
|
|
|
|
G_RestoreInterpolations();
|
|
|
|
G_UpdateScreenArea();
|
|
|
|
#ifdef USE_OPENGL
|
|
|
|
glprojectionhacks = oprojhacks;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-01-19 18:29:00 +00:00
|
|
|
#if !defined LUNATIC
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
GAMEEXEC_STATIC void VM_Execute(int32_t loop)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2014-09-30 04:15:29 +00:00
|
|
|
int32_t tw = *insptr;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
// jump directly into the loop, saving us from the checks during the first iteration
|
|
|
|
goto skip_check;
|
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
while (loop)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
if (vm.g_flags & (VM_RETURN|VM_KILL|VM_NOEXECUTE))
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
return;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
tw = *insptr;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
skip_check:
|
2009-06-19 01:10:10 +00:00
|
|
|
// Bsprintf(g_szBuf,"Parsing: %d",*insptr);
|
|
|
|
// AddLog(g_szBuf);
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
g_errorLineNum = tw>>12;
|
|
|
|
g_tw = tw &= 0xFFF;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
switch (tw)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_REDEFINEQUOTE:
|
|
|
|
insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t q = *insptr++, i = *insptr++;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((ScriptQuotes[q] == NULL || ScriptQuoteRedefinitions[i] == NULL)))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("%d %d null quote\n", q,i);
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
Bstrcpy(ScriptQuotes[q],ScriptQuoteRedefinitions[i]);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETTHISPROJECTILE:
|
|
|
|
case CON_SETTHISPROJECTILE:
|
|
|
|
insptr++;
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// syntax [gs]etplayer[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_AccessActiveProjectile(tw==CON_SETTHISPROJECTILE,lVar1,lLabelID,lVar2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFRND:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(rnd(*(++insptr)));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFCANSHOOTTARGET:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
int32_t j;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
if (vm.g_x > 1024)
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
int16_t temphit;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if ((j = A_CheckHitSprite(vm.g_i,&temphit)) == (1<<30))
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(1);
|
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
int32_t sclip = 768, angdif = 16;
|
|
|
|
|
|
|
|
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->xrepeat > 56)
|
|
|
|
{
|
|
|
|
sclip = 3084;
|
|
|
|
angdif = 48;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j > sclip)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum)
|
|
|
|
{
|
|
|
|
VM_CONDITIONAL(0);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
vm.g_sp->ang += angdif;
|
|
|
|
j = A_CheckHitSprite(vm.g_i,&temphit);
|
|
|
|
vm.g_sp->ang -= angdif;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
if (j > sclip)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(0);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
vm.g_sp->ang -= angdif;
|
|
|
|
j = A_CheckHitSprite(vm.g_i,&temphit);
|
|
|
|
vm.g_sp->ang += angdif;
|
|
|
|
|
|
|
|
if (j > 768)
|
|
|
|
{
|
|
|
|
if (temphit >= 0 && sprite[temphit].picnum == vm.g_sp->picnum)
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(0);
|
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
|
|
|
VM_CONDITIONAL(1);
|
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(1);
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFCANSEETARGET:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
int32_t j = cansee(vm.g_sp->x, vm.g_sp->y, vm.g_sp->z-((krand()&41)<<8),
|
|
|
|
vm.g_sp->sectnum, ps->pos.x, ps->pos.y,
|
|
|
|
ps->pos.z/*-((krand()&41)<<8)*/, sprite[ps->i].sectnum);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2010-05-02 23:27:30 +00:00
|
|
|
if (j) actor[vm.g_i].timetosleep = SLEEPTIME;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFACTORNOTSTAYPUT:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(actor[vm.g_i].actorstayput == -1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFCANSEE:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
spritetype *s = &sprite[ps->i];
|
2009-06-24 08:20:10 +00:00
|
|
|
int32_t j;
|
|
|
|
|
|
|
|
// select sprite for monster to target
|
|
|
|
// if holoduke is on, let them target holoduke first.
|
|
|
|
//
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->holoduke_on >= 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
s = &sprite[ps->holoduke_on];
|
2009-06-24 08:20:10 +00:00
|
|
|
j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((32<<8)-1)),vm.g_sp->sectnum,
|
|
|
|
s->x,s->y,s->z,s->sectnum);
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
if (j == 0)
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
// they can't see player's holoduke
|
|
|
|
// check for player...
|
2012-08-10 19:11:53 +00:00
|
|
|
s = &sprite[ps->i];
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
// can they see player, (or player's holoduke)
|
|
|
|
j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(krand()&((47<<8))),vm.g_sp->sectnum,
|
|
|
|
s->x,s->y,s->z-(24<<8),s->sectnum);
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
if (j == 0)
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
// search around for target player
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
// also modifies 'target' x&y if found..
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
j = 1;
|
|
|
|
if (A_FurthestVisiblePoint(vm.g_i,s,&actor[vm.g_i].lastvx,&actor[vm.g_i].lastvy) == -1)
|
|
|
|
j = 0;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// else, they did see it.
|
|
|
|
// save where we were looking...
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[vm.g_i].lastvx = s->x;
|
|
|
|
actor[vm.g_i].lastvy = s->y;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
if (j && (vm.g_sp->statnum == STAT_ACTOR || vm.g_sp->statnum == STAT_STANDABLE))
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[vm.g_i].timetosleep = SLEEPTIME;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFHITWEAPON:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(A_IncurDamage(vm.g_i) >= 0);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFSQUISHED:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(VM_CheckSquished());
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFDEAD:
|
|
|
|
// j = vm.g_sp->extra;
|
|
|
|
// if (vm.g_sp->picnum == APLAYER)
|
|
|
|
// j--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(vm.g_sp->extra <= 0);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_AI:
|
2009-01-18 07:32:35 +00:00
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
//Following changed to use pointersizes
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_AI_ID(vm.g_t) = *insptr++; // Ai
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_ACTION_ID(vm.g_t) = *(script + AC_AI_ID(vm.g_t)); // Action
|
2013-02-03 12:48:17 +00:00
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
// NOTE: "if" check added in r1155. It used to be a pointer though.
|
|
|
|
if (AC_AI_ID(vm.g_t))
|
|
|
|
AC_MOVE_ID(vm.g_t) = *(script + AC_AI_ID(vm.g_t) + 1); // move
|
|
|
|
|
|
|
|
vm.g_sp->hitag = *(script + AC_AI_ID(vm.g_t) + 2); // move flags
|
|
|
|
|
|
|
|
AC_COUNT(vm.g_t) = AC_ACTION_COUNT(vm.g_t) = AC_CURFRAME(vm.g_t) = 0;
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2012-05-29 20:01:55 +00:00
|
|
|
if (!A_CheckEnemySprite(vm.g_sp) || vm.g_sp->extra > 0) // hack
|
|
|
|
if (vm.g_sp->hitag&random_angle)
|
|
|
|
vm.g_sp->ang = krand()&2047;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ACTION:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_ACTION_COUNT(vm.g_t) = AC_CURFRAME(vm.g_t) = 0;
|
|
|
|
AC_ACTION_ID(vm.g_t) = *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-05-23 18:28:04 +00:00
|
|
|
case CON_IFPLAYERSL:
|
|
|
|
VM_CONDITIONAL(numplayers < *(++insptr));
|
|
|
|
continue;
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFPDISTL:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(vm.g_x < *(++insptr));
|
2010-05-02 23:27:30 +00:00
|
|
|
if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0)
|
|
|
|
actor[vm.g_i].timetosleep = SLEEPTIME;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-04-15 20:04:52 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFPDISTG:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(vm.g_x > *(++insptr));
|
2010-05-02 23:27:30 +00:00
|
|
|
if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0)
|
|
|
|
actor[vm.g_i].timetosleep = SLEEPTIME;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-04-15 20:04:52 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ELSE:
|
|
|
|
insptr = (intptr_t *) *(insptr+1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-04-15 20:04:52 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ADDSTRENGTH:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->extra += *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_STRENGTH:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->extra = *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFGOTWEAPONCE:
|
|
|
|
insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if ((GametypeFlags[ud.coop]&GAMETYPE_WEAPSTAY) && (g_netServer || ud.multimode > 1))
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (*insptr == 0)
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j = 0;
|
2012-08-10 19:11:53 +00:00
|
|
|
for (; j < ps->weapreccnt; j++)
|
|
|
|
if (ps->weaprecs[j] == vm.g_sp->picnum)
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
VM_CONDITIONAL(j < ps->weapreccnt && vm.g_sp->owner == vm.g_i);
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2012-08-10 19:11:53 +00:00
|
|
|
else if (ps->weapreccnt < MAX_WEAPONS)
|
2007-04-15 20:04:52 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->weaprecs[ps->weapreccnt++] = vm.g_sp->picnum;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(vm.g_sp->owner == vm.g_i);
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2007-04-15 20:04:52 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(0);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_GETLASTPAL:
|
|
|
|
insptr++;
|
|
|
|
if (vm.g_sp->picnum == APLAYER)
|
2013-12-28 17:04:27 +00:00
|
|
|
vm.g_sp->pal = g_player[P_GetP(vm.g_sp)].ps->palookup;
|
2009-06-19 01:10:10 +00:00
|
|
|
else
|
2007-04-15 20:04:52 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
if (vm.g_sp->pal == 1 && vm.g_sp->extra == 0) // hack for frozen
|
|
|
|
vm.g_sp->extra++;
|
2010-05-02 23:27:30 +00:00
|
|
|
vm.g_sp->pal = actor[vm.g_i].tempang;
|
2007-04-15 20:04:52 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[vm.g_i].tempang = 0;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_TOSSWEAPON:
|
|
|
|
insptr++;
|
2013-12-28 17:04:31 +00:00
|
|
|
// NOTE: assumes that current actor is APLAYER
|
|
|
|
P_DropWeapon(P_GetP(vm.g_sp));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_NULLOP:
|
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MIKESND:
|
2011-03-09 18:53:04 +00:00
|
|
|
insptr++;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(((unsigned)vm.g_sp->yvel >= MAXSOUNDS)))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-11-26 08:26:04 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", TrackerCast(vm.g_sp->yvel));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-07-15 01:26:38 +00:00
|
|
|
if (!S_CheckSoundPlaying(vm.g_i,vm.g_sp->yvel))
|
2009-06-19 01:10:10 +00:00
|
|
|
A_PlaySound(vm.g_sp->yvel,vm.g_i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_PKICK:
|
|
|
|
insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if ((g_netServer || ud.multimode > 1) && vm.g_sp->picnum == APLAYER)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
if (g_player[otherp].ps->quick_kick == 0)
|
|
|
|
g_player[otherp].ps->quick_kick = 14;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
else if (vm.g_sp->picnum != APLAYER && g_player[vm.g_p].ps->quick_kick == 0)
|
|
|
|
g_player[vm.g_p].ps->quick_kick = 14;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SIZETO:
|
|
|
|
insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t j = (*insptr++ - vm.g_sp->xrepeat)<<1;
|
2009-06-19 01:10:10 +00:00
|
|
|
vm.g_sp->xrepeat += ksgn(j);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
if ((vm.g_sp->picnum == APLAYER && vm.g_sp->yrepeat < 36) || *insptr < vm.g_sp->yrepeat ||
|
2014-09-30 04:14:21 +00:00
|
|
|
((vm.g_sp->yrepeat*(tilesiz[vm.g_sp->picnum].y+8))<<2) < (actor[vm.g_i].floorz - actor[vm.g_i].ceilingz))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
j = ((*insptr)-vm.g_sp->yrepeat)<<1;
|
|
|
|
if (klabs(j)) vm.g_sp->yrepeat += ksgn(j);
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SIZEAT:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->xrepeat = (uint8_t) *insptr++;
|
|
|
|
vm.g_sp->yrepeat = (uint8_t) *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SHOOT:
|
|
|
|
insptr++;
|
|
|
|
A_Shoot(vm.g_i,*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SOUNDONCE:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)*(++insptr) >= MAXSOUNDS))
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2009-07-15 01:26:38 +00:00
|
|
|
if (!S_CheckSoundPlaying(vm.g_i,*insptr++))
|
2009-06-19 01:10:10 +00:00
|
|
|
A_PlaySound(*(insptr-1),vm.g_i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-07-15 01:26:38 +00:00
|
|
|
case CON_IFACTORSOUND:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSOUNDS))
|
2009-07-15 01:26:38 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", j);
|
2009-07-15 01:26:38 +00:00
|
|
|
insptr++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(A_CheckSoundPlaying(i,j));
|
2009-07-15 01:26:38 +00:00
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFSOUND:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)*(++insptr) >= MAXSOUNDS))
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(S_CheckSoundPlaying(vm.g_i,*insptr));
|
2012-03-10 21:22:44 +00:00
|
|
|
// VM_DoConditional(SoundOwner[*insptr][0].ow == vm.g_i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_STOPSOUND:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)*(++insptr) >= MAXSOUNDS))
|
2008-08-11 10:17:18 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
insptr++;
|
|
|
|
continue;
|
2008-08-11 10:17:18 +00:00
|
|
|
}
|
2009-07-15 01:26:38 +00:00
|
|
|
if (S_CheckSoundPlaying(vm.g_i,*insptr))
|
2009-07-24 02:31:34 +00:00
|
|
|
S_StopSound((int16_t)*insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-07-15 01:26:38 +00:00
|
|
|
case CON_STOPACTORSOUND:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j>=MAXSOUNDS))
|
2009-07-15 01:26:38 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", j);
|
2009-07-15 01:26:38 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (A_CheckSoundPlaying(i,j))
|
|
|
|
S_StopEnvSound(j,i);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-11-03 23:08:54 +00:00
|
|
|
case CON_SETACTORSOUNDPITCH:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++), pitchoffset = Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j>=MAXSOUNDS))
|
2011-11-03 23:08:54 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", j);
|
2011-11-03 23:08:54 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
S_ChangeSoundPitch(j,i,pitchoffset);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GLOBALSOUND:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)*(++insptr) >= MAXSOUNDS))
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
insptr++;
|
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2012-08-13 18:26:06 +00:00
|
|
|
if (vm.g_p == screenpeek || (GametypeFlags[ud.coop]&GAMETYPE_COOPSOUND)
|
2014-01-12 14:04:51 +00:00
|
|
|
#ifdef SPLITSCREEN_MOD_HACKS
|
2012-08-22 22:51:38 +00:00
|
|
|
|| (g_fakeMultiMode==2)
|
2014-01-12 14:04:51 +00:00
|
|
|
#endif
|
2012-08-13 18:26:06 +00:00
|
|
|
)
|
2009-07-15 01:26:38 +00:00
|
|
|
A_PlaySound(*insptr,g_player[screenpeek].ps->i);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-09-30 06:51:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SOUND:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)*(++insptr) >= MAXSOUNDS))
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", (int32_t)*insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
insptr++;
|
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2009-07-15 01:26:38 +00:00
|
|
|
A_PlaySound(*insptr++,vm.g_i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_TIP:
|
|
|
|
insptr++;
|
|
|
|
g_player[vm.g_p].ps->tipincs = GAMETICSPERSEC;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-12-13 21:01:33 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_FALL:
|
|
|
|
insptr++;
|
2013-02-07 21:00:52 +00:00
|
|
|
VM_Fall(vm.g_i, vm.g_sp);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-12-13 21:01:33 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_RETURN:
|
2010-05-02 23:27:30 +00:00
|
|
|
vm.g_flags |= VM_RETURN;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ENDA:
|
|
|
|
case CON_BREAK:
|
|
|
|
case CON_ENDS:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
return;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_RIGHTBRACE:
|
2014-09-30 04:15:29 +00:00
|
|
|
loop--;
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2014-09-30 04:15:29 +00:00
|
|
|
continue;;
|
2012-08-10 19:11:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ADDAMMO:
|
2012-08-10 19:11:47 +00:00
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-08-10 19:11:47 +00:00
|
|
|
int32_t weap=*insptr++, amount=*insptr++;
|
|
|
|
DukePlayer_t *ps = g_player[vm.g_p].ps;
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)weap >= MAX_WEAPONS))
|
2012-08-10 19:11:47 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid weapon ID %d\n", weap);
|
2012-08-10 19:11:47 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ps->ammo_amount[weap] >= ps->max_ammo_amount[weap])
|
|
|
|
{
|
|
|
|
vm.g_flags |= VM_NOEXECUTE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-11-30 18:57:55 +00:00
|
|
|
P_AddWeaponAmmoCommon(ps, weap, amount);
|
2012-08-10 19:11:47 +00:00
|
|
|
|
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-12-13 21:01:33 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MONEY:
|
|
|
|
insptr++;
|
|
|
|
A_SpawnMultiple(vm.g_i, MONEY, *insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_MAIL:
|
|
|
|
insptr++;
|
|
|
|
A_SpawnMultiple(vm.g_i, MAIL, *insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SLEEPTIME:
|
|
|
|
insptr++;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[vm.g_i].timetosleep = (int16_t)*insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_PAPER:
|
|
|
|
insptr++;
|
|
|
|
A_SpawnMultiple(vm.g_i, PAPER, *insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_ADDKILLS:
|
|
|
|
insptr++;
|
|
|
|
g_player[vm.g_p].ps->actors_killed += *insptr++;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[vm.g_i].actorstayput = -1;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_LOTSOFGLASS:
|
|
|
|
insptr++;
|
|
|
|
A_SpawnGlass(vm.g_i,*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_KILLIT:
|
|
|
|
insptr++;
|
2010-05-02 23:27:30 +00:00
|
|
|
vm.g_flags |= VM_KILL;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_ADDWEAPON:
|
2012-08-10 19:11:47 +00:00
|
|
|
insptr++;
|
2008-12-13 21:01:33 +00:00
|
|
|
{
|
2012-08-10 19:11:47 +00:00
|
|
|
int32_t weap=*insptr++, amount=*insptr++;
|
|
|
|
VM_AddWeapon(weap, amount, g_player[vm.g_p].ps);
|
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-12-13 21:01:33 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DEBUG:
|
|
|
|
insptr++;
|
2012-03-05 07:24:04 +00:00
|
|
|
initprintf("%" PRIdPTR "\n",*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_ENDOFGAME:
|
2013-05-23 18:28:04 +00:00
|
|
|
case CON_ENDOFLEVEL:
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
|
|
|
g_player[vm.g_p].ps->timebeforeexit = *insptr++;
|
|
|
|
g_player[vm.g_p].ps->customexitsound = -1;
|
|
|
|
ud.eog = 1;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_ADDPHEALTH:
|
|
|
|
insptr++;
|
|
|
|
|
2007-12-20 19:14:38 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j;
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->newowner >= 0)
|
|
|
|
G_ClearCameraView(ps);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
j = sprite[ps->i].extra;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
if (vm.g_sp->picnum != ATOMICHEALTH)
|
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
if (j > ps->max_player_health && *insptr > 0)
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (j > 0)
|
|
|
|
j += *insptr;
|
2012-08-10 19:11:53 +00:00
|
|
|
if (j > ps->max_player_health && *insptr > 0)
|
|
|
|
j = ps->max_player_health;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-18 08:10:54 +00:00
|
|
|
else
|
2008-08-11 10:17:18 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
if (j > 0)
|
|
|
|
j += *insptr;
|
2012-08-10 19:11:53 +00:00
|
|
|
if (j > (ps->max_player_health<<1))
|
|
|
|
j = (ps->max_player_health<<1);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (j < 0) j = 0;
|
|
|
|
|
|
|
|
if (ud.god == 0)
|
|
|
|
{
|
|
|
|
if (*insptr > 0)
|
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
if ((j - *insptr) < (ps->max_player_health>>2) &&
|
|
|
|
j >= (ps->max_player_health>>2))
|
|
|
|
A_PlaySound(DUKE_GOTHEALTHATLOW,ps->i);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->last_extra = j;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
sprite[ps->i].extra = j;
|
2007-12-20 19:14:38 +00:00
|
|
|
}
|
|
|
|
}
|
2008-02-18 08:10:54 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_STATE:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
intptr_t *tempscrptr=insptr+2;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr = (intptr_t *) *(insptr+1);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_Execute(1);
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr = tempscrptr;
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-12-20 19:14:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_LEFTBRACE:
|
|
|
|
insptr++;
|
2014-09-30 04:15:29 +00:00
|
|
|
loop++;
|
|
|
|
// VM_Execute(1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_MOVE:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_COUNT(vm.g_t) = 0;
|
|
|
|
AC_MOVE_ID(vm.g_t) = *insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
vm.g_sp->hitag = *insptr++;
|
|
|
|
if (A_CheckEnemySprite(vm.g_sp) && vm.g_sp->extra <= 0) // hack
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
if (vm.g_sp->hitag&random_angle)
|
|
|
|
vm.g_sp->ang = krand()&2047;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_ADDWEAPONVAR:
|
|
|
|
insptr++;
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2012-08-10 19:11:47 +00:00
|
|
|
int32_t weap=Gv_GetVarX(*insptr++), amount=Gv_GetVarX(*insptr++);
|
|
|
|
VM_AddWeapon(weap, amount, g_player[vm.g_p].ps);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CON_ACTIVATEBYSECTOR:
|
|
|
|
case CON_OPERATESECTORS:
|
|
|
|
case CON_OPERATEACTIVATORS:
|
|
|
|
case CON_SETASPECT:
|
|
|
|
case CON_SSP:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t var1 = Gv_GetVarX(*insptr++), var2;
|
|
|
|
if (tw == CON_OPERATEACTIVATORS && *insptr == g_iThisActorID)
|
2008-08-10 10:53:55 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
var2 = vm.g_p;
|
|
|
|
insptr++;
|
2008-08-10 10:53:55 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
else var2 = Gv_GetVarX(*insptr++);
|
|
|
|
|
|
|
|
switch (tw)
|
2008-08-10 10:53:55 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ACTIVATEBYSECTOR:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)var1 >= (unsigned)numsectors))
|
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", var1);
|
|
|
|
break;
|
|
|
|
}
|
2011-02-25 21:50:19 +00:00
|
|
|
G_ActivateBySector(var1, var2);
|
2008-08-10 10:53:55 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_OPERATESECTORS:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)var1 >= (unsigned)numsectors))
|
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", var1);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
G_OperateSectors(var1, var2);
|
2008-08-10 10:53:55 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_OPERATEACTIVATORS:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)var2>=(unsigned)playerswhenstarted))
|
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Invalid player %d\n", var2);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
G_OperateActivators(var1, var2);
|
2008-08-10 10:53:55 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETASPECT:
|
|
|
|
setaspect(var1, var2);
|
2008-08-10 10:53:55 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SSP:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)var1 >= MAXSPRITES))
|
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Invalid sprite %d\n", var1);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
A_SetSprite(var1, var2);
|
2009-01-13 04:40:56 +00:00
|
|
|
break;
|
2008-08-10 10:53:55 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CON_CANSEESPR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t lVar1 = Gv_GetVarX(*insptr++), lVar2 = Gv_GetVarX(*insptr++), res;
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)lVar1 >= MAXSPRITES || (unsigned)lVar2 >= MAXSPRITES))
|
2008-08-10 10:53:55 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sprite %d\n", (unsigned)lVar1 >= MAXSPRITES ? lVar1 : lVar2);
|
2009-06-19 01:10:10 +00:00
|
|
|
res=0;
|
2008-08-10 10:53:55 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
else res=cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum,
|
2009-06-24 08:20:10 +00:00
|
|
|
sprite[lVar2].x,sprite[lVar2].y,sprite[lVar2].z,sprite[lVar2].sectnum);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
Gv_SetVarX(*insptr++, res);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CON_OPERATERESPAWNS:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
insptr++;
|
|
|
|
G_OperateRespawns(Gv_GetVarX(*insptr++));
|
|
|
|
continue;
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_OPERATEMASTERSWITCHES:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
G_OperateMasterSwitches(Gv_GetVarX(*insptr++));
|
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
case CON_CHECKACTIVATORMOTION:
|
|
|
|
insptr++;
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = G_CheckActivatorMotion(Gv_GetVarX(*insptr++));
|
|
|
|
continue;
|
2008-12-19 00:53:54 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_INSERTSPRITEQ:
|
|
|
|
insptr++;
|
|
|
|
A_AddToDeleteQueue(vm.g_i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-12-19 00:53:54 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_QSTRLEN:
|
|
|
|
insptr++;
|
2009-01-04 22:22:33 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t i=*insptr++;
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[j] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", j);
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(i,-1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(i,Bstrlen(ScriptQuotes[j]));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-04 22:22:33 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2013-06-01 06:55:00 +00:00
|
|
|
case CON_QSTRDIM:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
vec2_t dim = { 0, 0, };
|
|
|
|
|
|
|
|
int32_t w=*insptr++;
|
|
|
|
int32_t h=*insptr++;
|
|
|
|
|
|
|
|
int32_t tilenum = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t blockangle=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t q=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t orientation=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t xspace=Gv_GetVarX(*insptr++), yline=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t xbetween=Gv_GetVarX(*insptr++), ybetween=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t f=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
|
|
|
|
|
|
|
|
orientation &= (ROTATESPRITE_MAX-1);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(tilenum < 0 || tilenum+255 >= MAXTILES))
|
2013-06-01 06:55:00 +00:00
|
|
|
CON_ERRPRINTF("invalid base tilenum %d\n", tilenum);
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE((unsigned)q >= MAXQUOTES))
|
2013-06-01 06:55:00 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", q);
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE((ScriptQuotes[q] == NULL)))
|
2013-06-01 06:55:00 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", q);
|
|
|
|
else
|
2013-06-03 05:26:24 +00:00
|
|
|
dim = G_ScreenTextSize(tilenum,x,y,z,blockangle,ScriptQuotes[q],2|orientation,xspace,yline,xbetween,ybetween,f,x1,y1,x2,y2);
|
2013-06-01 06:55:00 +00:00
|
|
|
|
|
|
|
Gv_SetVarX(w,dim.x);
|
|
|
|
Gv_SetVarX(h,dim.y);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_HEADSPRITESTAT:
|
|
|
|
insptr++;
|
2009-01-04 22:22:33 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t i=*insptr++;
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j > MAXSTATUS))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid status list %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(i,headspritestat[j]);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-04 22:22:33 +00:00
|
|
|
}
|
2008-09-30 17:27:23 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_PREVSPRITESTAT:
|
|
|
|
insptr++;
|
2009-01-04 22:22:33 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t i=*insptr++;
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSPRITES))
|
2008-09-01 07:15:16 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite ID %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-09-01 07:15:16 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(i,prevspritestat[j]);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-04 22:22:33 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_NEXTSPRITESTAT:
|
|
|
|
insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t i=*insptr++;
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSPRITES))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite ID %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(i,nextspritestat[j]);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_HEADSPRITESECT:
|
|
|
|
insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t i=*insptr++;
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sector %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(i,headspritesect[j]);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_PREVSPRITESECT:
|
|
|
|
insptr++;
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t i=*insptr++;
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSPRITES))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite ID %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(i,prevspritesect[j]);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_NEXTSPRITESECT:
|
|
|
|
insptr++;
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t i=*insptr++;
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSPRITES))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite ID %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(i,nextspritesect[j]);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETKEYNAME:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i = Gv_GetVarX(*insptr++),
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
f = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)i >= MAXQUOTES))
|
2012-11-17 16:48:11 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", i);
|
2012-11-17 16:48:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE((ScriptQuotes[i] == NULL)))
|
2012-11-17 16:48:11 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", i);
|
2012-11-17 16:48:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE((unsigned)f >= NUMGAMEFUNCTIONS))
|
2012-11-17 16:48:11 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid function %d\n", f);
|
2012-11-17 16:48:11 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
else
|
2008-08-24 19:09:17 +00:00
|
|
|
{
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if (j < 2)
|
2009-06-19 01:10:10 +00:00
|
|
|
Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][j]));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][0]));
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (!*tempbuf)
|
|
|
|
Bstrcpy(tempbuf,KB_ScanCodeToString(ud.config.KeyboardKeys[f][1]));
|
|
|
|
}
|
2008-08-24 19:09:17 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
if (*tempbuf)
|
|
|
|
Bstrcpy(ScriptQuotes[i],tempbuf);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_QSUBSTR:
|
|
|
|
insptr++;
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
int32_t q1 = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t q2 = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t st = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t ln = Gv_GetVarX(*insptr++);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)q1>=MAXQUOTES))
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", q1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((ScriptQuotes[q1] == NULL)))
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", q1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)q2>=MAXQUOTES))
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", q2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((ScriptQuotes[q2] == NULL)))
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", q2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)st >= MAXQUOTELEN))
|
2014-08-31 11:15:22 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("invalid start position %d\n", st);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ln < 0))
|
2014-08-31 11:15:22 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("invalid length %d\n", ln);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
char *s1 = ScriptQuotes[q1];
|
|
|
|
char *s2 = ScriptQuotes[q2];
|
|
|
|
|
|
|
|
while (*s2 && st--) s2++;
|
|
|
|
while ((*s1 = *s2) && ln--)
|
|
|
|
{
|
|
|
|
s1++;
|
|
|
|
s2++;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
*s1=0;
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2006-11-13 23:12:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETPNAME:
|
2009-07-12 01:55:34 +00:00
|
|
|
case CON_QSTRNCAT:
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_QSTRCAT:
|
|
|
|
case CON_QSTRCPY:
|
|
|
|
case CON_QGETSYSSTR:
|
|
|
|
case CON_CHANGESPRITESECT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i = Gv_GetVarX(*insptr++), j;
|
|
|
|
if (tw == CON_GETPNAME && *insptr == g_iThisActorID)
|
|
|
|
{
|
|
|
|
j = vm.g_p;
|
|
|
|
insptr++;
|
|
|
|
}
|
|
|
|
else j = Gv_GetVarX(*insptr++);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
switch (tw)
|
|
|
|
{
|
|
|
|
case CON_GETPNAME:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[i] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", i);
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (g_player[j].user_name[0])
|
|
|
|
Bstrcpy(ScriptQuotes[i],g_player[j].user_name);
|
|
|
|
else Bsprintf(ScriptQuotes[i],"%d",j);
|
|
|
|
break;
|
|
|
|
case CON_QGETSYSSTR:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[i] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d %d\n", i,j);
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch (j)
|
|
|
|
{
|
|
|
|
case STR_MAPNAME:
|
|
|
|
case STR_MAPFILENAME:
|
2014-03-16 14:37:54 +00:00
|
|
|
{
|
|
|
|
int32_t idx = ud.volume_number*MAXLEVELS + ud.level_number;
|
|
|
|
const char *src;
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)idx >= ARRAY_SIZE(MapInfo)))
|
2014-03-16 14:37:54 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("out of bounds map number (vol=%d, lev=%d)\n",
|
|
|
|
ud.volume_number, ud.level_number);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
src = j==STR_MAPNAME ? MapInfo[idx].name : MapInfo[idx].filename;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(src == NULL))
|
2014-03-16 14:37:54 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("attempted access to %s of non-existent map (vol=%d, lev=%d)",
|
|
|
|
j==STR_MAPNAME ? "name" : "file name",
|
|
|
|
ud.volume_number, ud.level_number);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Bstrcpy(ScriptQuotes[i], j==STR_MAPNAME ? MapInfo[idx].name : MapInfo[idx].filename);
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
2014-03-16 14:37:54 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
case STR_PLAYERNAME:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_p >= (unsigned)playerswhenstarted))
|
2014-03-16 14:37:54 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Invalid player ID %d\n", vm.g_p);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Bstrcpy(ScriptQuotes[i],g_player[vm.g_p].user_name);
|
|
|
|
break;
|
|
|
|
case STR_VERSION:
|
2011-03-04 09:29:03 +00:00
|
|
|
Bsprintf(tempbuf,HEAD2 " %s",s_buildRev);
|
2009-06-19 01:10:10 +00:00
|
|
|
Bstrcpy(ScriptQuotes[i],tempbuf);
|
|
|
|
break;
|
|
|
|
case STR_GAMETYPE:
|
|
|
|
Bstrcpy(ScriptQuotes[i],GametypeNames[ud.coop]);
|
|
|
|
break;
|
|
|
|
case STR_VOLUMENAME:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)ud.volume_number >= MAXVOLUMES))
|
2014-03-16 14:37:54 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("invalid volume (%d)\n", ud.volume_number);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Bstrcpy(ScriptQuotes[i],EpisodeNames[ud.volume_number]);
|
|
|
|
break;
|
|
|
|
default:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("unknown str ID %d %d\n", i,j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CON_QSTRCAT:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL)) goto nullquote;
|
2009-06-19 01:10:10 +00:00
|
|
|
Bstrncat(ScriptQuotes[i],ScriptQuotes[j],(MAXQUOTELEN-1)-Bstrlen(ScriptQuotes[i]));
|
|
|
|
break;
|
2009-07-12 01:55:34 +00:00
|
|
|
case CON_QSTRNCAT:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL)) goto nullquote;
|
2009-07-12 01:55:34 +00:00
|
|
|
Bstrncat(ScriptQuotes[i],ScriptQuotes[j],Gv_GetVarX(*insptr++));
|
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_QSTRCPY:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[i] == NULL || ScriptQuotes[j] == NULL)) goto nullquote;
|
2013-02-21 18:53:42 +00:00
|
|
|
if (i != j)
|
|
|
|
Bstrcpy(ScriptQuotes[i],ScriptQuotes[j]);
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case CON_CHANGESPRITESECT:
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)i >= MAXSPRITES))
|
2010-01-16 23:08:17 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sprite %d\n", i);
|
2010-01-16 23:08:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE((unsigned)j >= (unsigned)numsectors))
|
2010-01-16 23:08:17 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", j);
|
2010-01-16 23:08:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
changespritesect(i,j);
|
|
|
|
break;
|
2009-07-12 01:55:34 +00:00
|
|
|
default:
|
|
|
|
nullquote:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", ScriptQuotes[i] ? j : i);
|
2009-07-12 01:55:34 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CHANGESPRITESTAT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)i >= MAXSPRITES))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sprite: %d\n", i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXSTATUS))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid statnum: %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2013-06-30 20:38:48 +00:00
|
|
|
if (sprite[i].statnum == j)
|
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
/* initialize actor data when changing to an actor statnum because there's usually
|
|
|
|
garbage left over from being handled as a hard coded object */
|
|
|
|
|
|
|
|
if (sprite[i].statnum > STAT_ZOMBIEACTOR && (j == STAT_ACTOR || j == STAT_ZOMBIEACTOR))
|
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
actor_t *a = &actor[i];
|
|
|
|
|
|
|
|
a->lastvx = 0;
|
|
|
|
a->lastvy = 0;
|
|
|
|
a->timetosleep = 0;
|
|
|
|
a->cgg = 0;
|
|
|
|
a->movflag = 0;
|
|
|
|
a->tempang = 0;
|
|
|
|
a->dispicnum = 0;
|
2009-06-19 01:10:10 +00:00
|
|
|
T1=T2=T3=T4=T5=T6=T7=T8=T9=0;
|
2013-06-30 20:38:48 +00:00
|
|
|
a->flags = 0;
|
2009-06-19 01:10:10 +00:00
|
|
|
sprite[i].hitag = 0;
|
2013-06-30 20:38:48 +00:00
|
|
|
|
|
|
|
if (G_HaveActor(sprite[i].picnum))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
const intptr_t *actorptr = g_tile[sprite[i].picnum].execPtr;
|
2011-12-21 18:40:47 +00:00
|
|
|
// offsets
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_ACTION_ID(a->t_data) = actorptr[1];
|
|
|
|
AC_MOVE_ID(a->t_data) = actorptr[2];
|
2013-06-30 20:38:52 +00:00
|
|
|
AC_MOVFLAGS(&sprite[i], &actor[i]) = actorptr[3]; // ai bits (movflags)
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
}
|
2013-06-30 20:38:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
changespritestat(i,j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-24 19:09:17 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_STARTLEVEL:
|
|
|
|
insptr++; // skip command
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// from 'level' cheat in game.c (about line 6250)
|
|
|
|
int32_t volnume=Gv_GetVarX(*insptr++), levnume=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((volnume > MAXVOLUMES-1 || volnume < 0)))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid volume (%d)\n", volnume);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((levnume > MAXLEVELS-1 || levnume < 0)))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid level (%d)\n", levnume);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ud.m_volume_number = ud.volume_number = volnume;
|
|
|
|
ud.m_level_number = ud.level_number = levnume;
|
2012-10-28 22:27:53 +00:00
|
|
|
//if (numplayers > 1 && g_netServer)
|
|
|
|
// Net_NewGame(volnume,levnume);
|
|
|
|
//else
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
g_player[myconnectindex].ps->gm |= MODE_EOL;
|
|
|
|
ud.display_bonus_screen = 0;
|
|
|
|
} // MODE_RESTART;
|
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-12-12 17:42:14 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MYOSX:
|
|
|
|
case CON_MYOSPALX:
|
|
|
|
case CON_MYOS:
|
|
|
|
case CON_MYOSPAL:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t shade=Gv_GetVarX(*insptr++), orientation=Gv_GetVarX(*insptr++);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
switch (tw)
|
|
|
|
{
|
|
|
|
case CON_MYOS:
|
|
|
|
G_DrawTile(x,y,tilenum,shade,orientation);
|
|
|
|
break;
|
|
|
|
case CON_MYOSPAL:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
int32_t pal=Gv_GetVarX(*insptr++);
|
|
|
|
G_DrawTilePal(x,y,tilenum,shade,orientation,pal);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MYOSX:
|
|
|
|
G_DrawTileSmall(x,y,tilenum,shade,orientation);
|
|
|
|
break;
|
|
|
|
case CON_MYOSPALX:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
int32_t pal=Gv_GetVarX(*insptr++);
|
|
|
|
G_DrawTilePalSmall(x,y,tilenum,shade,orientation,pal);
|
|
|
|
break;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SWITCH:
|
|
|
|
insptr++; // p-code
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// command format:
|
|
|
|
// variable ID to check
|
|
|
|
// script offset to 'end'
|
|
|
|
// count of case statements
|
|
|
|
// script offset to default case (null if none)
|
|
|
|
// For each case: value, ptr to code
|
|
|
|
//AddLog("Processing Switch...");
|
|
|
|
int32_t lValue=Gv_GetVarX(*insptr++), lEnd=*insptr++, lCases=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
intptr_t *lpDefault=insptr++, *lpCases=insptr;
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t bMatched=0, lCheckCase;
|
|
|
|
int32_t left,right;
|
2010-05-02 23:27:30 +00:00
|
|
|
insptr += lCases*2;
|
2009-06-19 01:10:10 +00:00
|
|
|
//Bsprintf(g_szBuf,"lEnd= %d *lpDefault=%d",lEnd,*lpDefault);
|
|
|
|
//AddLog(g_szBuf);
|
|
|
|
|
|
|
|
//Bsprintf(g_szBuf,"Checking %d cases for %d",lCases, lValue);
|
|
|
|
//AddLog(g_szBuf);
|
|
|
|
left=0; right=lCases-1;
|
|
|
|
while (!bMatched)
|
|
|
|
{
|
|
|
|
//Bsprintf(g_szBuf,"Checking #%d Value= %d",lCheckCase, lpCases[lCheckCase*2]);
|
|
|
|
//AddLog(g_szBuf);
|
|
|
|
lCheckCase=(left+right)/2;
|
|
|
|
// initprintf("(%2d..%2d..%2d) [%2d..%2d..%2d]==%2d\n",left,lCheckCase,right,lpCases[left*2],lpCases[lCheckCase*2],lpCases[right*2],lValue);
|
|
|
|
if (lpCases[lCheckCase*2] > lValue)
|
|
|
|
right=lCheckCase-1;
|
|
|
|
else if (lpCases[lCheckCase*2] < lValue)
|
|
|
|
left =lCheckCase+1;
|
|
|
|
else if (lpCases[lCheckCase*2] == lValue)
|
|
|
|
{
|
|
|
|
//AddLog("Found Case Match");
|
|
|
|
//Bsprintf(g_szBuf,"insptr=%d. lCheckCase=%d, offset=%d, &script[0]=%d",
|
|
|
|
// (int32_t)insptr,(int32_t)lCheckCase,lpCases[lCheckCase*2+1],(int32_t)&script[0]);
|
|
|
|
//AddLog(g_szBuf);
|
|
|
|
// fake a 2-d Array
|
2010-08-02 08:13:51 +00:00
|
|
|
insptr=(intptr_t *)(lpCases[lCheckCase*2+1] + &script[0]);
|
2009-06-19 01:10:10 +00:00
|
|
|
//Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr);
|
|
|
|
//AddLog(g_szBuf);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_Execute(1);
|
2009-06-19 01:10:10 +00:00
|
|
|
//AddLog("Done Executing Case");
|
|
|
|
bMatched=1;
|
|
|
|
}
|
|
|
|
if (right-left < 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!bMatched)
|
|
|
|
{
|
|
|
|
if (*lpDefault)
|
|
|
|
{
|
|
|
|
//AddLog("No Matching Case: Using Default");
|
2010-08-02 08:13:51 +00:00
|
|
|
insptr=(intptr_t *)(*lpDefault + &script[0]);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_Execute(1);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//AddLog("No Matching Case: No Default to use");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
insptr=(intptr_t *)(lEnd + (intptr_t)&script[0]);
|
|
|
|
//Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr);
|
|
|
|
//AddLog(g_szBuf);
|
|
|
|
//AddLog("Done Processing Switch");
|
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ENDSWITCH:
|
|
|
|
case CON_ENDEVENT:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DISPLAYRAND:
|
|
|
|
insptr++;
|
2011-11-05 12:13:50 +00:00
|
|
|
Gv_SetVarX(*insptr++, system_15bit_rand());
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DRAGPOINT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t wallnum = Gv_GetVarX(*insptr++), newx = Gv_GetVarX(*insptr++), newy = Gv_GetVarX(*insptr++);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((wallnum<0 || wallnum>=numwalls)))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid wall %d\n", wallnum);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2013-01-16 20:38:41 +00:00
|
|
|
dragpoint(wallnum,newx,newy,0);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_LDIST:
|
|
|
|
insptr++;
|
2008-08-10 13:07:07 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
Gv_SetVarX(distvar, ldist(&sprite[xvar],&sprite[yvar]));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CON_DIST:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES))
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Gv_SetVarX(distvar, dist(&sprite[xvar],&sprite[yvar]));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-10 13:07:07 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_GETANGLE:
|
|
|
|
insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t angvar = *insptr++;
|
|
|
|
int32_t xvar = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t yvar = Gv_GetVarX(*insptr++);
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
Gv_SetVarX(angvar, getangle(xvar,yvar));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CON_GETINCANGLE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t angvar = *insptr++;
|
|
|
|
int32_t xvar = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t yvar = Gv_GetVarX(*insptr++);
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(angvar, G_GetAngleDelta(xvar,yvar));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MULSCALE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t var1 = *insptr++, var2 = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t var3 = Gv_GetVarX(*insptr++), var4 = Gv_GetVarX(*insptr++);
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(var1, mulscale(var2, var3, var4));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_INITTIMER:
|
|
|
|
insptr++;
|
2013-02-16 18:52:56 +00:00
|
|
|
G_InitTimer(Gv_GetVarX(*insptr++));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-22 01:25:35 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_TIME:
|
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ESPAWNVAR:
|
|
|
|
case CON_EQSPAWNVAR:
|
|
|
|
case CON_QSPAWNVAR:
|
|
|
|
insptr++;
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t lIn=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t j;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-11-26 08:26:04 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
j = A_Spawn(vm.g_i, lIn);
|
|
|
|
switch (tw)
|
|
|
|
{
|
|
|
|
case CON_EQSPAWNVAR:
|
|
|
|
if (j != -1)
|
|
|
|
A_AddToDeleteQueue(j);
|
|
|
|
case CON_ESPAWNVAR:
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = j;
|
|
|
|
break;
|
|
|
|
case CON_QSPAWNVAR:
|
|
|
|
if (j != -1)
|
|
|
|
A_AddToDeleteQueue(j);
|
|
|
|
break;
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ESPAWN:
|
|
|
|
case CON_EQSPAWN:
|
|
|
|
case CON_QSPAWN:
|
|
|
|
insptr++;
|
2008-08-10 13:07:07 +00:00
|
|
|
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j;
|
2008-08-10 13:07:07 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-11-26 08:26:04 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
j = A_Spawn(vm.g_i,*insptr++);
|
|
|
|
|
|
|
|
switch (tw)
|
|
|
|
{
|
|
|
|
case CON_EQSPAWN:
|
|
|
|
if (j != -1)
|
|
|
|
A_AddToDeleteQueue(j);
|
|
|
|
case CON_ESPAWN:
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = j;
|
|
|
|
break;
|
|
|
|
case CON_QSPAWN:
|
|
|
|
if (j != -1)
|
|
|
|
A_AddToDeleteQueue(j);
|
|
|
|
break;
|
|
|
|
}
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-10 13:07:07 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ESHOOT:
|
|
|
|
case CON_EZSHOOT:
|
|
|
|
case CON_ZSHOOT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j;
|
2013-06-30 20:38:50 +00:00
|
|
|
// NOTE: (int16_t) cast because we want to exclude that
|
|
|
|
// SHOOT_HARDCODED_ZVEL is passed.
|
2013-02-07 21:01:12 +00:00
|
|
|
const int32_t zvel = (tw == CON_ESHOOT) ?
|
|
|
|
SHOOT_HARDCODED_ZVEL : (int16_t)Gv_GetVarX(*insptr++);
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-11-26 08:26:04 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-02-07 21:01:12 +00:00
|
|
|
j = A_ShootWithZvel(vm.g_i,*insptr++,zvel);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (tw != CON_ZSHOOT)
|
2009-06-19 01:10:10 +00:00
|
|
|
aGameVars[g_iReturnVarID].val.lValue = j;
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-10 13:07:07 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SHOOTVAR:
|
|
|
|
case CON_ESHOOTVAR:
|
2010-05-02 23:27:30 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-11-26 08:26:04 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum));
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
j = A_Shoot(vm.g_i, j);
|
|
|
|
if (tw == CON_ESHOOTVAR)
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = j;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_EZSHOOTVAR:
|
|
|
|
case CON_ZSHOOTVAR:
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
2013-02-07 21:01:12 +00:00
|
|
|
const int32_t zvel = (int16_t)Gv_GetVarX(*insptr++);
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-11-26 08:26:04 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", TrackerCast(vm.g_sp->sectnum));
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-02-07 21:01:12 +00:00
|
|
|
j = A_ShootWithZvel(vm.g_i, j, zvel);
|
2010-05-02 23:27:30 +00:00
|
|
|
if (tw == CON_EZSHOOTVAR)
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = j;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CMENU:
|
2008-06-29 10:40:37 +00:00
|
|
|
insptr++;
|
2012-10-14 22:16:07 +00:00
|
|
|
M_ChangeMenu(Gv_GetVarX(*insptr++));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SOUNDVAR:
|
|
|
|
case CON_STOPSOUNDVAR:
|
|
|
|
case CON_SOUNDONCEVAR:
|
|
|
|
case CON_GLOBALSOUNDVAR:
|
2013-06-28 14:07:46 +00:00
|
|
|
case CON_SCREENSOUND:
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2007-03-11 00:47:32 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j>=MAXSOUNDS))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sound %d\n", j);
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
switch (tw)
|
|
|
|
{
|
|
|
|
case CON_SOUNDONCEVAR:
|
2009-07-15 01:26:38 +00:00
|
|
|
if (!S_CheckSoundPlaying(vm.g_i,j))
|
2009-06-19 01:10:10 +00:00
|
|
|
A_PlaySound((int16_t)j,vm.g_i);
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GLOBALSOUNDVAR:
|
|
|
|
A_PlaySound((int16_t)j,g_player[screenpeek].ps->i);
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_STOPSOUNDVAR:
|
2009-07-15 01:26:38 +00:00
|
|
|
if (S_CheckSoundPlaying(vm.g_i,j))
|
2009-07-24 02:31:34 +00:00
|
|
|
S_StopSound((int16_t)j);
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SOUNDVAR:
|
|
|
|
A_PlaySound((int16_t)j,vm.g_i);
|
2010-05-02 23:27:30 +00:00
|
|
|
continue;
|
2013-06-28 14:07:46 +00:00
|
|
|
case CON_SCREENSOUND:
|
|
|
|
A_PlaySound(j, -1);
|
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-13 01:28:50 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GUNIQHUDID:
|
|
|
|
insptr++;
|
2008-08-09 10:43:27 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned) j >= MAXUNIQHUDID-1))
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid ID %d\n", j);
|
2014-10-25 03:36:34 +00:00
|
|
|
else guniqhudid = j;
|
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 10:43:27 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SAVEGAMEVAR:
|
|
|
|
case CON_READGAMEVAR:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
int32_t i=0;
|
|
|
|
insptr++;
|
|
|
|
if (ud.config.scripthandle < 0)
|
2008-08-09 10:43:27 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 10:43:27 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
switch (tw)
|
|
|
|
{
|
|
|
|
case CON_SAVEGAMEVAR:
|
|
|
|
i=Gv_GetVarX(*insptr);
|
|
|
|
SCRIPT_PutNumber(ud.config.scripthandle, "Gamevars",aGameVars[*insptr++].szLabel,i,FALSE,FALSE);
|
|
|
|
break;
|
|
|
|
case CON_READGAMEVAR:
|
|
|
|
SCRIPT_GetNumber(ud.config.scripthandle, "Gamevars",aGameVars[*insptr].szLabel,&i);
|
|
|
|
Gv_SetVarX(*insptr++, i);
|
|
|
|
break;
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2007-02-13 01:28:50 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SHOWVIEW:
|
2012-03-31 11:22:00 +00:00
|
|
|
case CON_SHOWVIEWUNBIASED:
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t y=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t z=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t a=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t horiz=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t sect=Gv_GetVarX(*insptr++);
|
2012-03-31 11:22:00 +00:00
|
|
|
int32_t x1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t y1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t y2=Gv_GetVarX(*insptr++);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(x1 < 0 || y1 < 0 || x2 >= 320 || y2 >= 200))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("incorrect coordinates\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2013-06-07 14:26:32 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sect >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", sect);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
2013-06-07 14:26:32 +00:00
|
|
|
G_ShowView(x, y, z, a, horiz, sect, x1, y1, x2, y2, (tw != CON_SHOWVIEW));
|
2007-03-11 00:47:32 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2013-03-25 04:33:03 +00:00
|
|
|
case CON_ROTATESPRITEA:
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ROTATESPRITE16:
|
|
|
|
case CON_ROTATESPRITE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t a=Gv_GetVarX(*insptr++), tilenum=Gv_GetVarX(*insptr++), shade=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t pal=Gv_GetVarX(*insptr++), orientation=Gv_GetVarX(*insptr++);
|
2013-03-25 04:33:03 +00:00
|
|
|
int32_t alpha = (tw == CON_ROTATESPRITEA) ? Gv_GetVarX(*insptr++) : 0;
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-04-09 18:51:35 +00:00
|
|
|
int32_t blendidx = 0;
|
|
|
|
|
2013-03-25 04:33:03 +00:00
|
|
|
if (tw != CON_ROTATESPRITE16 && !(orientation&ROTATESPRITE_FULL16))
|
2010-05-02 23:27:30 +00:00
|
|
|
{
|
|
|
|
x<<=16;
|
|
|
|
y<<=16;
|
|
|
|
}
|
2010-03-01 03:04:57 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)tilenum >= MAXTILES))
|
2011-10-30 19:46:51 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid tilenum %d\n", tilenum);
|
2011-10-30 19:46:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(x < -(320<<16) || x >= (640<<16) || y < -(200<<16) || y >= (400<<16)))
|
2010-03-01 03:04:57 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid coordinates: %d, %d\n", x, y);
|
2010-03-01 03:04:57 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-08-19 12:57:57 +00:00
|
|
|
orientation &= (ROTATESPRITE_MAX-1);
|
|
|
|
|
2014-04-09 18:51:35 +00:00
|
|
|
NEG_ALPHA_TO_BLEND(alpha, blendidx, orientation);
|
|
|
|
|
|
|
|
rotatesprite_(x,y,z,a,tilenum,shade,pal,2|orientation,alpha,blendidx,x1,y1,x2,y2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GAMETEXT:
|
|
|
|
case CON_GAMETEXTZ:
|
|
|
|
insptr++;
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t tilenum = Gv_GetVarX(*insptr++);
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), q=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t shade=Gv_GetVarX(*insptr++), pal=Gv_GetVarX(*insptr++);
|
2010-05-02 23:27:30 +00:00
|
|
|
int32_t orientation=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t z = (tw == CON_GAMETEXTZ) ? Gv_GetVarX(*insptr++) : 65536;
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(tilenum < 0 || tilenum+255 >= MAXTILES))
|
2011-10-30 19:46:51 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid base tilenum %d\n", tilenum);
|
2011-10-30 19:46:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)q >= MAXQUOTES))
|
2011-10-30 19:46:51 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", q);
|
2011-10-30 19:46:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[q] == NULL))
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", q);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
|
|
|
|
2012-08-19 12:57:57 +00:00
|
|
|
orientation &= (ROTATESPRITE_MAX-1);
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
G_PrintGameText(0,tilenum,x>>1,y,ScriptQuotes[q],shade,pal,orientation,x1,y1,x2,y2,z);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CON_DIGITALNUMBER:
|
|
|
|
case CON_DIGITALNUMBERZ:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t tilenum = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), q=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t shade=Gv_GetVarX(*insptr++), pal=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t orientation=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t z = (tw == CON_DIGITALNUMBERZ) ? Gv_GetVarX(*insptr++) : 65536;
|
|
|
|
|
2012-03-25 22:01:21 +00:00
|
|
|
// NOTE: '-' not taken into account, but we have rotatesprite() bound check now anyway
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(tilenum < 0 || tilenum+9 >= MAXTILES))
|
2011-10-30 19:46:51 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid base tilenum %d\n", tilenum);
|
2011-10-30 19:46:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
G_DrawTXDigiNumZ(tilenum,x,y,q,shade,pal,orientation,x1,y1,x2,y2,z);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CON_MINITEXT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), q=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t shade=Gv_GetVarX(*insptr++), pal=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)q >= MAXQUOTES))
|
2011-10-30 19:46:51 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", q);
|
2011-10-30 19:46:51 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[q] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", q);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2012-08-19 13:02:37 +00:00
|
|
|
minitextshade(x,y,ScriptQuotes[q],shade,pal, 2+8+16);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2013-06-01 06:55:00 +00:00
|
|
|
case CON_SCREENTEXT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t tilenum = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t blockangle=Gv_GetVarX(*insptr++), charangle=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t q=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t shade=Gv_GetVarX(*insptr++), pal=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t orientation=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t alpha=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t xspace=Gv_GetVarX(*insptr++), yline=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t xbetween=Gv_GetVarX(*insptr++), ybetween=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t f=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(tilenum < 0 || tilenum+255 >= MAXTILES))
|
2013-06-01 06:55:00 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("invalid base tilenum %d\n", tilenum);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)q >= MAXQUOTES))
|
2013-06-01 06:55:00 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", q);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[q] == NULL))
|
2013-06-01 06:55:00 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("null quote %d\n", q);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
orientation &= (ROTATESPRITE_MAX-1);
|
|
|
|
|
2013-07-20 03:36:28 +00:00
|
|
|
G_ScreenText(tilenum,x,y,z,blockangle,charangle,ScriptQuotes[q],shade,pal,2|orientation,alpha,xspace,yline,xbetween,ybetween,f,x1,y1,x2,y2);
|
2013-06-01 06:55:00 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ANGOFF:
|
|
|
|
insptr++;
|
|
|
|
spriteext[vm.g_i].angoff=*insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETZRANGE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
vec3_t vect;
|
|
|
|
|
|
|
|
vect.x = Gv_GetVarX(*insptr++);
|
|
|
|
vect.y = Gv_GetVarX(*insptr++);
|
|
|
|
vect.z = Gv_GetVarX(*insptr++);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
int32_t sectnum=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t ceilzvar=*insptr++, ceilhitvar=*insptr++, florzvar=*insptr++, florhitvar=*insptr++;
|
|
|
|
int32_t walldist=Gv_GetVarX(*insptr++), clipmask=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t ceilz, ceilhit, florz, florhit;
|
2009-01-13 12:23:18 +00:00
|
|
|
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sectnum >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", sectnum);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
getzrange(&vect, sectnum, &ceilz, &ceilhit, &florz, &florhit, walldist, clipmask);
|
|
|
|
Gv_SetVarX(ceilzvar, ceilz);
|
|
|
|
Gv_SetVarX(ceilhitvar, ceilhit);
|
|
|
|
Gv_SetVarX(florzvar, florz);
|
|
|
|
Gv_SetVarX(florhitvar, florhit);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
2010-09-27 21:52:04 +00:00
|
|
|
case CON_SECTSETINTERPOLATION:
|
|
|
|
case CON_SECTCLEARINTERPOLATION:
|
|
|
|
insptr++;
|
|
|
|
{
|
2011-07-01 17:15:07 +00:00
|
|
|
int32_t sectnum = Gv_GetVarX(*insptr++);
|
2010-09-27 21:52:04 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sectnum >= (unsigned)numsectors))
|
2010-09-27 21:52:04 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", sectnum);
|
2010-09-27 21:52:04 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tw==CON_SECTSETINTERPOLATION)
|
2011-07-01 17:15:07 +00:00
|
|
|
Sect_SetInterpolation(sectnum);
|
2010-09-27 21:52:04 +00:00
|
|
|
else
|
2011-07-01 17:15:07 +00:00
|
|
|
Sect_ClearInterpolation(sectnum);
|
2010-09-27 21:52:04 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CON_CALCHYPOTENUSE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t retvar=*insptr++;
|
|
|
|
int64_t dax=Gv_GetVarX(*insptr++), day=Gv_GetVarX(*insptr++);
|
|
|
|
int64_t hypsq = dax*dax + day*day;
|
|
|
|
|
2012-09-02 14:06:30 +00:00
|
|
|
if (hypsq > (int64_t)INT32_MAX)
|
2010-09-27 21:52:04 +00:00
|
|
|
Gv_SetVarX(retvar, (int32_t)sqrt((double)hypsq));
|
|
|
|
else
|
2012-07-01 22:11:14 +00:00
|
|
|
Gv_SetVarX(retvar, ksqrt((uint32_t)hypsq));
|
2010-09-27 21:52:04 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CON_LINEINTERSECT:
|
|
|
|
case CON_RAYINTERSECT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++), z1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x3=Gv_GetVarX(*insptr++), y3=Gv_GetVarX(*insptr++), x4=Gv_GetVarX(*insptr++), y4=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t intxvar=*insptr++, intyvar=*insptr++, intzvar=*insptr++, retvar=*insptr++;
|
|
|
|
int32_t intx, inty, intz, ret;
|
|
|
|
|
|
|
|
if (tw==CON_LINEINTERSECT)
|
|
|
|
ret = lineintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz);
|
|
|
|
else
|
|
|
|
ret = rayintersect(x1, y1, z1, x2, y2, z2, x3, y3, x4, y4, &intx, &inty, &intz);
|
|
|
|
|
|
|
|
Gv_SetVarX(retvar, ret);
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
Gv_SetVarX(intxvar, intx);
|
|
|
|
Gv_SetVarX(intyvar, inty);
|
|
|
|
Gv_SetVarX(intzvar, intz);
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case CON_CLIPMOVE:
|
2010-10-09 22:59:17 +00:00
|
|
|
case CON_CLIPMOVENOSLIDE:
|
2010-09-27 21:52:04 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
vec3_t vect;
|
|
|
|
int32_t retvar=*insptr++, xvar=*insptr++, yvar=*insptr++, z=Gv_GetVarX(*insptr++), sectnumvar=*insptr++;
|
|
|
|
int32_t xvect=Gv_GetVarX(*insptr++), yvect=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t walldist=Gv_GetVarX(*insptr++), floordist=Gv_GetVarX(*insptr++), ceildist=Gv_GetVarX(*insptr++);
|
2013-05-24 13:54:36 +00:00
|
|
|
int32_t clipmask=Gv_GetVarX(*insptr++);
|
2010-09-27 21:52:04 +00:00
|
|
|
int16_t sectnum;
|
|
|
|
|
|
|
|
vect.x = Gv_GetVarX(xvar);
|
|
|
|
vect.y = Gv_GetVarX(yvar);
|
|
|
|
vect.z = z;
|
|
|
|
sectnum = Gv_GetVarX(sectnumvar);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sectnum >= (unsigned)numsectors))
|
2010-09-27 21:52:04 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", sectnum);
|
2010-09-27 21:52:04 +00:00
|
|
|
Gv_SetVarX(retvar, 0);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-05-24 13:54:36 +00:00
|
|
|
Gv_SetVarX(retvar, clipmovex(&vect, §num, xvect, yvect, walldist, floordist, ceildist,
|
|
|
|
clipmask, (tw==CON_CLIPMOVENOSLIDE)));
|
2010-09-27 21:52:04 +00:00
|
|
|
Gv_SetVarX(sectnumvar, sectnum);
|
|
|
|
Gv_SetVarX(xvar, vect.x);
|
|
|
|
Gv_SetVarX(yvar, vect.y);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_HITSCAN:
|
|
|
|
insptr++;
|
2008-08-09 10:43:27 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
vec3_t vect;
|
2012-08-10 19:12:01 +00:00
|
|
|
hitdata_t hit;
|
2009-01-13 12:23:18 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
vect.x = Gv_GetVarX(*insptr++);
|
|
|
|
vect.y = Gv_GetVarX(*insptr++);
|
|
|
|
vect.z = Gv_GetVarX(*insptr++);
|
2009-01-13 12:23:18 +00:00
|
|
|
|
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t sectnum=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t vx=Gv_GetVarX(*insptr++), vy=Gv_GetVarX(*insptr++), vz=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t hitsectvar=*insptr++, hitwallvar=*insptr++, hitspritevar=*insptr++;
|
|
|
|
int32_t hitxvar=*insptr++, hityvar=*insptr++, hitzvar=*insptr++, cliptype=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sectnum >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", sectnum);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2012-08-10 19:12:01 +00:00
|
|
|
hitscan((const vec3_t *)&vect, sectnum, vx, vy, vz, &hit, cliptype);
|
|
|
|
Gv_SetVarX(hitsectvar, hit.sect);
|
|
|
|
Gv_SetVarX(hitwallvar, hit.wall);
|
|
|
|
Gv_SetVarX(hitspritevar, hit.sprite);
|
|
|
|
Gv_SetVarX(hitxvar, hit.pos.x);
|
|
|
|
Gv_SetVarX(hityvar, hit.pos.y);
|
|
|
|
Gv_SetVarX(hitzvar, hit.pos.z);
|
2009-01-13 12:23:18 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 10:43:27 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CANSEE:
|
|
|
|
insptr++;
|
2008-08-09 10:43:27 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t x1=Gv_GetVarX(*insptr++), y1=Gv_GetVarX(*insptr++), z1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t sect1=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2=Gv_GetVarX(*insptr++), y2=Gv_GetVarX(*insptr++), z2=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t sect2=Gv_GetVarX(*insptr++), rvar=*insptr++;
|
2009-01-13 12:23:18 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sect1 >= (unsigned)numsectors || (unsigned)sect2 >= (unsigned)numsectors))
|
2009-01-13 12:23:18 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector\n");
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(rvar, 0);
|
2009-01-13 12:23:18 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(rvar, cansee(x1,y1,z1,sect1,x2,y2,z2,sect2));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-07-25 01:09:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ROTATEPOINT:
|
|
|
|
insptr++;
|
2008-07-25 01:09:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t xpivot=Gv_GetVarX(*insptr++), ypivot=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), daang=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t x2var=*insptr++, y2var=*insptr++;
|
|
|
|
int32_t x2, y2;
|
|
|
|
|
|
|
|
rotatepoint(xpivot,ypivot,x,y,daang,&x2,&y2);
|
|
|
|
Gv_SetVarX(x2var, x2);
|
|
|
|
Gv_SetVarX(y2var, y2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-07-25 01:09:39 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_NEARTAG:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// neartag(int32_t x, int32_t y, int32_t z, short sectnum, short ang, //Starting position & angle
|
|
|
|
// short *neartagsector, //Returns near sector if sector[].tag != 0
|
|
|
|
// short *neartagwall, //Returns near wall if wall[].tag != 0
|
|
|
|
// short *neartagsprite, //Returns near sprite if sprite[].tag != 0
|
|
|
|
// int32_t *neartaghitdist, //Returns actual distance to object (scale: 1024=largest grid size)
|
|
|
|
// int32_t neartagrange, //Choose maximum distance to scan (scale: 1024=largest grid size)
|
|
|
|
// char tagsearch) //1-lotag only, 2-hitag only, 3-lotag&hitag
|
|
|
|
|
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++), z=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t sectnum=Gv_GetVarX(*insptr++), ang=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t neartagsectorvar=*insptr++, neartagwallvar=*insptr++, neartagspritevar=*insptr++, neartaghitdistvar=*insptr++;
|
|
|
|
int32_t neartagrange=Gv_GetVarX(*insptr++), tagsearch=Gv_GetVarX(*insptr++);
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2014-01-31 21:13:00 +00:00
|
|
|
int16_t neartagsector, neartagwall, neartagsprite;
|
|
|
|
int32_t neartaghitdist;
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sectnum >= (unsigned)numsectors))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", sectnum);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2012-02-20 19:54:24 +00:00
|
|
|
neartag(x, y, z, sectnum, ang, &neartagsector, &neartagwall, &neartagsprite,
|
|
|
|
&neartaghitdist, neartagrange, tagsearch, NULL);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(neartagsectorvar, neartagsector);
|
|
|
|
Gv_SetVarX(neartagwallvar, neartagwall);
|
|
|
|
Gv_SetVarX(neartagspritevar, neartagsprite);
|
|
|
|
Gv_SetVarX(neartaghitdistvar, neartaghitdist);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 10:43:27 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETTIMEDATE:
|
|
|
|
insptr++;
|
|
|
|
{
|
2013-02-16 18:53:00 +00:00
|
|
|
int32_t i, vals[8];
|
|
|
|
|
|
|
|
G_GetTimeDate(vals);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2013-02-16 18:53:00 +00:00
|
|
|
for (i=0; i<8; i++)
|
|
|
|
Gv_SetVarX(*insptr++, vals[i]);
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MOVESPRITE:
|
|
|
|
case CON_SETSPRITE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t spritenum = Gv_GetVarX(*insptr++);
|
|
|
|
vec3_t davector;
|
2008-08-10 13:13:24 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
davector.x = Gv_GetVarX(*insptr++);
|
|
|
|
davector.y = Gv_GetVarX(*insptr++);
|
|
|
|
davector.z = Gv_GetVarX(*insptr++);
|
2009-01-13 04:40:56 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (tw == CON_SETSPRITE)
|
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)spritenum >= MAXSPRITES))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite ID %d\n", spritenum);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
setsprite(spritenum, &davector);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2008-08-09 11:19:27 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t cliptype = Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)spritenum >= MAXSPRITES))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite ID %d\n", spritenum);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(*insptr++, A_MoveSprite(spritenum, &davector, cliptype));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 11:19:27 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETFLORZOFSLOPE:
|
|
|
|
case CON_GETCEILZOFSLOPE:
|
|
|
|
insptr++;
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t sectnum = Gv_GetVarX(*insptr++), x = Gv_GetVarX(*insptr++), y = Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)sectnum >= (unsigned)numsectors))
|
2008-08-09 10:43:27 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid sector %d\n", sectnum);
|
2008-08-09 10:43:27 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 10:43:27 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (tw == CON_GETFLORZOFSLOPE)
|
|
|
|
{
|
|
|
|
Gv_SetVarX(*insptr++, getflorzofslope(sectnum,x,y));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(*insptr++, getceilzofslope(sectnum,x,y));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-07-25 01:09:39 +00:00
|
|
|
}
|
2006-12-18 08:37:12 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_UPDATESECTOR:
|
|
|
|
case CON_UPDATESECTORZ:
|
|
|
|
insptr++;
|
2006-12-18 08:37:12 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t x=Gv_GetVarX(*insptr++), y=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t z=(tw==CON_UPDATESECTORZ)?Gv_GetVarX(*insptr++):0;
|
|
|
|
int32_t var=*insptr++;
|
|
|
|
int16_t w=sprite[vm.g_i].sectnum;
|
|
|
|
|
|
|
|
if (tw==CON_UPDATESECTOR) updatesector(x,y,&w);
|
|
|
|
else updatesectorz(x,y,z,&w);
|
|
|
|
|
|
|
|
Gv_SetVarX(var, w);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-18 08:37:12 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SPAWN:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS)
|
|
|
|
{
|
|
|
|
insptr++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
A_Spawn(vm.g_i,*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFWASWEAPON:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(actor[vm.g_i].picnum == *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFAI:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
VM_CONDITIONAL(AC_AI_ID(vm.g_t) == *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFACTION:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
VM_CONDITIONAL(AC_ACTION_ID(vm.g_t) == *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFACTIONCOUNT:
|
2007-02-08 04:19:39 +00:00
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
VM_CONDITIONAL(AC_ACTION_COUNT(vm.g_t) >= *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_RESETACTIONCOUNT:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_ACTION_COUNT(vm.g_t) = 0;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-19 20:31:40 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DEBRIS:
|
|
|
|
insptr++;
|
2008-09-15 02:47:02 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t dnum = *insptr++;
|
|
|
|
int32_t s, l, j;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)vm.g_sp->sectnum < MAXSECTORS)
|
2009-06-19 01:10:10 +00:00
|
|
|
for (j=(*insptr)-1; j>=0; j--)
|
|
|
|
{
|
|
|
|
if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1)
|
|
|
|
s = 0;
|
|
|
|
else s = (krand()%3);
|
|
|
|
|
|
|
|
l = A_InsertSprite(vm.g_sp->sectnum,
|
2009-06-24 08:20:10 +00:00
|
|
|
vm.g_sp->x+(krand()&255)-128,vm.g_sp->y+(krand()&255)-128,vm.g_sp->z-(8<<8)-(krand()&8191),
|
|
|
|
dnum+s,vm.g_sp->shade,32+(krand()&15),32+(krand()&15),
|
|
|
|
krand()&2047,(krand()&127)+32,
|
|
|
|
-(krand()&2047),vm.g_i,5);
|
2009-06-19 01:10:10 +00:00
|
|
|
if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1)
|
|
|
|
sprite[l].yvel = BlimpSpawnSprites[j%14];
|
|
|
|
else sprite[l].yvel = -1;
|
|
|
|
sprite[l].pal = vm.g_sp->pal;
|
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_COUNT:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_COUNT(vm.g_t) = (int16_t) *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-01-05 22:30:35 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CSTATOR:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->cstat |= (int16_t) *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CLIPDIST:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->clipdist = (int16_t) *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CSTAT:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->cstat = (int16_t) *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SAVENN:
|
|
|
|
case CON_SAVE:
|
|
|
|
insptr++;
|
2006-11-15 01:16:55 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
g_lastSaveSlot = *insptr++;
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2014-05-17 12:36:40 +00:00
|
|
|
if ((unsigned)g_lastSaveSlot >= MAXSAVEGAMES)
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2010-05-02 23:27:30 +00:00
|
|
|
|
|
|
|
if (tw == CON_SAVE || ud.savegame[g_lastSaveSlot][0] == 0)
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:43 +00:00
|
|
|
time_t curtime = time(NULL);
|
2014-05-17 12:36:40 +00:00
|
|
|
struct tm *timeptr = localtime(&curtime);
|
|
|
|
Bsnprintf(ud.savegame[g_lastSaveSlot], sizeof(ud.savegame[g_lastSaveSlot]), "Auto %.4d%.2d%.2d %.2d%.2d%.2d\n",
|
|
|
|
timeptr->tm_year + 1900, timeptr->tm_mon, timeptr->tm_mday,
|
|
|
|
timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
OSD_Printf("Saving to slot %d\n",g_lastSaveSlot);
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
KB_FlushKeyboardQueue();
|
2009-01-07 14:05:13 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
g_screenCapture = 1;
|
|
|
|
G_DrawRooms(myconnectindex,65536);
|
|
|
|
g_screenCapture = 0;
|
2012-09-05 17:25:43 +00:00
|
|
|
|
|
|
|
G_SavePlayerMaybeMulti(g_lastSaveSlot);
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_QUAKE:
|
|
|
|
insptr++;
|
2013-02-11 17:16:50 +00:00
|
|
|
g_earthquakeTime = Gv_GetVarX(*insptr++);
|
2009-06-19 01:10:10 +00:00
|
|
|
A_PlaySound(EARTHQUAKE,g_player[screenpeek].ps->i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFMOVE:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
VM_CONDITIONAL(AC_MOVE_ID(vm.g_t) == *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_RESETPLAYER:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
insptr++;
|
2013-02-07 21:00:52 +00:00
|
|
|
vm.g_flags = VM_ResetPlayer(vm.g_p, vm.g_flags);
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFONWATER:
|
2012-10-14 20:41:21 +00:00
|
|
|
VM_CONDITIONAL(sector[vm.g_sp->sectnum].lotag == ST_1_ABOVE_WATER && klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFINWATER:
|
2012-10-14 20:41:21 +00:00
|
|
|
VM_CONDITIONAL(sector[vm.g_sp->sectnum].lotag == ST_2_UNDERWATER);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFCOUNT:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
VM_CONDITIONAL(AC_COUNT(vm.g_t) >= *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFACTOR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(vm.g_sp->picnum == *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_RESETCOUNT:
|
|
|
|
insptr++;
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_COUNT(vm.g_t) = 0;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ADDINVENTORY:
|
2012-08-10 19:11:53 +00:00
|
|
|
{
|
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
insptr += 2;
|
2009-06-19 01:10:10 +00:00
|
|
|
switch (*(insptr-1))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
case GET_STEROIDS:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_STEROIDS] = *insptr;
|
2012-11-04 23:41:05 +00:00
|
|
|
ps->inven_icon = ICON_STEROIDS;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case GET_SHIELD:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_SHIELD] += *insptr;// 100;
|
|
|
|
if (ps->inv_amount[GET_SHIELD] > ps->max_shield_amount)
|
|
|
|
ps->inv_amount[GET_SHIELD] = ps->max_shield_amount;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case GET_SCUBA:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_SCUBA] = *insptr;// 1600;
|
2012-11-04 23:41:05 +00:00
|
|
|
ps->inven_icon = ICON_SCUBA;
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case GET_HOLODUKE:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_HOLODUKE] = *insptr;// 1600;
|
2012-11-04 23:41:05 +00:00
|
|
|
ps->inven_icon = ICON_HOLODUKE;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case GET_JETPACK:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_JETPACK] = *insptr;// 1600;
|
2012-11-04 23:41:05 +00:00
|
|
|
ps->inven_icon = ICON_JETPACK;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case GET_ACCESS:
|
|
|
|
switch (vm.g_sp->pal)
|
|
|
|
{
|
|
|
|
case 0:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->got_access |= 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case 21:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->got_access |= 2;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case 23:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->got_access |= 4;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case GET_HEATS:
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_HEATS] = *insptr;
|
2012-11-04 23:41:05 +00:00
|
|
|
ps->inven_icon = ICON_HEATS;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
2008-02-16 22:18:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case GET_FIRSTAID:
|
2012-11-04 23:41:05 +00:00
|
|
|
ps->inven_icon = ICON_FIRSTAID;
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_FIRSTAID] = *insptr;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case GET_BOOTS:
|
2012-11-04 23:41:05 +00:00
|
|
|
ps->inven_icon = ICON_BOOTS;
|
2012-08-10 19:11:53 +00:00
|
|
|
ps->inv_amount[GET_BOOTS] = *insptr;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid inventory ID %d\n", (int32_t)*(insptr-1));
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2012-08-10 19:11:53 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_HITRADIUSVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t v1=Gv_GetVarX(*insptr++),v2=Gv_GetVarX(*insptr++),v3=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t v4=Gv_GetVarX(*insptr++),v5=Gv_GetVarX(*insptr++);
|
|
|
|
A_RadiusDamage(vm.g_i,v1,v2,v3,v4,v5);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_HITRADIUS:
|
|
|
|
A_RadiusDamage(vm.g_i,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5));
|
2010-05-02 23:27:30 +00:00
|
|
|
insptr += 6;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFP:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
int32_t l = *(++insptr);
|
|
|
|
int32_t j = 0;
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
int32_t s = sprite[ps->i].xvel;
|
2009-06-24 08:20:10 +00:00
|
|
|
|
2012-08-10 19:11:53 +00:00
|
|
|
if ((l&8) && ps->on_ground && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_CROUCH))
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&16) && ps->jumping_counter == 0 && !ps->on_ground &&
|
|
|
|
ps->vel.z > 2048)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&32) && ps->jumping_counter > 348)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
|
|
|
else if ((l&1) && s >= 0 && s < 8)
|
|
|
|
j = 1;
|
|
|
|
else if ((l&2) && s >= 8 && !TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN))
|
|
|
|
j = 1;
|
|
|
|
else if ((l&4) && s >= 8 && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN))
|
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&64) && ps->pos.z < (vm.g_sp->z-(48<<8)))
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
|
|
|
else if ((l&128) && s <= -8 && !TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN))
|
|
|
|
j = 1;
|
|
|
|
else if ((l&256) && s <= -8 && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_RUN))
|
|
|
|
j = 1;
|
2014-10-25 03:25:57 +00:00
|
|
|
else if ((l&512) && (ps->quick_kick > 0 || (PWEAPON(vm.g_p, ps->curr_weapon, WorksLike) == KNEE_WEAPON && ps->kickback_pic > 0)))
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&1024) && sprite[ps->i].xrepeat < 32)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&2048) && ps->jetpack_on)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&4096) && ps->inv_amount[GET_STEROIDS] > 0 && ps->inv_amount[GET_STEROIDS] < 400)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&8192) && ps->on_ground)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&16384) && sprite[ps->i].xrepeat > 32 && sprite[ps->i].extra > 0 && ps->timebeforeexit == 0)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2012-08-10 19:11:53 +00:00
|
|
|
else if ((l&32768) && sprite[ps->i].extra <= 0)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
|
|
|
else if ((l&65536L))
|
|
|
|
{
|
2010-01-16 23:08:17 +00:00
|
|
|
if (vm.g_sp->picnum == APLAYER && (g_netServer || ud.multimode > 1))
|
2012-08-10 19:11:53 +00:00
|
|
|
j = G_GetAngleDelta(g_player[otherp].ps->ang,getangle(ps->pos.x-g_player[otherp].ps->pos.x,ps->pos.y-g_player[otherp].ps->pos.y));
|
2009-06-24 08:20:10 +00:00
|
|
|
else
|
2012-08-10 19:11:53 +00:00
|
|
|
j = G_GetAngleDelta(ps->ang,getangle(vm.g_sp->x-ps->pos.x,vm.g_sp->y-ps->pos.y));
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
if (j > -128 && j < 128)
|
2009-06-19 01:10:10 +00:00
|
|
|
j = 1;
|
2009-06-24 08:20:10 +00:00
|
|
|
else
|
|
|
|
j = 0;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL((intptr_t) j);
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFSTRENGTH:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(vm.g_sp->extra <= *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_GUTS:
|
|
|
|
A_DoGuts(vm.g_i,*(insptr+1),*(insptr+2));
|
|
|
|
insptr += 3;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFSPAWNEDBY:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(actor[vm.g_i].picnum == *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_WACKPLAYER:
|
|
|
|
insptr++;
|
|
|
|
P_ForceAngle(g_player[vm.g_p].ps);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_FLASH:
|
|
|
|
insptr++;
|
|
|
|
sprite[vm.g_i].shade = -127;
|
|
|
|
g_player[vm.g_p].ps->visibility = -127;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SAVEMAPSTATE:
|
2013-05-19 19:29:26 +00:00
|
|
|
G_SaveMapState();
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_LOADMAPSTATE:
|
2013-05-19 19:29:26 +00:00
|
|
|
G_RestoreMapState();
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_CLEARMAPSTATE:
|
|
|
|
insptr++;
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= MAXVOLUMES*MAXLEVELS))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid map number: %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2013-05-19 19:29:23 +00:00
|
|
|
|
|
|
|
G_FreeMapState(j);
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_STOPALLSOUNDS:
|
|
|
|
insptr++;
|
|
|
|
if (screenpeek == vm.g_p)
|
|
|
|
FX_StopAllSounds();
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFGAPZL:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(((actor[vm.g_i].floorz - actor[vm.g_i].ceilingz) >> 8) < *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFHITSPACE:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_OPEN));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFOUTSIDE:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(sector[vm.g_sp->sectnum].ceilingstat&1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFMULTIPLAYER:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL((g_netServer || g_netClient || ud.multimode > 1));
|
2010-07-22 20:29:09 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case CON_IFCLIENT:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(g_netClient != NULL);
|
2010-07-22 20:29:09 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case CON_IFSERVER:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(g_netServer != NULL);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_OPERATE:
|
|
|
|
insptr++;
|
|
|
|
if (sector[vm.g_sp->sectnum].lotag == 0)
|
|
|
|
{
|
2014-01-31 21:13:00 +00:00
|
|
|
int16_t neartagsector, neartagwall, neartagsprite;
|
|
|
|
int32_t neartaghitdist;
|
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang,
|
2012-02-20 19:54:24 +00:00
|
|
|
&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist, 768, 4+1, NULL);
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag))
|
2012-09-08 22:18:44 +00:00
|
|
|
if ((sector[neartagsector].lotag&0xff) == ST_23_SWINGING_DOOR || sector[neartagsector].floorz == sector[neartagsector].ceilingz)
|
2014-01-31 21:13:00 +00:00
|
|
|
if ((sector[neartagsector].lotag&(16384|32768)) == 0)
|
|
|
|
{
|
|
|
|
int32_t j;
|
|
|
|
|
|
|
|
for (SPRITES_OF_SECT(neartagsector, j))
|
|
|
|
if (sprite[j].picnum == ACTIVATOR)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (j == -1)
|
|
|
|
G_OperateSectors(neartagsector,vm.g_i);
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFINSPACE:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(G_CheckForSpaceCeiling(vm.g_sp->sectnum));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SPRITEPAL:
|
|
|
|
insptr++;
|
|
|
|
if (vm.g_sp->picnum != APLAYER)
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[vm.g_i].tempang = vm.g_sp->pal;
|
2009-06-19 01:10:10 +00:00
|
|
|
vm.g_sp->pal = *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CACTOR:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->picnum = *insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFBULLETNEAR:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(A_Dodge(vm.g_sp) == 1);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFRESPAWN:
|
2012-05-14 18:12:27 +00:00
|
|
|
if (A_CheckEnemySprite(vm.g_sp)) VM_CONDITIONAL(ud.respawn_monsters)
|
|
|
|
else if (A_CheckInventorySprite(vm.g_sp)) VM_CONDITIONAL(ud.respawn_inventory)
|
|
|
|
else VM_CONDITIONAL(ud.respawn_items)
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFFLOORDISTL:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL((actor[vm.g_i].floorz - vm.g_sp->z) <= ((*insptr)<<8));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFCEILINGDISTL:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL((vm.g_sp->z - actor[vm.g_i].ceilingz) <= ((*insptr)<<8));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_PALFROM:
|
|
|
|
insptr++;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_p >= (unsigned)playerswhenstarted))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid player ID %d\n", vm.g_p);
|
2012-04-28 21:56:38 +00:00
|
|
|
insptr += 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-05 22:24:50 +00:00
|
|
|
uint8_t f=*insptr++, r=*insptr++, g=*insptr++, b=*insptr++;
|
2012-04-28 21:56:38 +00:00
|
|
|
|
2012-05-05 22:24:50 +00:00
|
|
|
P_PalFrom(g_player[vm.g_p].ps, f, r,g,b);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-07-12 01:55:34 +00:00
|
|
|
case CON_SECTOROFWALL:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = *insptr++;
|
|
|
|
|
|
|
|
Gv_SetVarX(j, sectorofwall(Gv_GetVarX(*insptr++)));
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-07-12 01:55:34 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_QSPRINTF:
|
|
|
|
insptr++;
|
2008-08-09 12:42:02 +00:00
|
|
|
{
|
2009-07-24 02:31:34 +00:00
|
|
|
int32_t dq = Gv_GetVarX(*insptr++), sq = Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[sq] == NULL || ScriptQuotes[dq] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", ScriptQuotes[sq] ? dq : sq);
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2009-07-15 01:26:38 +00:00
|
|
|
while ((*insptr & 0xFFF) != CON_NULLOP)
|
|
|
|
Gv_GetVarX(*insptr++);
|
|
|
|
|
|
|
|
insptr++; // skip the NOP
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2013-02-18 16:07:56 +00:00
|
|
|
int32_t arg[32], i = 0, j = 0, k = 0, numargs;
|
2009-07-12 01:55:34 +00:00
|
|
|
int32_t len = Bstrlen(ScriptQuotes[sq]);
|
|
|
|
char tempbuf[MAXQUOTELEN];
|
|
|
|
|
2009-07-15 01:26:38 +00:00
|
|
|
while ((*insptr & 0xFFF) != CON_NULLOP && i < 32)
|
2009-07-12 01:55:34 +00:00
|
|
|
arg[i++] = Gv_GetVarX(*insptr++);
|
2013-02-18 16:07:56 +00:00
|
|
|
numargs = i;
|
2009-07-12 01:55:34 +00:00
|
|
|
|
|
|
|
insptr++; // skip the NOP
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
while (k < len && j < MAXQUOTELEN && ScriptQuotes[sq][k] != '%')
|
|
|
|
tempbuf[j++] = ScriptQuotes[sq][k++];
|
|
|
|
|
|
|
|
if (ScriptQuotes[sq][k] == '%')
|
|
|
|
{
|
|
|
|
k++;
|
|
|
|
switch (ScriptQuotes[sq][k])
|
|
|
|
{
|
|
|
|
case 'l':
|
2009-07-15 01:26:38 +00:00
|
|
|
if (ScriptQuotes[sq][k+1] != 'd')
|
|
|
|
{
|
|
|
|
// write the % and l
|
|
|
|
tempbuf[j++] = ScriptQuotes[sq][k-1];
|
|
|
|
tempbuf[j++] = ScriptQuotes[sq][k++];
|
|
|
|
break;
|
|
|
|
}
|
2009-07-12 01:55:34 +00:00
|
|
|
k++;
|
|
|
|
case 'd':
|
|
|
|
{
|
|
|
|
char buf[16];
|
2013-02-18 16:07:56 +00:00
|
|
|
int32_t ii;
|
2009-07-12 01:55:34 +00:00
|
|
|
|
2013-02-18 16:07:56 +00:00
|
|
|
if (i >= numargs)
|
|
|
|
goto finish_qsprintf;
|
2009-07-12 23:41:16 +00:00
|
|
|
Bsprintf(buf, "%d", arg[i++]);
|
2009-07-15 01:26:38 +00:00
|
|
|
|
|
|
|
ii = Bstrlen(buf);
|
|
|
|
Bmemcpy(&tempbuf[j], buf, ii);
|
|
|
|
j += ii;
|
2009-07-12 01:55:34 +00:00
|
|
|
k++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 's':
|
2009-07-15 01:26:38 +00:00
|
|
|
{
|
2013-02-18 16:07:56 +00:00
|
|
|
int32_t ii;
|
|
|
|
|
|
|
|
if (i >= numargs)
|
|
|
|
goto finish_qsprintf;
|
|
|
|
ii = Bstrlen(ScriptQuotes[arg[i]]);
|
2009-07-15 01:26:38 +00:00
|
|
|
|
|
|
|
Bmemcpy(&tempbuf[j], ScriptQuotes[arg[i]], ii);
|
|
|
|
j += ii;
|
2013-02-18 16:07:56 +00:00
|
|
|
i++;
|
2009-07-12 01:55:34 +00:00
|
|
|
k++;
|
2009-07-15 01:26:38 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-07-12 01:55:34 +00:00
|
|
|
|
|
|
|
default:
|
2009-07-15 01:26:38 +00:00
|
|
|
tempbuf[j++] = ScriptQuotes[sq][k-1];
|
2009-07-12 01:55:34 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (k < len && j < MAXQUOTELEN);
|
2013-02-18 16:07:56 +00:00
|
|
|
finish_qsprintf:
|
2009-07-12 01:55:34 +00:00
|
|
|
tempbuf[j] = '\0';
|
2013-02-18 16:07:56 +00:00
|
|
|
Bstrncpyz(ScriptQuotes[dq], tempbuf, MAXQUOTELEN);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-08-09 12:42:02 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ADDLOG:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
OSD_Printf(OSDTEXT_GREEN "CONLOG: L=%d\n",g_errorLineNum);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ADDLOGVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t m=1;
|
|
|
|
char szBuf[256];
|
|
|
|
int32_t lVarID = *insptr;
|
2008-08-25 20:25:49 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if ((lVarID >= g_gameVarCount) || lVarID < 0)
|
|
|
|
{
|
|
|
|
if (*insptr==MAXGAMEVARS) // addlogvar for a constant? Har.
|
|
|
|
insptr++;
|
|
|
|
// else if (*insptr > g_gameVarCount && (*insptr < (MAXGAMEVARS<<1)+MAXGAMEVARS+1+MAXGAMEARRAYS))
|
|
|
|
else if (*insptr&(MAXGAMEVARS<<2))
|
|
|
|
{
|
|
|
|
int32_t index;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
lVarID ^= (MAXGAMEVARS<<2);
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (lVarID&(MAXGAMEVARS<<1))
|
|
|
|
{
|
|
|
|
m = -m;
|
|
|
|
lVarID ^= (MAXGAMEVARS<<1);
|
|
|
|
}
|
2008-04-01 03:32:36 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2008-04-27 06:54:28 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
index=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_TRUE((unsigned)index < (unsigned)aGameArrays[lVarID].size))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-05-18 21:40:20 +00:00
|
|
|
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n", keyw[g_tw], g_errorLineNum,
|
|
|
|
aGameArrays[lVarID].szLabel, index,
|
|
|
|
(int32_t)(m*aGameArrays[lVarID].plValues[index]));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid array index\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (*insptr&(MAXGAMEVARS<<3))
|
2008-04-27 06:54:28 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// FIXME FIXME FIXME
|
|
|
|
if ((lVarID & (MAXGAMEVARS-1)) == g_iActorVarID)
|
|
|
|
{
|
|
|
|
intptr_t *oinsptr = insptr++;
|
|
|
|
int32_t index = Gv_GetVarX(*insptr++);
|
|
|
|
insptr = oinsptr;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)index >= MAXSPRITES-1))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid array index\n");
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_GetVarX(*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %d %d\n",keyw[g_tw],g_errorLineNum,index,Gv_GetVar(*insptr++,index,vm.g_p));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-04-27 06:54:28 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_TRUE(*insptr&(MAXGAMEVARS<<1)))
|
2008-04-01 03:32:36 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
m = -m;
|
|
|
|
lVarID ^= (MAXGAMEVARS<<1);
|
2008-04-01 03:32:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// invalid varID
|
|
|
|
insptr++;
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid variable\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue; // out of switch
|
2008-04-01 03:32:36 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Bsprintf(szBuf,"CONLOGVAR: L=%d %s ",g_errorLineNum, aGameVars[lVarID].szLabel);
|
|
|
|
strcpy(g_szBuf,szBuf);
|
|
|
|
|
|
|
|
if (aGameVars[lVarID].dwFlags & GAMEVAR_READONLY)
|
2009-01-07 14:05:13 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
Bsprintf(szBuf," (read-only)");
|
|
|
|
strcat(g_szBuf,szBuf);
|
|
|
|
}
|
|
|
|
if (aGameVars[lVarID].dwFlags & GAMEVAR_PERPLAYER)
|
|
|
|
{
|
|
|
|
Bsprintf(szBuf," (Per Player. Player=%d)",vm.g_p);
|
2009-01-07 14:05:13 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
else if (aGameVars[lVarID].dwFlags & GAMEVAR_PERACTOR)
|
2008-04-27 06:54:28 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
Bsprintf(szBuf," (Per Actor. Actor=%d)",vm.g_i);
|
2008-04-27 06:54:28 +00:00
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
else
|
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
Bsprintf(szBuf," (Global)");
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Bstrcat(g_szBuf,szBuf);
|
|
|
|
Bsprintf(szBuf," =%d\n", Gv_GetVarX(lVarID)*m);
|
|
|
|
Bstrcat(g_szBuf,szBuf);
|
|
|
|
OSD_Printf(OSDTEXT_GREEN "%s",g_szBuf);
|
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETSECTOR:
|
|
|
|
case CON_GETSECTOR:
|
2007-02-08 04:19:39 +00:00
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
// syntax [gs]etsector[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_AccessSector(tw==CON_SETSECTOR, lVar1, lLabelID, lVar2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SQRT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax sqrt <invar> <outvar>
|
|
|
|
int32_t lInVarID=*insptr++, lOutVarID=*insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2012-07-01 22:11:14 +00:00
|
|
|
Gv_SetVarX(lOutVarID, ksqrt((uint32_t)Gv_GetVarX(lInVarID)));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-11-16 03:02:42 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_FINDNEARACTOR:
|
|
|
|
case CON_FINDNEARSPRITE:
|
|
|
|
case CON_FINDNEARACTOR3D:
|
|
|
|
case CON_FINDNEARSPRITE3D:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// 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>
|
|
|
|
int32_t lType=*insptr++, lMaxDist=*insptr++, lVarID=*insptr++;
|
|
|
|
int32_t lFound=-1, j, k = MAXSTATUS-1;
|
|
|
|
|
|
|
|
if (tw == CON_FINDNEARACTOR || tw == CON_FINDNEARACTOR3D)
|
|
|
|
k = 1;
|
2012-05-14 18:12:27 +00:00
|
|
|
|
|
|
|
if (tw==CON_FINDNEARSPRITE3D || tw==CON_FINDNEARACTOR3D)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
do
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
j=headspritestat[k]; // all sprites
|
2009-06-19 01:10:10 +00:00
|
|
|
while (j>=0)
|
|
|
|
{
|
|
|
|
if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist)
|
|
|
|
{
|
|
|
|
lFound=j;
|
|
|
|
j = MAXSPRITES;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
j = nextspritestat[j];
|
|
|
|
}
|
|
|
|
if (j == MAXSPRITES || tw == CON_FINDNEARACTOR3D)
|
|
|
|
break;
|
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
while (k--);
|
|
|
|
Gv_SetVarX(lVarID, lFound);
|
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2012-05-14 18:12:27 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
j=headspritestat[k]; // all sprites
|
2008-08-24 10:19:37 +00:00
|
|
|
while (j>=0)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
if (sprite[j].picnum == lType && j != vm.g_i && ldist(&sprite[vm.g_i], &sprite[j]) < lMaxDist)
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
|
|
|
lFound=j;
|
|
|
|
j = MAXSPRITES;
|
|
|
|
break;
|
|
|
|
}
|
2008-08-24 10:19:37 +00:00
|
|
|
j = nextspritestat[j];
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-12-19 00:53:54 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (j == MAXSPRITES || tw == CON_FINDNEARACTOR)
|
2008-12-19 00:53:54 +00:00
|
|
|
break;
|
2008-08-24 10:19:37 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
while (k--);
|
|
|
|
Gv_SetVarX(lVarID, lFound);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-24 06:17:09 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_FINDNEARACTORVAR:
|
|
|
|
case CON_FINDNEARSPRITEVAR:
|
|
|
|
case CON_FINDNEARACTOR3DVAR:
|
|
|
|
case CON_FINDNEARSPRITE3DVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax findnearactorvar <type> <maxdistvar> <getvar>
|
|
|
|
// gets the sprite ID of the nearest actor within max dist
|
|
|
|
// that is of <type> into <getvar>
|
|
|
|
// -1 for none found
|
|
|
|
// <type> <maxdistvarid> <varid>
|
|
|
|
int32_t lType=*insptr++, lMaxDist=Gv_GetVarX(*insptr++), lVarID=*insptr++;
|
|
|
|
int32_t lFound=-1, j, k = 1;
|
2008-08-24 10:19:37 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (tw == CON_FINDNEARSPRITEVAR || tw == CON_FINDNEARSPRITE3DVAR)
|
|
|
|
k = MAXSTATUS-1;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2012-05-14 18:12:27 +00:00
|
|
|
if (tw==CON_FINDNEARACTOR3DVAR || tw==CON_FINDNEARSPRITE3DVAR)
|
2008-08-24 10:19:37 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
do
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-05-14 18:12:27 +00:00
|
|
|
j=headspritestat[k]; // all sprites
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
while (j >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[j].picnum == lType && j != vm.g_i && dist(&sprite[vm.g_i], &sprite[j]) < lMaxDist)
|
|
|
|
{
|
|
|
|
lFound=j;
|
|
|
|
j = MAXSPRITES;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
j = nextspritestat[j];
|
|
|
|
}
|
|
|
|
if (j == MAXSPRITES || tw==CON_FINDNEARACTOR3DVAR)
|
|
|
|
break;
|
|
|
|
}
|
2012-05-14 18:12:27 +00:00
|
|
|
while (k--);
|
|
|
|
Gv_SetVarX(lVarID, lFound);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
j=headspritestat[k]; // all sprites
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2008-08-24 10:19:37 +00:00
|
|
|
while (j >= 0)
|
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
if (sprite[j].picnum == lType && j != vm.g_i && ldist(&sprite[vm.g_i], &sprite[j]) < lMaxDist)
|
2008-08-24 10:19:37 +00:00
|
|
|
{
|
|
|
|
lFound=j;
|
|
|
|
j = MAXSPRITES;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
j = nextspritestat[j];
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
if (j == MAXSPRITES || tw==CON_FINDNEARACTORVAR)
|
2008-12-19 00:53:54 +00:00
|
|
|
break;
|
2008-08-24 10:19:37 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
while (k--);
|
|
|
|
Gv_SetVarX(lVarID, lFound);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-12-19 00:53:54 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_FINDNEARACTORZVAR:
|
|
|
|
case CON_FINDNEARSPRITEZVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax findnearactorvar <type> <maxdistvar> <getvar>
|
|
|
|
// gets the sprite ID of the nearest actor within max dist
|
|
|
|
// that is of <type> into <getvar>
|
|
|
|
// -1 for none found
|
|
|
|
// <type> <maxdistvarid> <varid>
|
|
|
|
int32_t lType=*insptr++, lMaxDist=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t lMaxZDist=Gv_GetVarX(*insptr++);
|
|
|
|
int32_t lVarID=*insptr++, lFound=-1, lTemp, lTemp2, j, k=MAXSTATUS-1;
|
|
|
|
do
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
j=headspritestat[tw==CON_FINDNEARACTORZVAR?1:k]; // all sprites
|
|
|
|
if (j == -1) continue;
|
|
|
|
do
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
if (sprite[j].picnum == lType && j != vm.g_i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
lTemp=ldist(&sprite[vm.g_i], &sprite[j]);
|
|
|
|
if (lTemp < lMaxDist)
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
lTemp2=klabs(sprite[vm.g_i].z-sprite[j].z);
|
|
|
|
if (lTemp2 < lMaxZDist)
|
|
|
|
{
|
|
|
|
lFound=j;
|
|
|
|
j = MAXSPRITES;
|
|
|
|
break;
|
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
j = nextspritestat[j];
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
while (j>=0);
|
|
|
|
if (tw==CON_FINDNEARACTORZVAR || j == MAXSPRITES)
|
|
|
|
break;
|
2008-08-24 06:17:09 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
while (k--);
|
|
|
|
Gv_SetVarX(lVarID, lFound);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_FINDNEARACTORZ:
|
|
|
|
case CON_FINDNEARSPRITEZ:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// 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>
|
|
|
|
int32_t lType=*insptr++, lMaxDist=*insptr++, lMaxZDist=*insptr++, lVarID=*insptr++;
|
|
|
|
int32_t lTemp, lTemp2, lFound=-1, j, k=MAXSTATUS-1;
|
2008-08-24 03:19:40 +00:00
|
|
|
do
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
j=headspritestat[tw==CON_FINDNEARACTORZ?1:k]; // all sprites
|
|
|
|
if (j == -1) continue;
|
|
|
|
do
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
if (sprite[j].picnum == lType && j != vm.g_i)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
lTemp=ldist(&sprite[vm.g_i], &sprite[j]);
|
|
|
|
if (lTemp < lMaxDist)
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
lTemp2=klabs(sprite[vm.g_i].z-sprite[j].z);
|
|
|
|
if (lTemp2 < lMaxZDist)
|
|
|
|
{
|
|
|
|
lFound=j;
|
|
|
|
j = MAXSPRITES;
|
|
|
|
break;
|
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
j = nextspritestat[j];
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
while (j>=0);
|
2009-07-12 01:55:34 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (tw==CON_FINDNEARACTORZ || j == MAXSPRITES)
|
|
|
|
break;
|
2008-08-24 06:17:09 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
while (k--);
|
|
|
|
Gv_SetVarX(lVarID, lFound);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-24 06:17:09 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_FINDPLAYER:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j;
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = A_FindPlayer(&sprite[vm.g_i],&j);
|
|
|
|
Gv_SetVarX(*insptr++, j);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_FINDOTHERPLAYER:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j;
|
|
|
|
// Gv_SetVarX(g_iReturnVarID, P_FindOtherPlayer(vm.g_p,&j));
|
|
|
|
aGameVars[g_iReturnVarID].val.lValue = P_FindOtherPlayer(vm.g_p,&j);
|
|
|
|
Gv_SetVarX(*insptr++, j);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETPLAYER:
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax [gs]etplayer[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2;
|
|
|
|
// HACK: need to have access to labels structure at run-time...
|
|
|
|
|
|
|
|
if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2)
|
|
|
|
lParm2=Gv_GetVarX(*insptr++);
|
|
|
|
lVar2=*insptr++;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_SetPlayer(lVar1, lLabelID, lVar2, lParm2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETPLAYER:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax [gs]etplayer[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0, lVar2;
|
|
|
|
// HACK: need to have access to labels structure at run-time...
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (PlayerLabels[lLabelID].flags & LABEL_HASPARM2)
|
|
|
|
lParm2=Gv_GetVarX(*insptr++);
|
|
|
|
lVar2=*insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_GetPlayer(lVar1, lLabelID, lVar2, lParm2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETINPUT:
|
|
|
|
case CON_GETINPUT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax [gs]etplayer[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_AccessPlayerInput(tw==CON_SETINPUT, lVar1, lLabelID, lVar2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETUSERDEF:
|
|
|
|
case CON_SETUSERDEF:
|
|
|
|
insptr++;
|
2008-08-09 12:29:23 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// syntax [gs]etuserdef.xxx <VAR>
|
|
|
|
// <xxxid> <varid>
|
|
|
|
int32_t lLabelID=*insptr++, lVar2=*insptr++;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_AccessUserdef(tw==CON_SETUSERDEF, lLabelID, lVar2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 12:29:23 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETPROJECTILE:
|
|
|
|
case CON_SETPROJECTILE:
|
|
|
|
insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// syntax [gs]etplayer[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int32_t lVar1=Gv_GetVarX(*insptr++), lLabelID=*insptr++, lVar2=*insptr++;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_AccessProjectile(tw==CON_SETPROJECTILE,lVar1,lLabelID,lVar2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETWALL:
|
|
|
|
case CON_GETWALL:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax [gs]etwall[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_AccessWall(tw==CON_SETWALL, lVar1, lLabelID, lVar2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETACTORVAR:
|
|
|
|
case CON_GETACTORVAR:
|
2007-02-08 04:19:39 +00:00
|
|
|
insptr++;
|
2007-02-05 01:33:08 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// syntax [gs]etactorvar[<var>].<varx> <VAR>
|
|
|
|
// gets the value of the per-actor variable varx into VAR
|
|
|
|
// <var> <varx> <VAR>
|
|
|
|
int32_t lSprite=Gv_GetVarX(*insptr++), lVar1=*insptr++;
|
|
|
|
int32_t lVar2=*insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)lSprite >= MAXSPRITES))
|
2008-08-09 12:29:23 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid sprite ID %d\n", lSprite);
|
2009-06-19 01:10:10 +00:00
|
|
|
if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
|
|
|
|
if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-09 12:29:23 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (tw == CON_SETACTORVAR)
|
2007-02-08 04:19:39 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVar(lVar1, Gv_GetVarX(lVar2), lSprite, vm.g_p);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(lVar2, Gv_GetVar(lVar1, lSprite, vm.g_p));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-05 01:33:08 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETPLAYERVAR:
|
|
|
|
case CON_GETPLAYERVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t iPlayer = vm.g_p;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (*insptr != g_iThisActorID)
|
|
|
|
iPlayer=Gv_GetVarX(*insptr);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t lVar1=*insptr++, lVar2=*insptr++;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)iPlayer >= (unsigned)playerswhenstarted))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid player ID %d\n", iPlayer);
|
2009-06-19 01:10:10 +00:00
|
|
|
if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
|
|
|
|
if (lVar2 == MAXGAMEVARS || lVar2 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (tw == CON_SETPLAYERVAR)
|
|
|
|
{
|
|
|
|
Gv_SetVar(lVar1, Gv_GetVarX(lVar2), vm.g_i, iPlayer);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(lVar2, Gv_GetVar(lVar1, vm.g_i, iPlayer));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-12-13 07:23:13 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETACTOR:
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax [gs]etactor[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0;
|
|
|
|
|
|
|
|
if (ActorLabels[lLabelID].flags & LABEL_HASPARM2)
|
|
|
|
lParm2=Gv_GetVarX(*insptr++);
|
|
|
|
|
|
|
|
{
|
|
|
|
int32_t lVar2=*insptr++;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_SetSprite(lVar1, lLabelID, lVar2, lParm2);
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETACTOR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
// syntax [gs]etactor[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
2008-07-13 07:10:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lParm2 = 0;
|
2008-07-13 07:10:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (ActorLabels[lLabelID].flags & LABEL_HASPARM2)
|
|
|
|
lParm2=Gv_GetVarX(*insptr++);
|
2008-07-13 07:10:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
int32_t lVar2=*insptr++;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_GetSprite(lVar1, lLabelID, lVar2, lParm2);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETTSPR:
|
|
|
|
case CON_GETTSPR:
|
2009-01-18 07:32:35 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
// syntax [gs]etactor[<var>].x <VAR>
|
|
|
|
// <varid> <xxxid> <varid>
|
|
|
|
|
|
|
|
int32_t lVar1=*insptr++, lLabelID=*insptr++, lVar2=*insptr++;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_AccessTsprite(tw==CON_SETTSPR, lVar1, lLabelID, lVar2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2008-08-09 10:16:18 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETANGLETOTARGET:
|
|
|
|
insptr++;
|
2010-05-02 23:27:30 +00:00
|
|
|
// Actor[vm.g_i].lastvx and lastvy are last known location of target.
|
|
|
|
Gv_SetVarX(*insptr++, getangle(actor[vm.g_i].lastvx-vm.g_sp->x,actor[vm.g_i].lastvy-vm.g_sp->y));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_ANGOFFVAR:
|
|
|
|
insptr++;
|
|
|
|
spriteext[vm.g_i].angoff=Gv_GetVarX(*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_LOCKPLAYER:
|
|
|
|
insptr++;
|
|
|
|
g_player[vm.g_p].ps->transporter_hold=Gv_GetVarX(*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-04-01 02:50:44 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_CHECKAVAILWEAPON:
|
|
|
|
case CON_CHECKAVAILINVEN:
|
|
|
|
insptr++;
|
2008-08-24 03:19:40 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j = vm.g_p;
|
|
|
|
|
|
|
|
if (*insptr != g_iThisActorID)
|
|
|
|
j=Gv_GetVarX(*insptr);
|
|
|
|
|
|
|
|
insptr++;
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= (unsigned)playerswhenstarted))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid player ID %d\n", j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tw == CON_CHECKAVAILWEAPON)
|
|
|
|
P_CheckWeapon(g_player[j].ps);
|
|
|
|
else P_SelectNextInvItem(g_player[j].ps);
|
2008-08-24 03:19:40 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_GETPLAYERANGLE:
|
|
|
|
insptr++;
|
|
|
|
Gv_SetVarX(*insptr++, g_player[vm.g_p].ps->ang);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SETPLAYERANGLE:
|
|
|
|
insptr++;
|
|
|
|
g_player[vm.g_p].ps->ang=Gv_GetVarX(*insptr++);
|
|
|
|
g_player[vm.g_p].ps->ang &= 2047;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_GETACTORANGLE:
|
|
|
|
insptr++;
|
|
|
|
Gv_SetVarX(*insptr++, vm.g_sp->ang);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SETACTORANGLE:
|
|
|
|
insptr++;
|
|
|
|
vm.g_sp->ang=Gv_GetVarX(*insptr++);
|
|
|
|
vm.g_sp->ang &= 2047;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SETVAR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if ((aGameVars[*insptr].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK)) == 0)
|
|
|
|
{
|
|
|
|
aGameVars[*insptr].val.lValue = *(insptr+1);
|
|
|
|
insptr += 2;
|
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(*insptr, *(insptr+1));
|
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SETARRAY:
|
|
|
|
insptr++;
|
2009-02-19 09:39:19 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j=*insptr++;
|
|
|
|
int32_t index = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t value = Gv_GetVarX(*insptr++);
|
2009-02-19 09:39:19 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j >= (unsigned)g_gameArrayCount || (unsigned)index >= (unsigned)aGameArrays[j].size))
|
2009-02-19 09:39:19 +00:00
|
|
|
{
|
2012-11-15 14:28:04 +00:00
|
|
|
OSD_Printf_nowarn(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",
|
2012-11-26 08:26:04 +00:00
|
|
|
j,vm.g_i,TrackerCast(sprite[vm.g_i].picnum),vm.g_p);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-02-19 09:39:19 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(aGameArrays[j].dwFlags & GAMEARRAY_READONLY))
|
2012-12-13 02:33:53 +00:00
|
|
|
{
|
|
|
|
OSD_Printf("Tried to set on read-only array `%s'", aGameArrays[j].szLabel);
|
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
aGameArrays[j].plValues[index]=value;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
case CON_WRITEARRAYTOFILE:
|
|
|
|
case CON_READARRAYFROMFILE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
2009-02-19 09:39:19 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int q = *insptr++;
|
2009-02-19 09:39:19 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[q] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", q);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tw == CON_READARRAYFROMFILE)
|
|
|
|
{
|
|
|
|
int32_t fil = kopen4loadfrommod(ScriptQuotes[q], 0);
|
|
|
|
int32_t asize;
|
2009-02-19 09:39:19 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (fil < 0)
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
asize = kfilelength(fil);
|
|
|
|
|
|
|
|
if (asize > 0)
|
|
|
|
{
|
2013-03-24 18:52:52 +00:00
|
|
|
// NOTE: this is broken on 64-bit, e.g. for LNGA2.
|
2010-06-07 09:03:16 +00:00
|
|
|
/*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n",
|
2012-05-25 15:23:48 +00:00
|
|
|
aGameArrays[j].szLabel, aGameArrays[j].size, asize / GAR_ELTSZ);*/
|
2014-05-30 00:02:19 +00:00
|
|
|
aGameArrays[j].plValues = (intptr_t *)Xrealloc(aGameArrays[j].plValues, asize);
|
2014-10-25 03:29:21 +00:00
|
|
|
aGameArrays[j].size = asize/GAR_ELTSZ;
|
2010-03-18 09:10:43 +00:00
|
|
|
kread(fil, aGameArrays[j].plValues, asize);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-02-19 09:39:19 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
kclose(fil);
|
2010-03-18 09:10:43 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2010-03-18 09:10:43 +00:00
|
|
|
|
2009-02-19 09:39:19 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
FILE *fil;
|
|
|
|
char temp[BMAX_PATH];
|
2010-03-18 09:10:43 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(G_ModDirSnprintf(temp, sizeof(temp), "%s", ScriptQuotes[q])))
|
2012-09-05 17:25:37 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("file name too long\n");
|
2012-09-05 17:25:37 +00:00
|
|
|
continue;
|
|
|
|
}
|
2010-03-18 09:10:43 +00:00
|
|
|
|
2012-09-05 17:25:37 +00:00
|
|
|
fil = fopen(temp,"wb");
|
2014-10-25 03:36:34 +00:00
|
|
|
|
|
|
|
if (EDUKE32_PREDICT_FALSE(fil == NULL))
|
2012-09-05 17:25:37 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("couldn't open file");
|
2012-09-05 17:25:37 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
fwrite(aGameArrays[j].plValues,1,sizeof(int) * aGameArrays[j].size,fil);
|
|
|
|
fclose(fil);
|
2009-02-19 09:39:19 +00:00
|
|
|
}
|
2010-03-18 09:10:43 +00:00
|
|
|
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-02-19 09:39:19 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case CON_GETARRAYSIZE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
2012-12-13 02:33:53 +00:00
|
|
|
Gv_SetVarX(*insptr++, (aGameArrays[j].dwFlags&GAMEARRAY_VARSIZE) ?
|
|
|
|
Gv_GetVarX(aGameArrays[j].size) : aGameArrays[j].size);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_RESIZEARRAY:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
|
|
|
int32_t asize = Gv_GetVarX(*insptr++);
|
2010-03-18 09:10:43 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
if (asize > 0)
|
2009-02-19 09:39:19 +00:00
|
|
|
{
|
2010-06-07 09:03:16 +00:00
|
|
|
/*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize);*/
|
2014-05-30 00:02:19 +00:00
|
|
|
aGameArrays[j].plValues = (intptr_t *)Xrealloc(aGameArrays[j].plValues, GAR_ELTSZ * asize);
|
2009-06-19 01:10:10 +00:00
|
|
|
aGameArrays[j].size = asize;
|
2009-02-19 09:39:19 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-02-19 09:39:19 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_COPY:
|
|
|
|
insptr++;
|
2008-04-05 04:18:48 +00:00
|
|
|
{
|
2012-12-13 02:33:53 +00:00
|
|
|
int32_t si=*insptr++, ssiz = 0;
|
|
|
|
int32_t sidx = Gv_GetVarX(*insptr++); //, vm.g_i, vm.g_p);
|
|
|
|
int32_t di=*insptr++, dsiz = 0;
|
|
|
|
int32_t didx = Gv_GetVarX(*insptr++);
|
|
|
|
int32_t numelts = Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)si>=(unsigned)g_gameArrayCount))
|
2012-12-13 02:33:53 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Invalid array %d!", si);
|
|
|
|
dsiz = 1;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)di>=(unsigned)g_gameArrayCount))
|
2012-12-13 02:33:53 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Invalid array %d!", di);
|
|
|
|
dsiz = 1;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(aGameArrays[di].dwFlags & GAMEARRAY_READONLY))
|
2012-12-13 02:33:53 +00:00
|
|
|
{
|
|
|
|
CON_ERRPRINTF("Array %d is read-only!", di);
|
|
|
|
dsiz = 1;
|
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(dsiz)) continue; // dirty replacement for VMFLAG_ERROR
|
2012-12-13 02:33:53 +00:00
|
|
|
|
|
|
|
ssiz = (aGameArrays[si].dwFlags&GAMEARRAY_VARSIZE) ?
|
|
|
|
Gv_GetVarX(aGameArrays[si].size) : aGameArrays[si].size;
|
|
|
|
dsiz = (aGameArrays[di].dwFlags&GAMEARRAY_VARSIZE) ?
|
|
|
|
Gv_GetVarX(aGameArrays[si].size) : aGameArrays[di].size;
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(sidx > ssiz || didx > dsiz)) continue;
|
2012-12-13 02:33:53 +00:00
|
|
|
if ((sidx+numelts) > ssiz) numelts = ssiz-sidx;
|
|
|
|
if ((didx+numelts) > dsiz) numelts = dsiz-didx;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2013-05-24 13:54:34 +00:00
|
|
|
// Switch depending on the source array type.
|
2012-12-13 02:33:53 +00:00
|
|
|
switch (aGameArrays[si].dwFlags & GAMEARRAY_TYPE_MASK)
|
|
|
|
{
|
|
|
|
case 0:
|
2013-05-24 13:54:34 +00:00
|
|
|
// CON array to CON array.
|
|
|
|
Bmemcpy(aGameArrays[di].plValues+didx, aGameArrays[si].plValues+sidx, numelts*GAR_ELTSZ);
|
|
|
|
break;
|
2012-12-13 02:33:53 +00:00
|
|
|
case GAMEARRAY_OFINT:
|
2013-05-24 13:54:34 +00:00
|
|
|
// From int32-sized array. Note that the CON array element
|
|
|
|
// type is intptr_t, so it is different-sized on 64-bit
|
|
|
|
// archs, but same-sized on 32-bit ones.
|
|
|
|
for (; numelts>0; numelts--)
|
|
|
|
(aGameArrays[di].plValues)[didx++] = ((int32_t *)aGameArrays[si].plValues)[sidx++];
|
2012-12-13 02:33:53 +00:00
|
|
|
break;
|
|
|
|
case GAMEARRAY_OFSHORT:
|
2013-05-24 13:54:34 +00:00
|
|
|
// From int16_t array. Always different-sized.
|
2012-12-13 02:33:53 +00:00
|
|
|
for (; numelts>0; numelts--)
|
2013-05-24 13:54:34 +00:00
|
|
|
(aGameArrays[di].plValues)[didx++] = ((int16_t *)aGameArrays[si].plValues)[sidx++];
|
2012-12-13 02:33:53 +00:00
|
|
|
break;
|
|
|
|
case GAMEARRAY_OFCHAR:
|
2013-05-24 13:54:34 +00:00
|
|
|
// From char array. Always different-sized.
|
2012-12-13 02:33:53 +00:00
|
|
|
for (; numelts>0; numelts--)
|
2013-05-24 13:54:34 +00:00
|
|
|
(aGameArrays[di].plValues)[didx++] = ((uint8_t *)aGameArrays[si].plValues)[sidx++];
|
2012-12-13 02:33:53 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-04-05 04:18:48 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_RANDVAR:
|
|
|
|
insptr++;
|
|
|
|
Gv_SetVarX(*insptr, mulscale16(krand(), *(insptr+1)+1));
|
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-02-19 09:39:19 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DISPLAYRANDVAR:
|
|
|
|
insptr++;
|
2011-11-05 12:13:50 +00:00
|
|
|
Gv_SetVarX(*insptr, mulscale15(system_15bit_rand(), *(insptr+1)+1));
|
2008-08-09 10:16:18 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_INV:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if ((aGameVars[*(insptr+1)].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK)) == 0)
|
|
|
|
{
|
|
|
|
aGameVars[*(insptr+1)].val.lValue = -aGameVars[*(insptr+1)].val.lValue;
|
|
|
|
insptr += 2;
|
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(*(insptr+1), -Gv_GetVarX(*(insptr+1)));
|
2008-08-09 10:16:18 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-12-19 20:31:40 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MULVAR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_MulVar(*insptr, *(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DIVVAR:
|
|
|
|
insptr++;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(*(insptr+1) == 0))
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("divide by zero!\n");
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_DivVar(*insptr, *(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MODVAR:
|
|
|
|
insptr++;
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(*(insptr+1) == 0))
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("mod by zero!\n");
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
|
|
|
Gv_ModVar(*insptr,*(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ANDVAR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_AndVar(*insptr,*(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ORVAR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_OrVar(*insptr,*(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_XORVAR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_XorVar(*insptr,*(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SETVARVAR:
|
|
|
|
insptr++;
|
2008-08-09 10:16:18 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if ((aGameVars[j].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK)) == 0)
|
|
|
|
{
|
|
|
|
aGameVars[j].val.lValue = Gv_GetVarX(*insptr++);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(j, Gv_GetVarX(*insptr++));
|
2008-08-09 10:16:18 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_RANDVARVAR:
|
|
|
|
insptr++;
|
2008-08-09 10:16:18 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j=*insptr++;
|
2011-11-05 12:13:50 +00:00
|
|
|
Gv_SetVarX(j,mulscale16(krand(), Gv_GetVarX(*insptr++)+1));
|
2008-08-09 10:16:18 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DISPLAYRANDVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
2011-11-05 12:13:50 +00:00
|
|
|
Gv_SetVarX(j,mulscale15(system_15bit_rand(), Gv_GetVarX(*insptr++)+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GMAXAMMO:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j>=MAX_WEAPONS))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid weapon ID %d\n", j);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
Gv_SetVarX(*insptr++, g_player[vm.g_p].ps->max_ammo_amount[j]);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SMAXAMMO:
|
2008-08-09 12:29:23 +00:00
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)j>=MAX_WEAPONS))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("Invalid weapon ID %d\n", j);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
g_player[vm.g_p].ps->max_ammo_amount[j]=Gv_GetVarX(*insptr++);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-05-10 01:29:37 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MULVARVAR:
|
|
|
|
insptr++;
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
|
|
|
Gv_MulVar(j, Gv_GetVarX(*insptr++));
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-08-11 10:38:46 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_DIVVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
|
|
|
int32_t l2=Gv_GetVarX(*insptr++);
|
2008-08-16 11:20:08 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(!l2))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("divide by zero!\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
|
|
|
Gv_DivVar(j, l2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_MODVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
|
|
|
int32_t l2=Gv_GetVarX(*insptr++);
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(!l2))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("mod by zero!\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-09-07 12:36:20 +00:00
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
|
|
|
|
Gv_ModVar(j, l2);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2008-09-07 12:36:20 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ANDVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_AndVar(j, Gv_GetVarX(*insptr++));
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-09-07 12:36:20 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_XORVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_XorVar(j, Gv_GetVarX(*insptr++));
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ORVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_OrVar(j, Gv_GetVarX(*insptr++));
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SUBVAR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_SubVar(*insptr, *(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SUBVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_SubVar(j, Gv_GetVarX(*insptr++));
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ADDVAR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_AddVar(*insptr, *(insptr+1));
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-13 23:12:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SHIFTVARL:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if ((aGameVars[*insptr].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK)) == 0)
|
|
|
|
{
|
|
|
|
aGameVars[*insptr].val.lValue <<= *(insptr+1);
|
|
|
|
insptr += 2;
|
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) << *(insptr+1));
|
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-13 23:12:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SHIFTVARR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
if ((aGameVars[*insptr].dwFlags & (GAMEVAR_USER_MASK|GAMEVAR_PTR_MASK)) == 0)
|
|
|
|
{
|
|
|
|
aGameVars[*insptr].val.lValue >>= *(insptr+1);
|
|
|
|
insptr += 2;
|
|
|
|
continue;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
Gv_SetVarX(*insptr, Gv_GetVarX(*insptr) >> *(insptr+1));
|
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-13 23:12:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SIN:
|
|
|
|
insptr++;
|
|
|
|
Gv_SetVarX(*insptr, sintable[Gv_GetVarX(*(insptr+1))&2047]);
|
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-13 23:12:47 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_COS:
|
|
|
|
insptr++;
|
|
|
|
Gv_SetVarX(*insptr, sintable[(Gv_GetVarX(*(insptr+1))+512)&2047]);
|
|
|
|
insptr += 2;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_ADDVARVAR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_AddVar(j, Gv_GetVarX(*insptr++));
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-09-07 12:36:20 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SPGETLOTAG:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
aGameVars[g_iLoTagID].val.lValue = vm.g_sp->lotag;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-09-07 12:36:20 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SPGETHITAG:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
aGameVars[g_iHiTagID].val.lValue = vm.g_sp->hitag;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-09-07 12:36:20 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SECTGETLOTAG:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
aGameVars[g_iLoTagID].val.lValue = sector[vm.g_sp->sectnum].lotag;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 02:01:48 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SECTGETHITAG:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
aGameVars[g_iHiTagID].val.lValue = sector[vm.g_sp->sectnum].hitag;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETTEXTUREFLOOR:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
aGameVars[g_iTextureID].val.lValue = sector[vm.g_sp->sectnum].floorpicnum;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_STARTTRACK:
|
|
|
|
case CON_STARTTRACKVAR:
|
|
|
|
insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-16 18:53:18 +00:00
|
|
|
int32_t level = (tw == CON_STARTTRACK) ? *(insptr++) :
|
|
|
|
Gv_GetVarX(*(insptr++));
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(G_StartTrack(level)))
|
2013-02-16 18:53:18 +00:00
|
|
|
CON_ERRPRINTF("invalid level %d or null music for volume %d level %d\n",
|
|
|
|
level, ud.volume_number, level);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_ACTIVATECHEAT:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*(insptr++));
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(numplayers != 1 || !(g_player[myconnectindex].ps->gm & MODE_GAME)))
|
2009-01-18 07:32:35 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("not in a single-player game.\n");
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
osdcmd_cheatsinfo_stat.cheatnum = j;
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_SETGAMEPALETTE:
|
|
|
|
insptr++;
|
2012-05-05 22:22:59 +00:00
|
|
|
P_SetGamePalette(g_player[vm.g_p].ps, Gv_GetVarX(*(insptr++)), 2+16);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-01-18 07:32:35 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_GETTEXTURECEILING:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
aGameVars[g_iTextureID].val.lValue = sector[vm.g_sp->sectnum].ceilingpicnum;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFVARVARAND:
|
|
|
|
insptr++;
|
2006-11-16 03:02:42 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
j &= Gv_GetVarX(*insptr++);
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARVAROR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
j |= Gv_GetVarX(*insptr++);
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARVARXOR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
j ^= Gv_GetVarX(*insptr++);
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARVAREITHER:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
2012-08-10 19:11:47 +00:00
|
|
|
int32_t l = Gv_GetVarX(*insptr++);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j || l);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARVARN:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
j = (j != Gv_GetVarX(*insptr++));
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARVARE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
j = (j == Gv_GetVarX(*insptr++));
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARVARG:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
j = (j > Gv_GetVarX(*insptr++));
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARVARL:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
j = (j < Gv_GetVarX(*insptr++));
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j == *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFVARN:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j != *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_WHILEVARN:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
intptr_t *savedinsptr=insptr+2;
|
|
|
|
int32_t j;
|
|
|
|
do
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr=savedinsptr;
|
|
|
|
j = (Gv_GetVarX(*(insptr-1)) != *insptr);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
while (j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_WHILEVARVARN:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
int32_t j;
|
|
|
|
intptr_t *savedinsptr=insptr+2;
|
|
|
|
do
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
insptr=savedinsptr;
|
|
|
|
j = Gv_GetVarX(*(insptr-1));
|
|
|
|
j = (j != Gv_GetVarX(*insptr++));
|
|
|
|
insptr--;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2006-11-16 03:02:42 +00:00
|
|
|
}
|
2009-06-24 08:20:10 +00:00
|
|
|
while (j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFVARAND:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j & *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFVAROR:
|
|
|
|
insptr++;
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j | *insptr);
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFVARXOR:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j ^ *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFVAREITHER:
|
2006-04-24 00:49:44 +00:00
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j || *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFVARG:
|
2008-07-16 09:27:08 +00:00
|
|
|
insptr++;
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j > *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFVARL:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=Gv_GetVarX(*insptr++);
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j < *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFPHEALTHL:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(sprite[g_player[vm.g_p].ps->i].extra < *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-06-12 19:47:34 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFPINVENTORY:
|
|
|
|
insptr++;
|
2007-06-12 19:47:34 +00:00
|
|
|
{
|
2009-06-19 01:10:10 +00:00
|
|
|
int32_t j = 0;
|
2012-08-10 19:11:53 +00:00
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
switch (*insptr++)
|
|
|
|
{
|
|
|
|
case GET_STEROIDS:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_STEROIDS] != *insptr)
|
2009-06-19 01:10:10 +00:00
|
|
|
j = 1;
|
|
|
|
break;
|
|
|
|
case GET_SHIELD:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_SHIELD] != ps->max_shield_amount)
|
2009-06-19 01:10:10 +00:00
|
|
|
j = 1;
|
|
|
|
break;
|
|
|
|
case GET_SCUBA:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_SCUBA] != *insptr) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case GET_HOLODUKE:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_HOLODUKE] != *insptr) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case GET_JETPACK:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_JETPACK] != *insptr) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case GET_ACCESS:
|
|
|
|
switch (vm.g_sp->pal)
|
|
|
|
{
|
|
|
|
case 0:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->got_access&1) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case 21:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->got_access&2) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case 23:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->got_access&4) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GET_HEATS:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_HEATS] != *insptr) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case GET_FIRSTAID:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_FIRSTAID] != *insptr) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
case GET_BOOTS:
|
2012-08-10 19:11:53 +00:00
|
|
|
if (ps->inv_amount[GET_BOOTS] != *insptr) j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid inventory ID: %d\n", (int32_t)*(insptr-1));
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2007-06-12 19:47:34 +00:00
|
|
|
}
|
2007-08-25 01:05:00 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_PSTOMP:
|
|
|
|
insptr++;
|
2012-08-10 19:11:53 +00:00
|
|
|
{
|
|
|
|
DukePlayer_t *const ps = g_player[vm.g_p].ps;
|
|
|
|
|
|
|
|
if (ps->knee_incs == 0 && sprite[ps->i].xrepeat >= 40)
|
|
|
|
if (cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(4<<8),vm.g_sp->sectnum,ps->pos.x,
|
|
|
|
ps->pos.y,ps->pos.z+(16<<8),sprite[ps->i].sectnum))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-08-10 19:11:53 +00:00
|
|
|
int32_t j = playerswhenstarted-1;
|
|
|
|
|
|
|
|
for (; j>=0; j--)
|
|
|
|
{
|
|
|
|
if (g_player[j].ps->actorsqu == vm.g_i)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j == -1)
|
|
|
|
{
|
|
|
|
ps->knee_incs = 1;
|
|
|
|
if (ps->weapon_pos == 0)
|
|
|
|
ps->weapon_pos = -1;
|
|
|
|
ps->actorsqu = vm.g_i;
|
|
|
|
}
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2012-08-10 19:11:53 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
2006-04-18 03:11:38 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFAWAYFROMWALL:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
|
|
|
int16_t s1=vm.g_sp->sectnum;
|
|
|
|
int32_t j = 0;
|
2006-11-15 01:16:55 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
updatesector(vm.g_sp->x+108,vm.g_sp->y+108,&s1);
|
|
|
|
if (s1 == vm.g_sp->sectnum)
|
|
|
|
{
|
|
|
|
updatesector(vm.g_sp->x-108,vm.g_sp->y-108,&s1);
|
2009-06-19 01:10:10 +00:00
|
|
|
if (s1 == vm.g_sp->sectnum)
|
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
updatesector(vm.g_sp->x+108,vm.g_sp->y-108,&s1);
|
2009-06-19 01:10:10 +00:00
|
|
|
if (s1 == vm.g_sp->sectnum)
|
|
|
|
{
|
2009-06-24 08:20:10 +00:00
|
|
|
updatesector(vm.g_sp->x-108,vm.g_sp->y+108,&s1);
|
2009-06-19 01:10:10 +00:00
|
|
|
if (s1 == vm.g_sp->sectnum)
|
2009-06-24 08:20:10 +00:00
|
|
|
j = 1;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j);
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_QUOTE:
|
|
|
|
insptr++;
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)(*insptr) >= MAXQUOTES))
|
2012-02-24 19:51:54 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", (int32_t)(*insptr));
|
2012-02-24 19:51:54 +00:00
|
|
|
insptr++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[*insptr] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", (int32_t)*insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_p >= MAXPLAYERS))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("bad player for quote %d: (%d)\n", (int32_t)*insptr,vm.g_p);
|
2009-06-19 01:10:10 +00:00
|
|
|
insptr++;
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
P_DoQuote(*(insptr++)|MAXQUOTES,g_player[vm.g_p].ps);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_USERQUOTE:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i=Gv_GetVarX(*insptr++);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)i >= MAXQUOTES))
|
2012-02-24 19:51:54 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", i);
|
2012-02-24 19:51:54 +00:00
|
|
|
insptr++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[i] == NULL))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", i);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
|
|
|
G_AddUserQuote(ScriptQuotes[i]);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-03-05 07:24:04 +00:00
|
|
|
case CON_ECHO:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t i=Gv_GetVarX(*insptr++);
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)i >= MAXQUOTES))
|
2012-03-05 07:24:04 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("invalid quote ID %d\n", i);
|
2012-03-05 07:24:04 +00:00
|
|
|
insptr++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE(ScriptQuotes[i] == NULL))
|
2012-03-05 07:24:04 +00:00
|
|
|
{
|
2012-09-05 17:25:47 +00:00
|
|
|
CON_ERRPRINTF("null quote %d\n", i);
|
2012-03-05 07:24:04 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
OSD_Printf("%s\n",ScriptQuotes[i]);
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFINOUTERSPACE:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(G_CheckForSpaceFloor(vm.g_sp->sectnum));
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_IFNOTMOVING:
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL((actor[vm.g_i].movflag&49152) > 16384);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_RESPAWNHITAG:
|
|
|
|
insptr++;
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(vm.g_sp->picnum))
|
2009-06-19 01:10:10 +00:00
|
|
|
{
|
|
|
|
case FEM1__STATIC:
|
|
|
|
case FEM2__STATIC:
|
|
|
|
case FEM3__STATIC:
|
|
|
|
case FEM4__STATIC:
|
|
|
|
case FEM5__STATIC:
|
|
|
|
case FEM6__STATIC:
|
|
|
|
case FEM7__STATIC:
|
|
|
|
case FEM8__STATIC:
|
|
|
|
case FEM9__STATIC:
|
|
|
|
case FEM10__STATIC:
|
|
|
|
case PODFEM1__STATIC:
|
|
|
|
case NAKED1__STATIC:
|
|
|
|
case STATUE__STATIC:
|
2013-12-28 17:04:36 +00:00
|
|
|
if (vm.g_sp->yvel)
|
|
|
|
G_OperateRespawns(vm.g_sp->yvel);
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
2012-11-15 14:28:21 +00:00
|
|
|
// if (vm.g_sp->hitag >= 0)
|
|
|
|
G_OperateRespawns(vm.g_sp->hitag);
|
2006-11-16 03:02:42 +00:00
|
|
|
break;
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFSPRITEPAL:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(vm.g_sp->pal == *insptr);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFANGDIFFL:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = klabs(G_GetAngleDelta(g_player[vm.g_p].ps->ang,vm.g_sp->ang));
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_CONDITIONAL(j <= *insptr);
|
2009-06-19 01:10:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-08-28 19:18:05 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_IFNOSOUNDS:
|
2009-06-24 08:20:10 +00:00
|
|
|
{
|
2013-01-02 22:33:32 +00:00
|
|
|
int32_t j = !A_CheckAnySoundPlaying(vm.g_i);
|
|
|
|
VM_CONDITIONAL(j);
|
2009-06-24 08:20:10 +00:00
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2006-08-28 19:18:05 +00:00
|
|
|
|
2009-06-19 01:10:10 +00:00
|
|
|
case CON_SPRITEFLAGS:
|
|
|
|
insptr++;
|
2010-05-02 23:27:30 +00:00
|
|
|
actor[vm.g_i].flags = Gv_GetVarX(*insptr++);
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_GETTICKS:
|
|
|
|
insptr++;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
Gv_SetVarX(*insptr++, getticks());
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
case CON_GETCURRADDRESS:
|
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j=*insptr++;
|
|
|
|
Gv_SetVarX(j, (intptr_t)(insptr-script));
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
2012-03-11 17:38:27 +00:00
|
|
|
case CON_JUMP: // XXX XXX XXX
|
2011-07-29 22:07:28 +00:00
|
|
|
insptr++;
|
|
|
|
{
|
|
|
|
int32_t j = Gv_GetVarX(*insptr++);
|
|
|
|
insptr = (intptr_t *)(j+script);
|
|
|
|
}
|
2009-07-12 23:41:16 +00:00
|
|
|
continue;
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
default:
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_ScriptInfo();
|
2009-06-19 01:10:10 +00:00
|
|
|
|
|
|
|
G_GameExit("An error has occurred in the EDuke32 virtual machine.\n\n"
|
2009-06-24 08:20:10 +00:00
|
|
|
"If you are an end user, please e-mail the file eduke32.log\n"
|
|
|
|
"along with links to any mods you're using to terminx@gmail.com.\n\n"
|
|
|
|
"If you are a mod developer, please attach all of your CON files\n"
|
|
|
|
"along with instructions on how to reproduce this error.\n\n"
|
|
|
|
"Thank you!");
|
2009-06-19 01:10:10 +00:00
|
|
|
break;
|
2009-01-18 07:32:35 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-11 17:38:27 +00:00
|
|
|
// NORECURSE
|
2009-01-09 09:29:17 +00:00
|
|
|
void A_LoadActor(int32_t iActor)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_i = iActor; // Sprite ID
|
|
|
|
vm.g_p = -1; // iPlayer; // Player ID
|
2009-11-14 02:30:47 +00:00
|
|
|
vm.g_x = -1; // lDist; // ?
|
2009-01-07 14:05:13 +00:00
|
|
|
vm.g_sp = &sprite[vm.g_i]; // Pointer to sprite structure
|
2010-05-02 23:27:30 +00:00
|
|
|
vm.g_t = &actor[vm.g_i].t_data[0]; // Sprite's 'extra' data
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-10-30 15:54:35 +00:00
|
|
|
if (g_tile[vm.g_sp->picnum].loadPtr == NULL)
|
2012-06-10 18:56:24 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
vm.g_flags &= ~(VM_RETURN|VM_KILL|VM_NOEXECUTE);
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
// if(A_CheckEnemySprite(vm.g_sp))
|
|
|
|
// g_player[vm.g_p].ps->actors_killed++;
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(vm.g_i);
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-02-08 04:19:39 +00:00
|
|
|
|
2012-10-30 15:54:35 +00:00
|
|
|
insptr = g_tile[vm.g_sp->picnum].loadPtr;
|
Patch from Hendricks266 and whatever changes happened to be in my tree. I hope they work ;)
"The most noticeable change is the addition of the "includedefault" CON and DEF command, which will attempt to include eduke.con (or nam.con, or ww2gi.con), then game.con, or duke3d.def, or nam.def, or ww2gi.def. This is useful for TCs like my add-ons, where for my pseudo-mutators I currently say "include EDUKE.CON", but I also have to juggle this terrible order of paths, so that I can have an EDUKE.CON file in my HRP which says "include GAME.CON" to allow the mainline game to actually run, but also allow DukePlus to load its EDUKE.CON file (since it uses that and not an -x switch), and also allow any custom EDUKE.CON files in the root to be used."
git-svn-id: https://svn.eduke32.com/eduke32@1909 1a8010ca-5511-0410-912e-c29ae57300e0
2011-06-19 00:11:52 +00:00
|
|
|
VM_Execute(1);
|
2012-03-11 17:38:27 +00:00
|
|
|
insptr = NULL;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
if (vm.g_flags & VM_KILL)
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(vm.g_i);
|
2013-02-21 18:54:07 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2013-02-21 18:54:07 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-03-11 17:38:27 +00:00
|
|
|
// NORECURSE
|
2013-12-28 17:04:27 +00:00
|
|
|
void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2012-07-20 21:57:44 +00:00
|
|
|
#ifdef LUNATIC
|
2012-11-30 18:57:59 +00:00
|
|
|
int32_t killit=0;
|
2013-06-30 20:38:48 +00:00
|
|
|
#else
|
|
|
|
intptr_t actionofs, *actionptr;
|
2012-07-20 21:57:44 +00:00
|
|
|
#endif
|
2010-05-02 23:27:30 +00:00
|
|
|
vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0],
|
2010-08-02 08:13:51 +00:00
|
|
|
&sprite[iActor], 0
|
|
|
|
};
|
2010-05-02 23:27:30 +00:00
|
|
|
|
2012-10-14 22:16:07 +00:00
|
|
|
/*
|
2014-02-22 19:38:52 +00:00
|
|
|
if (g_netClient && A_CheckSpriteFlags(iActor, SFLAG_NULL))
|
2009-12-14 20:14:12 +00:00
|
|
|
{
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(iActor);
|
2009-12-14 20:14:12 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-10-14 22:16:07 +00:00
|
|
|
*/
|
2007-03-22 18:28:41 +00:00
|
|
|
|
2010-01-16 23:08:17 +00:00
|
|
|
if (g_netServer || g_netClient)
|
2009-12-05 09:22:43 +00:00
|
|
|
randomseed = ticrandomseed;
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
Bmemcpy(&vm, &tempvm, sizeof(vmstate_t));
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-10-25 03:36:34 +00:00
|
|
|
if (EDUKE32_PREDICT_FALSE((unsigned)vm.g_sp->sectnum >= MAXSECTORS))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
if (A_CheckEnemySprite(vm.g_sp))
|
|
|
|
g_player[vm.g_p].ps->actors_killed++;
|
2012-03-11 17:38:13 +00:00
|
|
|
A_DeleteSprite(vm.g_i);
|
2006-04-13 20:47:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-04-27 06:54:28 +00:00
|
|
|
/* Qbix: Changed variables to be aware of the sizeof *insptr
|
2010-05-02 23:27:30 +00:00
|
|
|
* (whether it is int32_t vs intptr_t), Although it is specifically cast to intptr_t*
|
2008-04-27 06:54:28 +00:00
|
|
|
* which might be corrected if the code is converted to use offsets */
|
2011-12-21 18:40:47 +00:00
|
|
|
/* Helixhorned: let's do away with intptr_t's... */
|
2013-02-07 21:00:48 +00:00
|
|
|
#if !defined LUNATIC
|
2013-06-30 20:38:48 +00:00
|
|
|
actionofs = AC_ACTION_ID(vm.g_t);
|
|
|
|
actionptr = (actionofs!=0 && actionofs+4u < (unsigned)g_scriptSize) ?
|
|
|
|
&script[actionofs] : NULL;
|
|
|
|
|
|
|
|
if (actionptr != NULL)
|
2012-06-07 17:38:01 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-07 21:00:48 +00:00
|
|
|
#if !defined LUNATIC
|
2013-06-30 20:38:48 +00:00
|
|
|
const int32_t action_frames = actionptr[1];
|
|
|
|
const int32_t action_incval = actionptr[3];
|
|
|
|
const int32_t action_delay = actionptr[4];
|
2012-05-18 12:46:10 +00:00
|
|
|
#else
|
2012-08-06 20:00:29 +00:00
|
|
|
const int32_t action_frames = actor[vm.g_i].ac.numframes;
|
|
|
|
const int32_t action_incval = actor[vm.g_i].ac.incval;
|
|
|
|
const int32_t action_delay = actor[vm.g_i].ac.delay;
|
2012-05-18 12:46:10 +00:00
|
|
|
#endif
|
2013-06-30 20:38:52 +00:00
|
|
|
uint16_t *actionticsptr = &AC_ACTIONTICS(vm.g_sp, &actor[vm.g_i]);
|
|
|
|
*actionticsptr += TICSPERFRAME;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2013-06-30 20:38:52 +00:00
|
|
|
if (*actionticsptr > action_delay)
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_ACTION_COUNT(vm.g_t)++;
|
2013-06-30 20:38:52 +00:00
|
|
|
*actionticsptr = 0;
|
2012-03-11 17:37:50 +00:00
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
AC_CURFRAME(vm.g_t) += action_incval;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 20:38:48 +00:00
|
|
|
if (klabs(AC_CURFRAME(vm.g_t)) >= klabs(action_frames * action_incval))
|
|
|
|
AC_CURFRAME(vm.g_t) = 0;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-06-10 18:56:15 +00:00
|
|
|
#ifdef LUNATIC
|
2013-03-13 10:48:19 +00:00
|
|
|
{
|
|
|
|
const int32_t picnum = vm.g_sp->picnum;
|
2012-07-20 21:57:44 +00:00
|
|
|
|
2013-03-13 10:48:19 +00:00
|
|
|
if (L_IsInitialized(&g_ElState) && El_HaveActor(picnum))
|
2013-07-13 21:04:45 +00:00
|
|
|
{
|
|
|
|
double t = gethiticks();
|
|
|
|
|
2013-03-13 10:48:19 +00:00
|
|
|
killit = (El_CallActor(&g_ElState, picnum, iActor, iPlayer, lDist)==1);
|
2012-12-29 15:21:32 +00:00
|
|
|
|
2013-07-13 21:04:45 +00:00
|
|
|
t = gethiticks()-t;
|
|
|
|
g_actorTotalMs[picnum] += t;
|
|
|
|
g_actorMinMs[picnum] = min(g_actorMinMs[picnum], t);
|
|
|
|
g_actorMaxMs[picnum] = max(g_actorMaxMs[picnum], t);
|
|
|
|
g_actorCalls[picnum]++;
|
|
|
|
}
|
2013-03-13 10:48:19 +00:00
|
|
|
}
|
2013-02-03 12:48:17 +00:00
|
|
|
#else
|
|
|
|
insptr = 4 + (g_tile[vm.g_sp->picnum].execPtr);
|
|
|
|
VM_Execute(1);
|
|
|
|
insptr = NULL;
|
2012-07-20 21:57:44 +00:00
|
|
|
#endif
|
|
|
|
|
2012-11-30 18:57:59 +00:00
|
|
|
#ifdef LUNATIC
|
2013-07-13 21:04:45 +00:00
|
|
|
if (killit)
|
|
|
|
#else
|
|
|
|
if (vm.g_flags & VM_KILL)
|
2012-11-30 18:57:59 +00:00
|
|
|
#endif
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2013-02-21 18:54:07 +00:00
|
|
|
VM_KillIt(iActor, iPlayer);
|
2008-08-24 19:09:17 +00:00
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2010-05-02 23:27:30 +00:00
|
|
|
VM_Move();
|
2008-12-17 01:59:36 +00:00
|
|
|
|
2009-08-06 10:12:13 +00:00
|
|
|
if (vm.g_sp->statnum == STAT_STANDABLE)
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(vm.g_sp->picnum))
|
2006-04-13 20:47:06 +00:00
|
|
|
{
|
2008-08-24 19:09:17 +00:00
|
|
|
case RUBBERCAN__STATIC:
|
|
|
|
case EXPLODINGBARREL__STATIC:
|
|
|
|
case WOODENHORSE__STATIC:
|
|
|
|
case HORSEONSIDE__STATIC:
|
|
|
|
case CANWITHSOMETHING__STATIC:
|
|
|
|
case FIREBARREL__STATIC:
|
|
|
|
case NUKEBARREL__STATIC:
|
|
|
|
case NUKEBARRELDENTED__STATIC:
|
|
|
|
case NUKEBARRELLEAKED__STATIC:
|
|
|
|
case TRIPBOMB__STATIC:
|
|
|
|
case EGG__STATIC:
|
2010-05-02 23:27:30 +00:00
|
|
|
if (actor[vm.g_i].timetosleep > 1)
|
|
|
|
actor[vm.g_i].timetosleep--;
|
|
|
|
else if (actor[vm.g_i].timetosleep == 1)
|
2009-07-12 01:55:34 +00:00
|
|
|
changespritestat(vm.g_i,STAT_ZOMBIEACTOR);
|
2008-08-24 19:09:17 +00:00
|
|
|
default:
|
|
|
|
return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-14 20:41:21 +00:00
|
|
|
if (vm.g_sp->statnum != STAT_ACTOR)
|
2008-08-24 19:09:17 +00:00
|
|
|
return;
|
|
|
|
|
2009-01-07 14:05:13 +00:00
|
|
|
if (A_CheckEnemySprite(vm.g_sp))
|
2008-08-24 19:09:17 +00:00
|
|
|
{
|
2009-01-07 14:05:13 +00:00
|
|
|
if (vm.g_sp->xrepeat > 60) return;
|
|
|
|
if (ud.respawn_monsters == 1 && vm.g_sp->extra <= 0) return;
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-10-25 03:36:34 +00:00
|
|
|
else if (EDUKE32_PREDICT_FALSE(ud.respawn_items == 1 && (vm.g_sp->cstat&32768))) return;
|
2008-08-24 19:09:17 +00:00
|
|
|
|
2014-02-22 19:38:52 +00:00
|
|
|
if (A_CheckSpriteFlags(vm.g_i, SFLAG_USEACTIVATOR) && sector[vm.g_sp->sectnum].lotag & 16384)
|
2012-10-14 22:16:07 +00:00
|
|
|
changespritestat(vm.g_i, STAT_ZOMBIEACTOR);
|
2010-05-02 23:27:30 +00:00
|
|
|
else if (actor[vm.g_i].timetosleep > 1)
|
|
|
|
actor[vm.g_i].timetosleep--;
|
|
|
|
else if (actor[vm.g_i].timetosleep == 1)
|
2014-10-25 03:29:21 +00:00
|
|
|
{
|
2014-10-25 03:36:34 +00:00
|
|
|
// hack for 1.3D fire sprites
|
|
|
|
if (EDUKE32_PREDICT_FALSE(g_scriptVersion == 13 && (vm.g_sp->picnum == FIRE || vm.g_sp->picnum == FIRE2)))
|
2014-10-25 03:29:21 +00:00
|
|
|
return;
|
2012-10-14 22:16:07 +00:00
|
|
|
changespritestat(vm.g_i, STAT_ZOMBIEACTOR);
|
2014-10-25 03:29:21 +00:00
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2013-05-19 19:29:26 +00:00
|
|
|
void G_SaveMapState(void)
|
2008-07-16 09:27:08 +00:00
|
|
|
{
|
2013-10-27 21:12:22 +00:00
|
|
|
int32_t levelnum = ud.volume_number*MAXLEVELS+ud.level_number;
|
|
|
|
map_t *mapinfo = &MapInfo[levelnum];
|
2013-05-19 19:29:26 +00:00
|
|
|
mapstate_t *save;
|
|
|
|
|
|
|
|
if (mapinfo->savedstate == NULL)
|
2014-05-30 00:02:19 +00:00
|
|
|
mapinfo->savedstate = (mapstate_t *)Xcalloc(1,sizeof(mapstate_t));
|
2013-05-19 19:29:26 +00:00
|
|
|
save = mapinfo->savedstate;
|
|
|
|
|
2008-07-16 09:27:08 +00:00
|
|
|
if (save != NULL)
|
|
|
|
{
|
2013-07-13 21:04:41 +00:00
|
|
|
#if !defined LUNATIC
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t i;
|
2013-07-13 21:04:41 +00:00
|
|
|
#endif
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->numwalls,&numwalls,sizeof(numwalls));
|
|
|
|
Bmemcpy(&save->wall[0],&wall[0],sizeof(walltype)*MAXWALLS);
|
|
|
|
Bmemcpy(&save->numsectors,&numsectors,sizeof(numsectors));
|
|
|
|
Bmemcpy(&save->sector[0],§or[0],sizeof(sectortype)*MAXSECTORS);
|
|
|
|
Bmemcpy(&save->sprite[0],&sprite[0],sizeof(spritetype)*MAXSPRITES);
|
2011-08-03 17:22:46 +00:00
|
|
|
|
2013-02-01 13:05:13 +00:00
|
|
|
// If we're in EVENT_ANIMATESPRITES, we'll be saving pointer values to disk :-/
|
2013-02-07 21:00:52 +00:00
|
|
|
#if !defined LUNATIC
|
2011-08-03 17:22:46 +00:00
|
|
|
if (g_currentEventExec == EVENT_ANIMATESPRITES)
|
|
|
|
initprintf("Line %d: savemapstate called from EVENT_ANIMATESPRITES. WHY?\n", g_errorLineNum);
|
2013-02-07 21:00:52 +00:00
|
|
|
#endif
|
2009-01-10 07:38:50 +00:00
|
|
|
Bmemcpy(&save->spriteext[0],&spriteext[0],sizeof(spriteext_t)*MAXSPRITES);
|
2012-03-14 22:31:49 +00:00
|
|
|
|
|
|
|
save->numsprites = Numsprites;
|
2012-03-13 20:07:17 +00:00
|
|
|
save->tailspritefree = tailspritefree;
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->headspritesect[0],&headspritesect[0],sizeof(headspritesect));
|
|
|
|
Bmemcpy(&save->prevspritesect[0],&prevspritesect[0],sizeof(prevspritesect));
|
|
|
|
Bmemcpy(&save->nextspritesect[0],&nextspritesect[0],sizeof(nextspritesect));
|
2009-08-28 23:08:00 +00:00
|
|
|
Bmemcpy(&save->headspritestat[0],&headspritestat[0],sizeof(headspritestat));
|
|
|
|
Bmemcpy(&save->prevspritestat[0],&prevspritestat[0],sizeof(prevspritestat));
|
|
|
|
Bmemcpy(&save->nextspritestat[0],&nextspritestat[0],sizeof(nextspritestat));
|
2012-03-11 17:37:08 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
Bmemcpy(&save->numyaxbunches, &numyaxbunches, sizeof(numyaxbunches));
|
2013-04-09 17:35:11 +00:00
|
|
|
# if !defined NEW_MAP_FORMAT
|
2012-03-11 17:37:08 +00:00
|
|
|
Bmemcpy(save->yax_bunchnum, yax_bunchnum, sizeof(yax_bunchnum));
|
|
|
|
Bmemcpy(save->yax_nextwall, yax_nextwall, sizeof(yax_nextwall));
|
2013-04-09 17:35:11 +00:00
|
|
|
# endif
|
2012-03-11 17:37:08 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
Bmemcpy(&save->actor[0],&actor[0],sizeof(actor_t)*MAXSPRITES);
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&save->g_numCyclers,&g_numCyclers,sizeof(g_numCyclers));
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&save->cyclers[0],&cyclers[0],sizeof(cyclers));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&save->g_playerSpawnPoints[0],&g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints));
|
|
|
|
Bmemcpy(&save->g_numAnimWalls,&g_numAnimWalls,sizeof(g_numAnimWalls));
|
|
|
|
Bmemcpy(&save->SpriteDeletionQueue[0],&SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue));
|
|
|
|
Bmemcpy(&save->g_spriteDeleteQueuePos,&g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->animwall[0],&animwall[0],sizeof(animwall));
|
|
|
|
Bmemcpy(&save->msx[0],&msx[0],sizeof(msx));
|
|
|
|
Bmemcpy(&save->msy[0],&msy[0],sizeof(msy));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&save->g_mirrorWall[0],&g_mirrorWall[0],sizeof(g_mirrorWall));
|
|
|
|
Bmemcpy(&save->g_mirrorSector[0],&g_mirrorSector[0],sizeof(g_mirrorSector));
|
|
|
|
Bmemcpy(&save->g_mirrorCount,&g_mirrorCount,sizeof(g_mirrorCount));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->show2dsector[0],&show2dsector[0],sizeof(show2dsector));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&save->g_numClouds,&g_numClouds,sizeof(g_numClouds));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->clouds[0],&clouds[0],sizeof(clouds));
|
|
|
|
Bmemcpy(&save->cloudx[0],&cloudx[0],sizeof(cloudx));
|
|
|
|
Bmemcpy(&save->cloudy[0],&cloudy[0],sizeof(cloudy));
|
Clean up parallaxed sky functionality, part 2.
- Rename sky_t members: yscale -> horizfrac, bits -> lognumtiles.
- Add default sky (8 tiles, horizfrac=32768 (i.e. 1/2 the scene horiz), offsets
all zero) and CLOUDYOCEAN sky (8 tiles, horizfrac=65536, offsets all zero)
to multipsky[].
- Get rid of "psky_t g_psky", merely maintaining a g_pskyidx instead. Set it up
at map load time so as to keep the behavior of the legacy per-map psky:
the last sector index with a matching psky ceiling wins.
- In mapstate_t, save g_pskyidx too, not (former) pskybits and pskyoffs[].
- Make on-map-load global psky setup consistent for the game and editor by
factoring it out into common.c: G_SetupGlobalPsky().
- Remove a couple of useless initializations, add some static assertions.
This commit is more likely to introduce subtle differences in behavior.
Specifically, getpsky() now always returns the default sky properties instead of
the global sky ones (but with all-zero offsets) when no match for a suiting
multi-psky is found. This is only likely to affect the yscale/horizfrac of
non-multi-pskies when a global non-default multi-psky has been set up.
Bump BYTEVERSION again.
git-svn-id: https://svn.eduke32.com/eduke32@3976 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:48 +00:00
|
|
|
Bmemcpy(&save->pskyidx,&g_pskyidx,sizeof(g_pskyidx));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->animategoal[0],&animategoal[0],sizeof(animategoal));
|
|
|
|
Bmemcpy(&save->animatevel[0],&animatevel[0],sizeof(animatevel));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&save->g_animateCount,&g_animateCount,sizeof(g_animateCount));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->animatesect[0],&animatesect[0],sizeof(animatesect));
|
2011-07-29 22:07:49 +00:00
|
|
|
|
|
|
|
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_FWD);
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->animateptr[0],&animateptr[0],sizeof(animateptr));
|
2011-07-29 22:07:49 +00:00
|
|
|
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_BACK);
|
|
|
|
|
2013-10-28 21:26:32 +00:00
|
|
|
{
|
|
|
|
EDUKE32_STATIC_ASSERT(sizeof(save->animateptr) == sizeof(animateptr));
|
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&save->g_numPlayerSprites,&g_numPlayerSprites,sizeof(g_numPlayerSprites));
|
|
|
|
Bmemcpy(&save->g_earthquakeTime,&g_earthquakeTime,sizeof(g_earthquakeTime));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&save->lockclock,&lockclock,sizeof(lockclock));
|
|
|
|
Bmemcpy(&save->randomseed,&randomseed,sizeof(randomseed));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&save->g_globalRandom,&g_globalRandom,sizeof(g_globalRandom));
|
2013-01-20 21:17:06 +00:00
|
|
|
#if !defined LUNATIC
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=g_gameVarCount-1; i>=0; i--)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_NORESET) continue;
|
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
|
|
|
if (!save->vars[i])
|
2014-05-30 00:02:19 +00:00
|
|
|
save->vars[i] = (intptr_t *)Xcalloc(MAXPLAYERS,sizeof(intptr_t));
|
2008-12-21 22:46:55 +00:00
|
|
|
Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXPLAYERS);
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
|
|
|
if (!save->vars[i])
|
2014-05-30 00:02:19 +00:00
|
|
|
save->vars[i] = (intptr_t *)Xcalloc(MAXSPRITES,sizeof(intptr_t));
|
2008-12-21 22:46:55 +00:00
|
|
|
Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXSPRITES);
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
else save->vars[i] = (intptr_t *)aGameVars[i].val.lValue;
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
2013-10-27 21:12:20 +00:00
|
|
|
#else
|
2013-10-27 21:12:22 +00:00
|
|
|
{
|
|
|
|
int32_t slen;
|
|
|
|
const char *svcode = El_SerializeGamevars(&slen, levelnum);
|
|
|
|
|
|
|
|
if (slen < 0)
|
|
|
|
{
|
|
|
|
El_OnError("ERROR: savemapstate: serialization failed!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-05-30 00:02:19 +00:00
|
|
|
char *savecode = Xstrdup(svcode);
|
2013-10-27 21:12:22 +00:00
|
|
|
Bfree(save->savecode);
|
|
|
|
save->savecode = savecode;
|
|
|
|
}
|
|
|
|
}
|
2013-01-20 21:17:06 +00:00
|
|
|
#endif
|
2008-07-16 09:27:08 +00:00
|
|
|
ototalclock = totalclock;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-19 19:29:26 +00:00
|
|
|
void G_RestoreMapState(void)
|
2008-07-16 09:27:08 +00:00
|
|
|
{
|
2013-10-27 21:12:22 +00:00
|
|
|
int32_t levelnum = ud.volume_number*MAXLEVELS+ud.level_number;
|
|
|
|
mapstate_t *save = MapInfo[levelnum].savedstate;
|
2013-05-19 19:29:26 +00:00
|
|
|
|
2008-07-16 09:27:08 +00:00
|
|
|
if (save != NULL)
|
|
|
|
{
|
2011-07-29 22:07:28 +00:00
|
|
|
int32_t i, x;
|
2008-07-27 01:22:17 +00:00
|
|
|
char phealth[MAXPLAYERS];
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
for (i=0; i<playerswhenstarted; i++)
|
2008-07-18 03:22:20 +00:00
|
|
|
phealth[i] = sprite[g_player[i].ps->i].extra;
|
|
|
|
|
2008-07-16 09:27:08 +00:00
|
|
|
pub = NUMPAGES;
|
|
|
|
pus = NUMPAGES;
|
2008-11-20 14:06:36 +00:00
|
|
|
G_UpdateScreenArea();
|
2008-07-16 09:27:08 +00:00
|
|
|
|
|
|
|
Bmemcpy(&numwalls,&save->numwalls,sizeof(numwalls));
|
|
|
|
Bmemcpy(&wall[0],&save->wall[0],sizeof(walltype)*MAXWALLS);
|
|
|
|
Bmemcpy(&numsectors,&save->numsectors,sizeof(numsectors));
|
|
|
|
Bmemcpy(§or[0],&save->sector[0],sizeof(sectortype)*MAXSECTORS);
|
|
|
|
Bmemcpy(&sprite[0],&save->sprite[0],sizeof(spritetype)*MAXSPRITES);
|
2009-01-10 07:38:50 +00:00
|
|
|
Bmemcpy(&spriteext[0],&save->spriteext[0],sizeof(spriteext_t)*MAXSPRITES);
|
2013-02-01 13:05:13 +00:00
|
|
|
|
|
|
|
// If we're restoring from EVENT_ANIMATESPRITES, all spriteext[].tspr
|
|
|
|
// will be overwritten, so NULL them.
|
2013-02-07 21:00:52 +00:00
|
|
|
#if !defined LUNATIC
|
2011-08-03 17:22:46 +00:00
|
|
|
if (g_currentEventExec == EVENT_ANIMATESPRITES)
|
2013-02-01 13:05:13 +00:00
|
|
|
{
|
2011-08-03 17:22:46 +00:00
|
|
|
initprintf("Line %d: loadmapstate called from EVENT_ANIMATESPRITES. WHY?\n",g_errorLineNum);
|
|
|
|
for (i=0; i<MAXSPRITES; i++)
|
|
|
|
spriteext[i].tspr = NULL;
|
2013-02-01 13:05:13 +00:00
|
|
|
}
|
2013-02-07 21:00:52 +00:00
|
|
|
#endif
|
2012-03-14 22:31:49 +00:00
|
|
|
Numsprites = save->numsprites;
|
2012-03-13 20:07:17 +00:00
|
|
|
tailspritefree = save->tailspritefree;
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&headspritesect[0],&save->headspritesect[0],sizeof(headspritesect));
|
|
|
|
Bmemcpy(&prevspritesect[0],&save->prevspritesect[0],sizeof(prevspritesect));
|
|
|
|
Bmemcpy(&nextspritesect[0],&save->nextspritesect[0],sizeof(nextspritesect));
|
2009-08-28 23:08:00 +00:00
|
|
|
Bmemcpy(&headspritestat[0],&save->headspritestat[0],sizeof(headspritestat));
|
|
|
|
Bmemcpy(&prevspritestat[0],&save->prevspritestat[0],sizeof(prevspritestat));
|
|
|
|
Bmemcpy(&nextspritestat[0],&save->nextspritestat[0],sizeof(nextspritestat));
|
2012-03-11 17:37:08 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
Bmemcpy(&numyaxbunches, &save->numyaxbunches, sizeof(numyaxbunches));
|
2013-04-09 17:35:11 +00:00
|
|
|
# if !defined NEW_MAP_FORMAT
|
2012-03-11 17:37:08 +00:00
|
|
|
Bmemcpy(yax_bunchnum, save->yax_bunchnum, sizeof(yax_bunchnum));
|
|
|
|
Bmemcpy(yax_nextwall, save->yax_nextwall, sizeof(yax_nextwall));
|
2013-04-09 17:35:11 +00:00
|
|
|
# endif
|
2012-03-11 17:37:08 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
Bmemcpy(&actor[0],&save->actor[0],sizeof(actor_t)*MAXSPRITES);
|
2011-12-21 18:40:47 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&g_numCyclers,&save->g_numCyclers,sizeof(g_numCyclers));
|
2013-11-04 18:21:07 +00:00
|
|
|
Bmemcpy(&cyclers[0],&save->cyclers[0],sizeof(cyclers));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&g_playerSpawnPoints[0],&save->g_playerSpawnPoints[0],sizeof(g_playerSpawnPoints));
|
|
|
|
Bmemcpy(&g_numAnimWalls,&save->g_numAnimWalls,sizeof(g_numAnimWalls));
|
|
|
|
Bmemcpy(&SpriteDeletionQueue[0],&save->SpriteDeletionQueue[0],sizeof(SpriteDeletionQueue));
|
|
|
|
Bmemcpy(&g_spriteDeleteQueuePos,&save->g_spriteDeleteQueuePos,sizeof(g_spriteDeleteQueuePos));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&animwall[0],&save->animwall[0],sizeof(animwall));
|
|
|
|
Bmemcpy(&msx[0],&save->msx[0],sizeof(msx));
|
|
|
|
Bmemcpy(&msy[0],&save->msy[0],sizeof(msy));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&g_mirrorWall[0],&save->g_mirrorWall[0],sizeof(g_mirrorWall));
|
|
|
|
Bmemcpy(&g_mirrorSector[0],&save->g_mirrorSector[0],sizeof(g_mirrorSector));
|
|
|
|
Bmemcpy(&g_mirrorCount,&save->g_mirrorCount,sizeof(g_mirrorCount));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&show2dsector[0],&save->show2dsector[0],sizeof(show2dsector));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&g_numClouds,&save->g_numClouds,sizeof(g_numClouds));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&clouds[0],&save->clouds[0],sizeof(clouds));
|
|
|
|
Bmemcpy(&cloudx[0],&save->cloudx[0],sizeof(cloudx));
|
|
|
|
Bmemcpy(&cloudy[0],&save->cloudy[0],sizeof(cloudy));
|
Clean up parallaxed sky functionality, part 2.
- Rename sky_t members: yscale -> horizfrac, bits -> lognumtiles.
- Add default sky (8 tiles, horizfrac=32768 (i.e. 1/2 the scene horiz), offsets
all zero) and CLOUDYOCEAN sky (8 tiles, horizfrac=65536, offsets all zero)
to multipsky[].
- Get rid of "psky_t g_psky", merely maintaining a g_pskyidx instead. Set it up
at map load time so as to keep the behavior of the legacy per-map psky:
the last sector index with a matching psky ceiling wins.
- In mapstate_t, save g_pskyidx too, not (former) pskybits and pskyoffs[].
- Make on-map-load global psky setup consistent for the game and editor by
factoring it out into common.c: G_SetupGlobalPsky().
- Remove a couple of useless initializations, add some static assertions.
This commit is more likely to introduce subtle differences in behavior.
Specifically, getpsky() now always returns the default sky properties instead of
the global sky ones (but with all-zero offsets) when no match for a suiting
multi-psky is found. This is only likely to affect the yscale/horizfrac of
non-multi-pskies when a global non-default multi-psky has been set up.
Bump BYTEVERSION again.
git-svn-id: https://svn.eduke32.com/eduke32@3976 1a8010ca-5511-0410-912e-c29ae57300e0
2013-08-04 20:37:48 +00:00
|
|
|
Bmemcpy(&g_pskyidx,&save->pskyidx,sizeof(g_pskyidx));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&animategoal[0],&save->animategoal[0],sizeof(animategoal));
|
|
|
|
Bmemcpy(&animatevel[0],&save->animatevel[0],sizeof(animatevel));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&g_animateCount,&save->g_animateCount,sizeof(g_animateCount));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&animatesect[0],&save->animatesect[0],sizeof(animatesect));
|
2011-07-29 22:07:49 +00:00
|
|
|
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&animateptr[0],&save->animateptr[0],sizeof(animateptr));
|
2011-07-29 22:07:49 +00:00
|
|
|
G_Util_PtrToIdx(animateptr, g_animateCount, sector, P2I_BACK);
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&g_numPlayerSprites,&save->g_numPlayerSprites,sizeof(g_numPlayerSprites));
|
|
|
|
Bmemcpy(&g_earthquakeTime,&save->g_earthquakeTime,sizeof(g_earthquakeTime));
|
2008-07-16 09:27:08 +00:00
|
|
|
Bmemcpy(&lockclock,&save->lockclock,sizeof(lockclock));
|
|
|
|
Bmemcpy(&randomseed,&save->randomseed,sizeof(randomseed));
|
2008-11-20 14:06:36 +00:00
|
|
|
Bmemcpy(&g_globalRandom,&save->g_globalRandom,sizeof(g_globalRandom));
|
2013-01-19 18:29:00 +00:00
|
|
|
#if !defined LUNATIC
|
2009-02-19 16:47:54 +00:00
|
|
|
for (i=g_gameVarCount-1; i>=0; i--)
|
2008-07-18 02:46:24 +00:00
|
|
|
{
|
2008-11-20 14:06:36 +00:00
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_NORESET) continue;
|
|
|
|
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
|
2009-12-05 09:22:43 +00:00
|
|
|
{
|
|
|
|
if (!save->vars[i]) continue;
|
2008-12-21 22:46:55 +00:00
|
|
|
Bmemcpy(&aGameVars[i].val.plValues[0],&save->vars[i][0],sizeof(intptr_t) * MAXPLAYERS);
|
2009-12-05 09:22:43 +00:00
|
|
|
}
|
2008-11-20 14:06:36 +00:00
|
|
|
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
|
2009-12-05 09:22:43 +00:00
|
|
|
{
|
|
|
|
if (!save->vars[i]) continue;
|
2008-12-21 22:46:55 +00:00
|
|
|
Bmemcpy(&aGameVars[i].val.plValues[0],&save->vars[i][0],sizeof(intptr_t) * MAXSPRITES);
|
2009-12-05 09:22:43 +00:00
|
|
|
}
|
2008-12-21 22:46:55 +00:00
|
|
|
else aGameVars[i].val.lValue = (intptr_t)save->vars[i];
|
2008-07-18 02:46:24 +00:00
|
|
|
}
|
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Gv_RefreshPointers();
|
2013-10-27 21:12:20 +00:00
|
|
|
#else
|
2013-10-27 21:12:22 +00:00
|
|
|
if (save->savecode)
|
|
|
|
{
|
|
|
|
El_RestoreGamevars(save->savecode);
|
|
|
|
}
|
2013-01-01 15:24:18 +00:00
|
|
|
#endif
|
2013-10-25 21:57:09 +00:00
|
|
|
// Update g_player[].ps->i (sprite indices of players) to be consistent
|
|
|
|
// with just loaded sprites.
|
|
|
|
// Otherwise, crashes may ensue: e.g. WGR2 SVN r391, map spiderden:
|
|
|
|
// - walk forward (to door leading to other level "Shadowpine Forest")
|
|
|
|
// - in new level, walk backward to get back to the Spider Den
|
|
|
|
// - walk backward to the door leading to Shadowpine Forest --> crash.
|
|
|
|
for (SPRITES_OF(STAT_PLAYER, i))
|
|
|
|
{
|
2013-12-28 17:04:27 +00:00
|
|
|
int32_t snum = P_Get(i);
|
2013-10-25 21:57:09 +00:00
|
|
|
Bassert((unsigned)snum < MAXPLAYERS);
|
|
|
|
g_player[snum].ps->i = i;
|
|
|
|
}
|
|
|
|
|
2009-06-24 08:20:10 +00:00
|
|
|
for (i=0; i<playerswhenstarted; i++)
|
2008-07-18 03:22:20 +00:00
|
|
|
sprite[g_player[i].ps->i].extra = phealth[i];
|
|
|
|
|
2008-07-16 09:27:08 +00:00
|
|
|
if (g_player[myconnectindex].ps->over_shoulder_on != 0)
|
|
|
|
{
|
2013-01-19 18:28:32 +00:00
|
|
|
CAMERADIST = 0;
|
|
|
|
CAMERACLOCK = 0;
|
2008-07-16 09:27:08 +00:00
|
|
|
g_player[myconnectindex].ps->over_shoulder_on = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
screenpeek = myconnectindex;
|
|
|
|
|
2012-01-05 20:48:37 +00:00
|
|
|
if (ud.lockout)
|
2008-07-16 09:27:08 +00:00
|
|
|
{
|
2009-02-19 16:47:54 +00:00
|
|
|
for (x=g_numAnimWalls-1; x>=0; x--)
|
2012-01-28 14:38:23 +00:00
|
|
|
switch (DYNAMICTILEMAP(wall[animwall[x].wallnum].picnum))
|
2008-07-16 09:27:08 +00:00
|
|
|
{
|
|
|
|
case FEMPIC1__STATIC:
|
|
|
|
wall[animwall[x].wallnum].picnum = BLANKSCREEN;
|
|
|
|
break;
|
|
|
|
case FEMPIC2__STATIC:
|
|
|
|
case FEMPIC3__STATIC:
|
|
|
|
wall[animwall[x].wallnum].picnum = SCREENBREAK6;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-01-05 20:48:37 +00:00
|
|
|
#if 0
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (x=g_numAnimWalls-1; x>=0; x--)
|
|
|
|
if (wall[animwall[x].wallnum].extra >= 0)
|
|
|
|
wall[animwall[x].wallnum].picnum = wall[animwall[x].wallnum].extra;
|
|
|
|
}
|
|
|
|
#endif
|
2012-03-11 17:37:08 +00:00
|
|
|
#ifdef YAX_ENABLE
|
|
|
|
sv_postyaxload();
|
|
|
|
#endif
|
2011-07-29 22:07:28 +00:00
|
|
|
G_ResetInterpolations();
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2008-11-20 14:06:36 +00:00
|
|
|
Net_ResetPrediction();
|
2008-07-16 09:27:08 +00:00
|
|
|
|
2011-02-25 21:50:19 +00:00
|
|
|
G_ClearFIFO();
|
2013-07-04 19:38:46 +00:00
|
|
|
G_ResetTimers(0);
|
2008-07-16 09:27:08 +00:00
|
|
|
}
|
|
|
|
}
|
2012-12-03 18:24:25 +00:00
|
|
|
|
|
|
|
#ifdef LUNATIC
|
|
|
|
void VM_FallSprite(int32_t i)
|
|
|
|
{
|
2013-02-07 21:00:52 +00:00
|
|
|
VM_Fall(i, &sprite[i]);
|
2012-12-03 18:24:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int32_t VM_ResetPlayer2(int32_t snum)
|
|
|
|
{
|
2013-02-07 21:00:52 +00:00
|
|
|
return VM_ResetPlayer(snum, 0);
|
2012-12-03 18:24:25 +00:00
|
|
|
}
|
2013-04-05 17:52:59 +00:00
|
|
|
|
|
|
|
int32_t VM_CheckSquished2(int32_t i, int32_t snum)
|
|
|
|
{
|
|
|
|
vm.g_i = i;
|
|
|
|
vm.g_sp = &sprite[i];
|
|
|
|
vm.g_p = snum;
|
|
|
|
|
|
|
|
return VM_CheckSquished();
|
|
|
|
}
|
2012-12-03 18:24:25 +00:00
|
|
|
#endif
|