summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-02 07:08:49 -0700
committerJared Adams <jaxad0127@gmail.com>2009-03-02 07:08:49 -0700
commit98bf635c00bbf45c0fe8e29a2d6d296e02a4af7c (patch)
treee7d9ddf901fc1358bd4173922f1eaf778f12518b /src
parentb7969221c5dc07e5d99e91365c271fddf7ae85d1 (diff)
downloadtmwa-98bf635c00bbf45c0fe8e29a2d6d296e02a4af7c.tar.gz
tmwa-98bf635c00bbf45c0fe8e29a2d6d296e02a4af7c.tar.bz2
tmwa-98bf635c00bbf45c0fe8e29a2d6d296e02a4af7c.tar.xz
tmwa-98bf635c00bbf45c0fe8e29a2d6d296e02a4af7c.zip
Add another function for checking player location
You can now check to see if they are in a specified rectangle.
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 884f1bc..19557c7 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -289,6 +289,7 @@ int buildin_getlook(struct script_state *st); //Lorky [Lupus]
int buildin_getsavepoint(struct script_state *st); //Lorky [Lupus]
int buildin_getpartnerid(struct script_state *st); // [Fate]
int buildin_areatimer(struct script_state *st); // [Jaxad0127]
+int buildin_isin(struct script_state *st); // [Jaxad0127]
void push_val(struct script_stack *stack,int type,int val);
int run_func(struct script_state *st);
@@ -498,7 +499,8 @@ struct {
{buildin_mobcount,"mobcount","ss"},
{buildin_getlook,"getlook","i"},
{buildin_getsavepoint,"getsavepoint","i"},
- {buildin_areatimer,"areatimer","siiiiis"}, // End Additions
+ {buildin_areatimer,"areatimer","siiiiis"},
+ {buildin_isin,"isin","siiii"}, // End Additions
{NULL,NULL,NULL},
};
int buildin_message(struct script_state *st); // [MouseJstr]
@@ -6075,7 +6077,32 @@ int buildin_areatimer(struct script_state *st)
return 0;
}
+/*==========================================
+ * Check whether the PC is in the specified rectangle
+ *------------------------------------------
+ */
+int buildin_isin(struct script_state *st)
+{
+ int x1,y1,x2,y2;
+ char *str;
+ struct map_session_data *sd=script_rid2sd(st);
+
+ str=conv_str(st,& (st->stack->stack_data[st->start+2]));
+ x1=conv_num(st,& (st->stack->stack_data[st->start+3]));
+ y1=conv_num(st,& (st->stack->stack_data[st->start+4]));
+ x2=conv_num(st,& (st->stack->stack_data[st->start+5]));
+ y2=conv_num(st,& (st->stack->stack_data[st->start+6]));
+ if (!sd)
+ return 1;
+
+ push_val(st->stack, C_INT,
+ (sd->bl.x >= x1 && sd->bl.x <= x2)
+ && (sd->bl.y >= y1 && sd->bl.y <= y2)
+ && (!strcmp(str, map[sd->bl.m].name)));
+
+ return 0;
+}
//
// ŽÀs•”main