#define MAX_GAME_OBJECTS 100 extern struct object { int id; // 0 if slot unused int x; int y; int width; int height; const char *pixels; } objects[MAX_GAME_OBJECTS]; #define MAX_GAME_SCRIPTS 100 typedef void (*script_wake_fn)(struct script *scr, int wakeupMode, int arg1, int arg2, int arg3, int arg4); #define SCRIPT_HEADER \ int id /* 0 if slot unused */; \ int wakeupMode; \ script_wake_fn wakeupFn; \ int wakeupArg1; /* for SCRIPT_WAKEUP_OTHER_SCRIPT */ extern struct script { SCRIPT_HEADER int vars[100]; } scripts[MAX_GAME_SCRIPTS]; struct script_player_walk { SCRIPT_HEADER int targetX; int targetY; int targetNavmeshTri; int currentNavmeshTri; }; #define SCRIPT_WAKEUP_VIDEO_FRAME 1 #define SCRIPT_WAKEUP_OTHER_SCRIPT 2 #define SCRIPT_WAKEUP_OTHER_SCRIPT_INTERRUPTED 3 // Delivered to script that registers for SCRIPT_WAKEUP_OTHER_SCRIPT if that script is interrupted instead of completing. // engine void transition_scene(int scene); // Immediately stops all event processing for current scene, which is unloaded before this function returns void scene_add_clickrect(int id, int x, int y, int width, int height); void scene_add_object(int id, int x, int y, int width, int height, const char *pixels); void scene_set_navmesh(struct navmesh *navmesh); struct object *find_object_by_id(int id); struct script *scene_add_script(int id, bool interrupt_existing); struct script *scene_get_script(int id); bool deliver_script_wakeup(int wakeupMode, int wakeupArg1, int wakeupType, int arg1, int arg2, int arg3, int arg4); // deliver to scripts with given wakeupMode and wakeupArg1. Returns true if scene changed. void start_player_walk_to_point(int x, int y); // x and y are not corrected to lie within navmesh // game-specific constants #define SCENE_LOBBY 1 #define SCENE_MANAGERS_OFFICE 2 // The player ID and walk script are globally relevant #define OBJID_PLAYER 4 #define OBJID_PLAYER_WALK_SCRIPT 5 // game.cpp void scene_setup(int scene); void onclick(int curscene, int objid);