Subversion Repositories eduke32

Rev

Rev 4988 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1677 terminx 1
//-------------------------------------------------------------------------
2
/*
3
Copyright (C) 2010 EDuke32 developers and contributors
4
 
5
This file is part of EDuke32.
6
 
7
EDuke32 is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License version 2
9
as published by the Free Software Foundation.
10
 
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 
15
See the GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
4541 hendricks2 19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
1677 terminx 20
*/
21
//-------------------------------------------------------------------------
22
 
4747 terminx 23
#ifndef gameexec_h_
24
#define gameexec_h_
1677 terminx 25
 
2328 helixhorne 26
#include "build.h"
27
#include "sector.h"  // mapstate_t
28
#include "gamedef.h"  // vmstate_t
4710 helixhorne 29
#include "events_defs.h"
2328 helixhorne 30
 
3937 helixhorne 31
#ifdef LUNATIC
4710 helixhorne 32
# include "lunatic_game.h"
3937 helixhorne 33
#endif
1677 terminx 34
 
4766 hendricks2 35
#ifdef __cplusplus
36
extern "C" {
37
#endif
38
 
1677 terminx 39
extern int32_t ticrandomseed;
3460 helixhorne 40
 
1677 terminx 41
extern vmstate_t vm;
3460 helixhorne 42
#if !defined LUNATIC
43
extern int32_t g_tw;
44
extern int32_t g_errorLineNum;
1956 helixhorne 45
extern int32_t g_currentEventExec;
3514 helixhorne 46
 
47
void A_LoadActor(int32_t iActor);
3460 helixhorne 48
#endif
1956 helixhorne 49
 
4226 helixhorne 50
void A_Execute(int32_t iActor, int32_t iPlayer, int32_t lDist);
1677 terminx 51
void A_Fall(int32_t iActor);
4988 terminx 52
int32_t A_FurthestVisiblePoint(int32_t iActor,tspritetype * const ts,int32_t *dax,int32_t *day);
1677 terminx 53
int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs);
54
void A_GetZLimits(int32_t iActor);
55
int32_t G_GetAngleDelta(int32_t a,int32_t na);
3792 helixhorne 56
void G_RestoreMapState();
57
void G_SaveMapState();
4673 terminx 58
 
4745 terminx 59
int32_t VM_OnEventWithBoth_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn);
60
int32_t VM_OnEventWithReturn_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t iReturn);
61
int32_t VM_OnEventWithDist_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist);
62
int32_t VM_OnEvent_(int32_t iEventID, int32_t iActor, int32_t iPlayer);
4673 terminx 63
 
4680 terminx 64
static inline int32_t VM_HaveEvent(int32_t iEventID)
4673 terminx 65
{
66
#ifdef LUNATIC
4710 helixhorne 67
    return L_IsInitialized(&g_ElState) && El_HaveEvent(iEventID);
4673 terminx 68
#else
4680 terminx 69
    return apScriptGameEvent[iEventID]!=NULL;
4673 terminx 70
#endif
4680 terminx 71
}
4673 terminx 72
 
4745 terminx 73
static inline int32_t VM_OnEventWithBoth(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn)
4680 terminx 74
{
4745 terminx 75
    return VM_HaveEvent(iEventID) ? VM_OnEventWithBoth_(iEventID, iActor, iPlayer, lDist, iReturn) : iReturn;
4673 terminx 76
}
77
 
4745 terminx 78
static inline int32_t VM_OnEventWithReturn(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t iReturn)
79
{
80
    return VM_HaveEvent(iEventID) ? VM_OnEventWithReturn_(iEventID, iActor, iPlayer, iReturn) : iReturn;
81
}
82
 
83
static inline int32_t VM_OnEventWithDist(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist)
84
{
85
    return VM_HaveEvent(iEventID) ? VM_OnEventWithDist_(iEventID, iActor, iPlayer, lDist) : 0;
86
}
87
 
88
static inline int32_t VM_OnEvent(int32_t iEventID, int32_t iActor, int32_t iPlayer)
89
{
90
    return VM_HaveEvent(iEventID) ? VM_OnEvent_(iEventID, iActor, iPlayer) : 0;
91
}
92
 
1677 terminx 93
void VM_ScriptInfo(void);
94
 
3000 helixhorne 95
#define CON_ERRPRINTF(Text, ...) do { \
4763 hendricks2 96
    OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
3170 helixhorne 97
} while (0)
3000 helixhorne 98
 
4766 hendricks2 99
void G_GetTimeDate(int32_t *vals);
100
int32_t G_StartTrack(int32_t level);
101
int32_t A_Dodge(spritetype *s);
102
#ifdef LUNATIC
103
void G_ShowView(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t sect,
104
                int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t unbiasedp);
105
void P_AddWeaponMaybeSwitchI(int32_t snum, int32_t weap);
106
void VM_FallSprite(int32_t i);
5039 hendricks2 107
int32_t VM_ResetPlayer2(int32_t snum, int32_t flags);
4766 hendricks2 108
int32_t VM_CheckSquished2(int32_t i, int32_t snum);
3258 helixhorne 109
#endif
4766 hendricks2 110
 
111
#ifdef __cplusplus
112
}
113
#endif
114
 
115
#endif