m32script: EVENT_DRAW3DSCREEN, screenshot functonality.

The event is run after drawing the scene, but before the overlays. To
make a screenshot from a script, set DOSCRSHOT to non-zero. It will then
be scheduled to run once after the drawing but before the above-mentioned
event.  The screenshots will be called mcapXXXX.{png,tga}.

git-svn-id: https://svn.eduke32.com/eduke32@2818 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-07-08 21:47:23 +00:00
parent f6c1c125ac
commit e02843b133
4 changed files with 15 additions and 0 deletions

View file

@ -86,6 +86,7 @@ enum GameEvent_t {
EVENT_INSERTSPRITE2D,
EVENT_INSERTSPRITE3D,
EVENT_DRAW2DSCREEN,
EVENT_DRAW3DSCREEN,
EVENT_KEYS2D,
EVENT_KEYS3D,
EVENT_PREKEYS2D,
@ -169,6 +170,7 @@ extern uint32_t m32_drawlinepat;
extern int32_t g_iReturnVar;
extern int32_t g_doScreenShot;
extern int32_t m32_sortvar1, m32_sortvar2;
//extern int32_t g_numRealPalettes;
@ -224,6 +226,7 @@ extern int32_t mousyplc;
#define M32_LOTAG_VAR_ID 7
#define M32_HITAG_VAR_ID 8
#define M32_TEXTURE_VAR_ID 9
#define M32_DOSCRSHOT_VAR_ID 10
#define M32_LOCAL_ARRAY_ID 0

View file

@ -151,6 +151,8 @@ typedef struct
spritetype *sprite;
} mapinfofull_t;
int32_t g_doScreenShot;
static int32_t backup_highlighted_map(mapinfofull_t *mapinfo);
static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal);
static void SaveBoardAndPrintMessage(const char *fn);
@ -481,6 +483,14 @@ void M32_DrawRoomsAndMasks(void)
M32_ResetFakeRORTiles();
}
#endif
VM_OnEvent(EVENT_DRAW3DSCREEN, -1);
if (g_doScreenShot)
{
screencapture("mcapxxxx.tga", 0, "Mapster32, from script");
g_doScreenShot = 0;
}
}
#undef STARTUP_SETUP_WINDOW

View file

@ -3512,6 +3512,7 @@ static void C_AddDefaultDefinitions(void)
C_AddDefinition("EVENT_INSERTSPRITE2D", EVENT_INSERTSPRITE2D, LABEL_EVENT);
C_AddDefinition("EVENT_INSERTSPRITE3D", EVENT_INSERTSPRITE3D, LABEL_EVENT);
C_AddDefinition("EVENT_DRAW2DSCREEN", EVENT_DRAW2DSCREEN, LABEL_EVENT);
C_AddDefinition("EVENT_DRAW3DSCREEN", EVENT_DRAW3DSCREEN, LABEL_EVENT);
C_AddDefinition("EVENT_KEYS2D", EVENT_KEYS2D, LABEL_EVENT);
C_AddDefinition("EVENT_KEYS3D", EVENT_KEYS3D, LABEL_EVENT);
C_AddDefinition("EVENT_PREKEYS2D", EVENT_PREKEYS2D, LABEL_EVENT);

View file

@ -535,6 +535,7 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("LOTAG", 0, GAMEVAR_SYSTEM);
Gv_NewVar("HITAG", 0, GAMEVAR_SYSTEM);
Gv_NewVar("TEXTURE", 0, GAMEVAR_SYSTEM);
Gv_NewVar("DOSCRSHOT", (intptr_t)&g_doScreenShot, GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("xdim",(intptr_t)&xdim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);
Gv_NewVar("ydim",(intptr_t)&ydim, GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_READONLY);