diff options
author | Chuck Miller <shadowmil@gmail.com> | 2011-04-24 20:10:38 -0400 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2011-05-01 10:57:13 -0600 |
commit | a32ca166fd30baaf79a161d1a2e43eb032c8b014 (patch) | |
tree | f0d5779598ecc4f1a69f9de36a8871000f93b6ed | |
parent | 3f0ce47e23fa226b30a4322660b8aab3e74d5240 (diff) | |
download | tmwa-a32ca166fd30baaf79a161d1a2e43eb032c8b014.tar.gz tmwa-a32ca166fd30baaf79a161d1a2e43eb032c8b014.tar.bz2 tmwa-a32ca166fd30baaf79a161d1a2e43eb032c8b014.tar.xz tmwa-a32ca166fd30baaf79a161d1a2e43eb032c8b014.zip |
Add script functions for getting a player's x and y locations
-rw-r--r-- | src/map/script.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c index 27567c3..ca5c427 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -316,6 +316,9 @@ int buildin_shop (struct script_state *st); // [MadCamel] int buildin_isdead (struct script_state *st); // [Jaxad0127] int buildin_fakenpcname (struct script_state *st); //[Kage] int buildin_unequip_by_id (struct script_state *st); // [Freeyorp] +int buildin_getx (struct script_state *st); // [Kage] +int buildin_gety (struct script_state *st); // [Kage] + void push_val (struct script_stack *stack, int type, int val); int run_func (struct script_state *st); @@ -737,6 +740,10 @@ struct buildin_fakenpcname, "fakenpcname", "ssi"}, { buildin_unequip_by_id, "unequipbyid", "i"}, // [Freeyorp] + { + buildin_getx, "getx", "i"}, // [Kage] + { + buildin_gety, "gety", "i"}, // [Kage] // End Additions { NULL, NULL, NULL},}; @@ -7250,6 +7257,31 @@ int buildin_fakenpcname (struct script_state *st) return 0; } +/*============================ + * Gets the PC's x pos + *---------------------------- + */ + +int buildin_getx (struct script_state *st) +{ + struct map_session_data *sd = script_rid2sd (st); + + push_val (st->stack, C_INT, sd->bl.x); + return 0; +} + +/*============================ + * Gets the PC's y pos + *---------------------------- + */ +int buildin_gety (struct script_state *st) +{ + struct map_session_data *sd = script_rid2sd (st); + + push_val (st->stack, C_INT, sd->bl.y); + return 0; +} + // // 実行部main // |