summaryrefslogtreecommitdiff
path: root/kon/konrmfield.h
diff options
context:
space:
mode:
Diffstat (limited to 'kon/konrmfield.h')
-rw-r--r--kon/konrmfield.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/kon/konrmfield.h b/kon/konrmfield.h
index 50a5607..d2b358f 100644
--- a/kon/konrmfield.h
+++ b/kon/konrmfield.h
@@ -41,6 +41,7 @@ extern "C" {
chars[i + 1] is events[i]. you give kon_rmFieldInit the array, it has to have room for eventCount + 1 */
#define KON_RM_PLAYER 0
+#define KON_RM_ROUTE_MAX 256 /* the numbers a route given by a script can have, a longer one is cut after its last whole command */
typedef struct kon_rmChar {
int active; /* the player always, an event when one of its pages is on */
@@ -57,8 +58,16 @@ typedef struct kon_rmChar {
int success; /* did the last step work */
const int32_t *route; /* what it follows: a page's route, or one it was told to */
int routeSize, routeIndex, routeWait, routeRepeat, routeSkippable, routeForced;
+ int erased; /* taken off the map by a script until the map is entered again */
+ int32_t routeData[KON_RM_ROUTE_MAX]; /* where a route from a script is kept */
} kon_rmChar_t;
+/* where a script sends the player: map, tile, the way to look (2, 4, 6, 8, or 0 to keep looking the same way) and the fade
+ (0 black, 1 white, 2 none) */
+typedef struct kon_rmTransfer {
+ int mapId, x, y, dir, fade;
+} kon_rmTransfer_t;
+
typedef struct kon_rmField {
const kon_rmMap_t *map;
const kon_rmTileset_t *tileset;
@@ -68,11 +77,16 @@ typedef struct kon_rmField {
uint32_t seed;
int busy; /* set it while a script that stops the player is running */
int steps; /* the steps of the player, count them for encounters and take them back to 0 */
+ int thisEvent; /* the id of the event whose script is running, for the commands that mean "this event". set it before you run one */
+ int waitIndex; /* the character a script waits for, -1 for none */
+ int transferPending;
+ kon_rmTransfer_t transfer;
/* both can stay NULL. the first is how a route that turns a switch on or off reaches your game, the second says whether
the script a page names has anything in it, an event with an empty one does not start */
void (*switchSet)(int id, int on, void *user);
int (*hasScript)(const char *label, void *user);
+ void (*selfSwitchSet)(int mapId, int eventId, char letter, int on, void *user);
void *user;
} kon_rmField_t;
@@ -118,6 +132,19 @@ void kon_rmFieldUnlock(kon_rmField_t *field, int index);
void kon_rmFieldRoute(kon_rmField_t *field, int index, const int32_t *route, int size, int repeat, int skippable);
int kon_rmFieldRouteBusy(const kon_rmField_t *field, int index);
+/*** commands from scripts ***/
+
+/* the RPG Maker commands that are about the map, the way mzscript writes them: 201 move the player to another map, 203 put a
+ character somewhere, 205 give a character a route, 211 the player's transparency, 214 take this event off the map and 123
+ a self switch. returns -1 when the code is not one of those, 0 when it is done, 1 when the script is meant to wait. that
+ wait is over when kon_rmFieldBusy says 0, so the host function returns 1 and you call kon_scriptResume then.
+ a transfer is not done here: you take it with kon_rmFieldTransfer, load the map and start another field. */
+int kon_rmFieldHost(kon_rmField_t *field, int code, int b, int c, int d, const char *text);
+int kon_rmFieldBusy(const kon_rmField_t *field);
+
+/* 1 and the transfer when a script asked for one, once */
+int kon_rmFieldTransfer(kon_rmField_t *field, kon_rmTransfer_t *transfer);
+
/*** drawing ***/
/* where it is in 256ths of a tile, in the middle of a step too. a map that loops can give a bit past its edge, the picture