summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-11-12 15:11:47 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-11-12 15:11:47 +0000
commit526f9a301caa29d1922561104de9aea8bc213b65 (patch)
treebc2852547d0b41843375dcf406c00e1ee54117d9 /src
parent628ac878c21c5150528b969ac151cd2450e2549d (diff)
downloadmana-526f9a301caa29d1922561104de9aea8bc213b65.tar.gz
mana-526f9a301caa29d1922561104de9aea8bc213b65.tar.bz2
mana-526f9a301caa29d1922561104de9aea8bc213b65.tar.xz
mana-526f9a301caa29d1922561104de9aea8bc213b65.zip
NPC lists
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp15
-rw-r--r--src/graphic/graphic.cpp7
-rw-r--r--src/gui/char_select.cpp1
-rw-r--r--src/gui/chat.cpp3
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/npc.cpp24
6 files changed, 38 insertions, 14 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 0a0534f5..df741710 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -381,8 +381,13 @@ void do_parse() {
break;
// Success to walk request
case 0x0087:
- if(walk_status==1)
- walk_status = 2;
+ if(walk_status==1) {
+ if(get_src_x(RFIFOP(6))==src_x)
+ if(get_src_y(RFIFOP(6))==src_y)
+ if(get_dest_x(RFIFOP(6))==get_x(player_node->coordinates))
+ if(get_dest_y(RFIFOP(6))==get_y(player_node->coordinates))
+ walk_status = 2;
+ }
break;
// Add new being / stop monster
case 0x0078:
@@ -675,10 +680,8 @@ void do_parse() {
break;
// Level up
case 0x019b:
- if(RFIFOW(2)==0) {
- ok("Info", "Level up!");
- } else if(RFIFOW(2)==1) {
- ok("Info", "Job level up!");
+ if(RFIFOL(2)==player_node->id) {
+ sound.StartWAV("./data/sound/wavs/level.wav", 10);
}
break;
// Emotion
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 3cc90377..cc4ec179 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -244,6 +244,11 @@ void do_graphic(void) {
node->frame = (get_elapsed_time(node->tick_time)*4)/(node->speed);
if(node->frame>=4) {
node->frame = 0;
+ if(node->action==WALK)
+ if(walk_status==1) {
+ set_coordinates(player_node->coordinates, src_x, src_y, direction);
+ walk_status = 0;
+ }
node->action = STAND;
// node->tick_time;
if(node->id==player_node->id)
@@ -486,7 +491,7 @@ void do_graphic(void) {
update_stats_dialog();
gui_update(stats_player);
- alfont_textprintf(double_buffer, gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i %i %i", fps, player_node->frame, player_node->action);
+ alfont_textprintf(double_buffer, gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i %i %i %i %i", fps, get_x(player_node->coordinates), get_y(player_node->coordinates),src_x,src_y);
//alfont_textprintf(double_buffer, gui_font, 0, 20, MAKECOL_WHITE, "%i", show_npc_dialog);
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index b4294f3d..b1b88393 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -121,6 +121,7 @@ void char_select() {
if((gui_exit==3)||((key[KEY_ENTER])&&(strcmp(button_state, "Del")==0)))server_char_select();
else if(gui_exit==4)close_session();
else if(gui_exit==5)server_char_delete();
+ //alert("","","","","",0,0);
if(state==LOGIN)close_session();
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 10823e3c..e8cfa4cc 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -184,7 +184,8 @@ char * Chat::chat_send(std::string nick, std::string msg) {
if(msg.substr(0,IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE) {
msg.erase(0,IS_ANNOUNCE_LENGTH);
packid = 0x0099;
- } else {
+ } else if(msg.substr(0,IS_WHERE_LENGTH) == IS_WHERE) {
+ } else {
packid = 0x008c;
}
// prepare ordinary message
diff --git a/src/gui/chat.h b/src/gui/chat.h
index c1126b52..fd6dae94 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -39,6 +39,8 @@
#define IS_ANNOUNCE "/announce "
#define IS_ANNOUNCE_LENGTH 10
+#define IS_WHERE "/where "
+#define IS_WHERE_LENGTH 7
/**
gets in between usernick and message text depending on
diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp
index 0b7a7102..37fc4eb2 100644
--- a/src/gui/npc.cpp
+++ b/src/gui/npc.cpp
@@ -50,7 +50,7 @@ char *item_list(int index, int *list_size) {
void add_item(char *name) {
ITEM *item = item_head;
ITEM *temp = (ITEM *)malloc(sizeof(ITEM));
- temp->name = NULL;
+ //temp->name = NULL;
temp->name = name;
temp->next = NULL;
if(!item_head)
@@ -63,16 +63,29 @@ void add_item(char *name) {
item_number++;
}
+void remove_tail() {
+ int iterator = 0;
+ ITEM *temp = item_head;
+ while(iterator<item_number-2) {
+ temp = temp->next;
+ iterator++;
+ }
+ free(temp->next);
+ temp->next = NULL;
+ item_number--;
+}
+
void parse_items(char *string, short len) {
char *token = strtok(string, ":");
while(token!=NULL) {
- if(strcmp(token, "you prefer?")!=0) { // temp fix for the barber script
+ //if(strcmp(token, "you prefer?")!=0) { // temp fix for the barber script
char *temp = (char *)malloc(strlen(token));
strcpy(temp, token);
add_item(temp);
- }
+ //}
token = strtok(NULL, ":");
- }
+ }
+ remove_tail();
}
void remove_all_items() {
@@ -87,6 +100,5 @@ void remove_all_items() {
}
item_head = NULL;
item_number = 0;
-}
-
+}