diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 5 | ||||
-rw-r--r-- | src/game.cpp | 25 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 8 | ||||
-rw-r--r-- | src/graphic/graphic.h | 1 | ||||
-rw-r--r-- | src/gui/skill.cpp | 2 |
5 files changed, 31 insertions, 10 deletions
diff --git a/src/being.cpp b/src/being.cpp index 0c15918e..e52fc76e 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -149,7 +149,10 @@ unsigned int find_npc(unsigned short x, unsigned short y) { if((get_x(node->coordinates)==x)&&(get_y(node->coordinates)==y)) return node->id; else node = node->next; - } else node = node->next; + } else { + node = node->next; + //alert("id","","","","",0,0); + } } return 0; } diff --git a/src/game.cpp b/src/game.cpp index 2e8a1dde..a07ad8e4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -119,7 +119,7 @@ void do_init() { if(!load_map(map_path))error("Could not find map file"); - //sound.StartMOD("./data/sound/Mods/somemp.xm", -1); + sound.StartMOD("./data/sound/Mods/somemp.xm", -1); // Initialize timers tick_time = 0; @@ -145,7 +145,8 @@ void do_init() { set_coordinates(player_node->coordinates, x, y, 0); player_node->speed = 150; add_node(player_node); - keyb_state = IDLE; + //keyb_state = IDLE; + show_npc_dialog = 0; remove("packet.list"); } @@ -278,17 +279,21 @@ void do_input() { } if(mouse_b&2) { - if(!show_npc_dialog) { + //if(show_npc_dialog==0) { int npc_x = mouse_x/32+camera_x; int npc_y = mouse_y/32+camera_y; int id = find_npc(npc_x, npc_y); + /*char tyr[20]; + sprintf(tyr,"%i %i %i", npc_x, npc_y, id); + alert(tyr,"","","","",0,0); + alfont_textprintf(screen, gui_font, mouse_x+20, mouse_y+20, MAKECOL_WHITE, "%i %i", npc_x, npc_y);*/ if(id!=0) { WFIFOW(0) = net_w_value(0x0090); WFIFOL(2) = net_l_value(id); WFIFOB(6) = 0; WFIFOSET(7); } - } + //} } if(key[KEY_ESC])state = EXIT; @@ -297,7 +302,7 @@ void do_input() { /** Calculate packet length */ int get_packet_length(short id) { - int len = get_length(id); + int len = get_length(id); if(len==-1)len = RFIFOW(2); return len; } @@ -638,8 +643,12 @@ void do_parse() { case 3: // Stand up node = find_node(RFIFOL(2)); if(node!=NULL) { - if(RFIFOB(26)==2) + node->frame = 0; + if(RFIFOB(26)==2) { node->action = SIT; + alert("","","","","",0,0); + walk_status = 0; + } else if(RFIFOB(26)==3) node->action = STAND; } @@ -702,10 +711,10 @@ void do_parse() { break; // Buy/Sell dialog case 0x00c4: - if(show_npc_dialog==0) { + //if(show_npc_dialog==0) { show_npc_dialog = 2; current_npc = RFIFOL(2); - } + //} break; // Buy dialog case 0x00c6: diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 3e07e9d0..197866d7 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -107,6 +107,10 @@ DIALOG chat_dialog[] = { { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; +void set_npc_dialog(int show) { + show_npc_dialog = show; +} + int get_x_offset(NODE *node) { int offset = 0; char direction = get_direction(node->coordinates); @@ -195,10 +199,12 @@ void do_graphic(void) { while(node) { if((node->job>=100)&&(node->job<=110)) { // Draw a NPC masked_blit((BITMAP *)graphic[NPCSET_BMP].dat, buffer, (get_direction(node->coordinates)/2+4*(node->job-100))*25, 0, (get_x(node->coordinates)-camera_x)*16-4-offset_x, (get_y(node->coordinates)-camera_y)*16-24-offset_y, 25, 40); + //alfont_textprintf(buffer, gui_font, (get_x(node->coordinates)-camera_x)*16-4-offset_x, (get_y(node->coordinates)-camera_y)*16-24-offset_y, MAKECOL_WHITE, "%i %i", get_x(node->coordinates), get_y(node->coordinates)); } else if(node->job<10) { // Draw a player node->text_x = (get_x(node->coordinates)-camera_x)*16-34+get_x_offset(node)-offset_x; node->text_y = (get_y(node->coordinates)-camera_y)*16-36+get_y_offset(node)-offset_y; masked_blit((BITMAP *)graphic[PLAYERSET_BMP].dat, buffer, 80*(get_direction(node->coordinates)/2), 60*(node->frame+node->action), node->text_x, node->text_y, 80, 60); + alfont_textprintf(buffer, gui_font, 0, 20, MAKECOL_WHITE, "%i %i", node->text_x,node->text_y); if(node->emotion!=0) { draw_sprite(buffer, (BITMAP *)emotions[node->emotion-1].dat, (get_x(node->coordinates)-camera_x)*16-5+get_x_offset(node)-offset_x, (get_y(node->coordinates)-camera_y)*16-45+get_y_offset(node)-offset_y); @@ -434,6 +440,8 @@ void do_graphic(void) { alfont_textprintf(double_buffer, gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i", fps); + alfont_textprintf(double_buffer, gui_font, 0, 20, MAKECOL_WHITE, "%i", show_npc_dialog); + blit(double_buffer, screen, 0, 0, 0, 0, 800, 600); frame++; diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index bfbb106f..e35d7b85 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -51,6 +51,7 @@ extern int show_npc_dialog; extern TmwInventory inventory; extern int map_x, map_y, camera_x, camera_y; +void set_npc_dialog(int show); void do_graphic(void); void init_graphic(void); void exit_graphic(void); diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 45095902..46215b63 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -176,5 +176,5 @@ void increaseStatus(void *dp3, int d1) { WFIFOW(4) = net_b_value(1); WFIFOSET(5); while((out_size>0))flush(); - skill_dialog[2].d2 = skill_dialog[4].d2 = skill_dialog[6].d2 =skill_dialog[8].d2 =skill_dialog[10].d2 = 0; + skill_dialog[2].d2 = skill_dialog[4].d2 = skill_dialog[6].d2 = skill_dialog[8].d2 = skill_dialog[10].d2 = 0; } |