2010-08-02 08:13:51 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
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.
|
2010-08-02 08:13:51 +00:00
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef gameexec_h_
|
|
|
|
#define gameexec_h_
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2012-02-09 22:44:45 +00:00
|
|
|
#include "build.h"
|
|
|
|
#include "sector.h" // mapstate_t
|
|
|
|
#include "gamedef.h" // vmstate_t
|
2014-10-30 21:44:22 +00:00
|
|
|
#include "events_defs.h"
|
2012-02-09 22:44:45 +00:00
|
|
|
|
2013-07-07 20:59:10 +00:00
|
|
|
#ifdef LUNATIC
|
2014-10-30 21:44:22 +00:00
|
|
|
# include "lunatic_game.h"
|
2013-07-07 20:59:10 +00:00
|
|
|
#endif
|
2010-08-02 08:13:51 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2010-08-02 08:13:51 +00:00
|
|
|
extern int32_t ticrandomseed;
|
|
|
|
|
2013-02-07 21:00:52 +00:00
|
|
|
extern vmstate_t vm;
|
|
|
|
#if !defined LUNATIC
|
|
|
|
extern int32_t g_tw;
|
|
|
|
extern int32_t g_errorLineNum;
|
2011-08-03 17:22:46 +00:00
|
|
|
extern int32_t g_currentEventExec;
|
2013-02-21 18:54:07 +00:00
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
void A_LoadActor(int32_t spriteNum);
|
2013-02-07 21:00:52 +00:00
|
|
|
#endif
|
2011-08-03 17:22:46 +00:00
|
|
|
|
2016-09-06 04:25:32 +00:00
|
|
|
void A_Execute(int spriteNum, int playerNum, int playerDist);
|
2016-08-27 01:40:35 +00:00
|
|
|
void A_Fall(int spriteNum);
|
2016-09-06 04:25:32 +00:00
|
|
|
int A_FurthestVisiblePoint(int spriteNum, uspritetype * const ts,int32_t *dax,int32_t *day);
|
|
|
|
int32_t A_GetFurthestAngle(int spriteNum, int angDiv);
|
|
|
|
void A_GetZLimits(int spriteNum);
|
|
|
|
int G_GetAngleDelta(int a, int na);
|
2013-05-19 19:29:26 +00:00
|
|
|
void G_RestoreMapState();
|
|
|
|
void G_SaveMapState();
|
2014-10-25 03:33:53 +00:00
|
|
|
|
2016-02-13 21:05:57 +00:00
|
|
|
#if !defined LUNATIC
|
|
|
|
void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation);
|
|
|
|
void VM_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p);
|
|
|
|
void VM_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p);
|
|
|
|
void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation);
|
|
|
|
#else
|
|
|
|
void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
|
|
|
|
int32_t shade, int32_t orientation, int32_t p);
|
|
|
|
#endif
|
|
|
|
|
2016-08-27 01:40:35 +00:00
|
|
|
int32_t VM_OnEventWithBoth_(int nEventID, int spriteNum, int playerNum, int nDist, int32_t nReturn);
|
|
|
|
int32_t VM_OnEventWithReturn_(int nEventID, int spriteNum, int playerNum, int32_t nReturn);
|
|
|
|
int32_t VM_OnEventWithDist_(int nEventID, int spriteNum, int playerNum, int nDist);
|
|
|
|
int32_t VM_OnEvent_(int nEventID, int spriteNum, int playerNum);
|
2014-10-25 03:33:53 +00:00
|
|
|
|
2017-02-25 08:15:53 +00:00
|
|
|
static FORCE_INLINE int VM_HaveEvent(int nEventID)
|
2014-10-25 03:33:53 +00:00
|
|
|
{
|
|
|
|
#ifdef LUNATIC
|
2016-08-27 01:40:06 +00:00
|
|
|
return L_IsInitialized(&g_ElState) && El_HaveEvent(nEventID);
|
2014-10-25 03:33:53 +00:00
|
|
|
#else
|
2016-08-27 01:40:35 +00:00
|
|
|
return !!apScriptEvents[nEventID];
|
2014-10-25 03:33:53 +00:00
|
|
|
#endif
|
2014-10-25 03:36:34 +00:00
|
|
|
}
|
2014-10-25 03:33:53 +00:00
|
|
|
|
2017-02-25 08:15:53 +00:00
|
|
|
static FORCE_INLINE int32_t VM_OnEventWithBoth(int nEventID, int spriteNum, int playerNum, int nDist, int32_t nReturn)
|
2014-10-25 03:36:34 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
return VM_HaveEvent(nEventID) ? VM_OnEventWithBoth_(nEventID, spriteNum, playerNum, nDist, nReturn) : nReturn;
|
2014-11-22 12:29:25 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 08:15:53 +00:00
|
|
|
static FORCE_INLINE int32_t VM_OnEventWithReturn(int nEventID, int spriteNum, int playerNum, int nReturn)
|
2014-11-22 12:29:25 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
return VM_HaveEvent(nEventID) ? VM_OnEventWithReturn_(nEventID, spriteNum, playerNum, nReturn) : nReturn;
|
2014-11-22 12:29:25 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 08:15:53 +00:00
|
|
|
static FORCE_INLINE int32_t VM_OnEventWithDist(int nEventID, int spriteNum, int playerNum, int nDist)
|
2014-11-22 12:29:25 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
return VM_HaveEvent(nEventID) ? VM_OnEventWithDist_(nEventID, spriteNum, playerNum, nDist) : 0;
|
2014-11-22 12:29:25 +00:00
|
|
|
}
|
|
|
|
|
2017-02-25 08:15:53 +00:00
|
|
|
static FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum, int playerNum)
|
2014-11-22 12:29:25 +00:00
|
|
|
{
|
2016-08-27 01:40:35 +00:00
|
|
|
return VM_HaveEvent(nEventID) ? VM_OnEvent_(nEventID, spriteNum, playerNum) : 0;
|
2014-10-25 03:33:53 +00:00
|
|
|
}
|
|
|
|
|
2012-09-05 17:25:47 +00:00
|
|
|
#define CON_ERRPRINTF(Text, ...) do { \
|
2014-11-25 21:08:58 +00:00
|
|
|
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
|
2012-11-15 14:28:04 +00:00
|
|
|
} while (0)
|
2012-09-05 17:25:47 +00:00
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
void G_GetTimeDate(int32_t *vals);
|
2016-08-27 01:40:35 +00:00
|
|
|
int G_StartTrack(int levelNum);
|
2014-11-26 04:39:23 +00:00
|
|
|
int32_t A_Dodge(spritetype *s);
|
|
|
|
#ifdef LUNATIC
|
2015-03-24 00:40:55 +00:00
|
|
|
void G_ShowView(vec3_t vec, int32_t a, int32_t horiz, int32_t sect,
|
2014-11-26 04:39:23 +00:00
|
|
|
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t unbiasedp);
|
|
|
|
void P_AddWeaponMaybeSwitchI(int32_t snum, int32_t weap);
|
|
|
|
void VM_FallSprite(int32_t i);
|
2015-03-04 02:15:15 +00:00
|
|
|
int32_t VM_ResetPlayer2(int32_t snum, int32_t flags);
|
2014-11-26 04:39:23 +00:00
|
|
|
int32_t VM_CheckSquished2(int32_t i, int32_t snum);
|
|
|
|
#endif
|
|
|
|
|
2016-08-27 01:42:01 +00:00
|
|
|
void VM_UpdateAnim(int spriteNum, int32_t *pData);
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-12-09 13:24:36 +00:00
|
|
|
#endif
|