diff options
-rw-r--r-- | src/game.cpp | 51 | ||||
-rw-r--r-- | src/game.h | 1 | ||||
-rw-r--r-- | src/gui/char_select.cpp | 12 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 14 | ||||
-rw-r--r-- | src/gui/skill.cpp | 2 | ||||
-rw-r--r-- | src/gui/stats.cpp | 30 | ||||
-rw-r--r-- | src/gui/stats.h | 42 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/main.h | 12 |
9 files changed, 116 insertions, 50 deletions
diff --git a/src/game.cpp b/src/game.cpp index 17a45ded..2f9cc475 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -64,7 +64,7 @@ void refresh_screen(void) { END_OF_FUNCTION(refresh_screen); int fps = 0, frame = 0; -/** lets u only trigger an action every other second +/** lets u only trigger an action every other second tmp. counts fps*/ void second(void) { action_time = true; @@ -94,7 +94,7 @@ void game() { status("GRAPHIC"); do_graphic(); refresh = false; - } + } status("PARSE"); do_parse(); status("FLUSH"); @@ -111,24 +111,24 @@ void game() { void do_init() { if(!load_map(map_path))error("Could not find map file"); - + sound.StartMOD("./data/sound/Mods/somemp.xm", -1); // Initialize timers - tick_time = 0; + tick_time = 0; refresh = false; LOCK_VARIABLE(tick_time); LOCK_VARIABLE(refresh); install_int_ex(refresh_time, MSEC_TO_TIMER(1)); install_int_ex(refresh_screen, /*MSEC_TO_TIMER(2000)*/BPS_TO_TIMER(75)); // Set max refresh rate to 75 fps - install_int_ex(second, BPS_TO_TIMER(1)); + install_int_ex(second, BPS_TO_TIMER(1)); // Interrupt drawing while in background #ifdef WIN32 set_display_switch_mode(SWITCH_AMNESIA); #else set_display_switch_mode(SWITCH_PAUSE); - #endif + #endif // Initialize beings empty(); @@ -163,7 +163,7 @@ void do_input() { player_node->action = WALK; player_node->tick_time = tick_time; set_coordinates(player_node->coordinates, x, y-1, NORTH); - } else set_coordinates(player_node->coordinates, x, y, NORTH); + } else set_coordinates(player_node->coordinates, x, y, NORTH); } else if(key[KEY_DOWN]) { if(get_walk(x, y+1)!=0) { walk(x, y+1, SOUTH); @@ -173,7 +173,7 @@ void do_input() { player_node->action = WALK; player_node->tick_time = tick_time; set_coordinates(player_node->coordinates, x, y+1, SOUTH); - } else set_coordinates(player_node->coordinates, x, y, SOUTH); + } else set_coordinates(player_node->coordinates, x, y, SOUTH); } else if(key[KEY_LEFT]) { if(get_walk(x-1, y)!=0) { walk(x-1, y, WEST); @@ -183,7 +183,7 @@ void do_input() { player_node->action = WALK; player_node->tick_time = tick_time; set_coordinates(player_node->coordinates, x-1, y, WEST); - } else set_coordinates(player_node->coordinates, x, y, WEST); + } else set_coordinates(player_node->coordinates, x, y, WEST); } else if(key[KEY_RIGHT]) { if(get_walk(x+1, y)!=0) { walk(x+1, y, EAST); @@ -193,8 +193,8 @@ void do_input() { player_node->action = WALK; player_node->tick_time = tick_time; set_coordinates(player_node->coordinates, x+1, y, EAST); - } else set_coordinates(player_node->coordinates, x, y, EAST); - } + } else set_coordinates(player_node->coordinates, x, y, EAST); + } } if(player_node->action==STAND) @@ -203,7 +203,7 @@ void do_input() { attack(get_x(player_node->coordinates), get_y(player_node->coordinates), get_direction(player_node->coordinates)); player_node->tick_time = tick_time; } - + if(key[KEY_F1]) { save_bitmap("./Graphic/screenshot.bmp",double_buffer,NULL); } else if(key[KEY_F12]){ @@ -218,13 +218,13 @@ void do_input() { action(3, 0); action_time = false; } - - if(key[KEY_ENTER]) { + + if(key[KEY_ENTER]) { if(strcmp(speech, "")!=0) { chatlog.chat_send(char_info[0].name, speech); strcpy(speech,""); } - } + } // Emotions, Skill dialog if(key_shifts & KB_ALT_FLAG && action_time == true) { @@ -280,7 +280,7 @@ void do_input() { } } } - + if(key[KEY_ESC])state = EXIT; } @@ -322,7 +322,7 @@ void do_parse() { fprintf(file, "%x\n", RFIFOW(0)); fclose(file);*/ - // Parse packet based on their id + // Parse packet based on their id switch(id) { // Received speech case 0x008d: @@ -348,7 +348,7 @@ void do_parse() { if(player_node->speech!=NULL) { free(player_node->speech); player_node->speech = NULL; - } + } player_node->speech = (char *)malloc(RFIFOW(2)-3); memset(player_node->speech, '\0', RFIFOW(2)-3); @@ -408,7 +408,7 @@ void do_parse() { } break; // Monster moving - case 0x007b: + case 0x007b: node = find_node(RFIFOL(2)); if(node==NULL) { node = create_node(); @@ -445,7 +445,7 @@ void do_parse() { else if(get_dest_y(RFIFOP(50))<get_y(node->coordinates))direction = NORTH; else node->action = STAND; if(node->action==WALK)node->tick_time = tick_time; - set_coordinates(node->coordinates, get_dest_x(RFIFOP(50)), get_dest_y(RFIFOP(50)), direction); + set_coordinates(node->coordinates, get_dest_x(RFIFOP(50)), get_dest_y(RFIFOP(50)), direction); } break; // NPC dialog @@ -506,7 +506,7 @@ void do_parse() { action.unused = RFIFOW(6); action.success = RFIFOB(8); action.reason = RFIFOB(9); - + if(action.success != SKILL_FAILED && action.bskill == BSKILL_EMOTE ) { printf("Action: %d/%d", action.bskill, action.success); @@ -531,7 +531,8 @@ void do_parse() { case 11: char_info->lv = RFIFOW(4); break; - } + } + charstats_display(char_info); if(char_info->hp==0) { ok("Message", "You're now dead, press ok to restart"); WFIFOW(0) = net_w_value(0x00b2); @@ -650,11 +651,11 @@ void do_parse() { break; // Manage non implemented packets default: - //alert(pkt_nfo,"","","","",0,0); + //alert(pkt_nfo,"","","","",0,0); break; } - //alert(pkt_nfo,"","","","",0,0); - + //alert(pkt_nfo,"","","","",0,0); + RFIFOSKIP(len); } } @@ -34,6 +34,7 @@ #include "main.h" #include "./gui/gui.h" #include "./gui/skill.h" +#include "./gui/stats.h" #include "./graphic/super_eagle.h" #define SPEECH_TIME 40 diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index ac35cac9..a23c4713 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -35,8 +35,8 @@ DIALOG char_select_dialog[] = { { tmw_bitmap_proc, 304, 282, 192, 70, 0, 0, 0, 0, 80, 60, playerset, NULL, NULL }, { tmw_button_proc, 398, 426, 44, 18, 0, -1, 'o', D_EXIT, -1, 0, (char*)"&Ok", NULL, NULL }, { tmw_button_proc, 446, 426, 44, 18, 0, -1, 'c', D_EXIT, -1, 0, (char*)"&Cancel", NULL, NULL }, - { tmw_button_proc, 304, 426, 44, 18, 0, 0, 0, D_EXIT, 0, 0, button_state, NULL, NULL }, -/* { gui_button_proc, 304, 356, 20, 20, 0, 0, 0, 0, 0, 0, "<", NULL, NULL }, + { tmw_button_proc, 304, 426, 44, 18, 0, 0, 0, D_EXIT, 0, 0, button_state, NULL, NULL }, +/* { gui_button_proc, 304, 356, 20, 20, 0, 0, 0, 0, 0, 0, "<", NULL, NULL }, { gui_button_proc, 328, 356, 20, 20, 0, 0, 0, 0, 0, 0, ">", NULL, NULL }, */ { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, }; @@ -97,7 +97,7 @@ void server_char_select() { log_int("Char_Select_Packet", "Packet_in_size", RFIFOW(2)); log_int("Char_Select_Packet", "In_size", in_size); - if(RFIFOW(0)==0x0071) { + if(RFIFOW(0)==0x0071) { while(in_size<28)flush(); char_ID = RFIFOL(2); memset(map_path, '\0', 480); @@ -137,7 +137,7 @@ void server_char_delete() { WFIFOSET(46); while((in_size<2)||(out_size>0))flush(); - if(RFIFOW(0)==0x006f) { + if(RFIFOW(0)==0x006f) { RFIFOSKIP(2); ok("Info", "Player deleted"); free(char_info); @@ -184,7 +184,7 @@ void server_char_delete() { while((in_size<3)||(out_size>0))flush(); if(RFIFOW(0)==0x006d) { while(in_size<108)flush(); - char_info = (CHAR_SEL_INFO *)malloc(sizeof(CHAR_SEL_INFO)); + char_info = (CHAR_INFO *)malloc(sizeof(CHAR_INFO)); char_info->id = account_ID; memset(char_info->name, '\0', 24); strcpy(char_info[0].name, RFIFOP(2+74)); @@ -203,7 +203,7 @@ void server_char_delete() { char_info->INT = RFIFOB(2+101); char_info->DEX = RFIFOB(2+102); char_info->LUK = RFIFOB(2+103); - RFIFOSKIP(108); + RFIFOSKIP(108); n_character++; } else if(RFIFOW(0)==0x006c) { switch(RFIFOB(2)) { diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 827e725e..4fbb2267 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -75,8 +75,8 @@ void server_char_server() { if(ret==SOCKET_ERROR) { ok("Error", "Unable to connect to char server"); return; - } - + } + // Send login infos WFIFOW(0) = net_w_value(0x0065); WFIFOL(2) = net_l_value(account_ID); @@ -90,11 +90,11 @@ void server_char_server() { RFIFOSKIP(4); while(in_size<3)flush(); - + if(RFIFOW(0)==0x006b) { while(in_size<RFIFOW(2))flush(); n_character = (RFIFOW(2)-24)/106; - char_info = (CHAR_SEL_INFO *)malloc(sizeof(CHAR_SEL_INFO)*n_character); + char_info = (CHAR_INFO *)malloc(sizeof(CHAR_INFO)*n_character); for(int i=0;i<n_character;i++) { char_info[i].id = RFIFOL(24+106*i); strcpy(char_info[i].name, RFIFOP(24+106*i+74)); @@ -116,12 +116,12 @@ void server_char_server() { } state = CHAR_SELECT; - log("Player", "name", char_info->name); + log("Player", "name", char_info->name); log_hex("Char_Server_Packet", "Packet_ID", RFIFOW(0)); log_int("Char_Server_Packet", "Packet_length", RFIFOW(2)); - - RFIFOSKIP(RFIFOW(2)); + + RFIFOSKIP(RFIFOW(2)); } else if(RFIFOW(0)==0x006c) { switch(RFIFOB(2)) { case 0: diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index f1ccdcc2..35abb975 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -25,7 +25,7 @@ #include "skill.h" -extern CHAR_SEL_INFO *char_info; +extern CHAR_INFO *char_info; char str_string[8]; char agi_string[8]; diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp new file mode 100644 index 00000000..9b059369 --- /dev/null +++ b/src/gui/stats.cpp @@ -0,0 +1,30 @@ +/* + + The Mana World + Copyright 2004 The Mana World Development Team + + This file is part of The Mana World. + + The Mana World is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + any later version. + + The Mana World is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The Mana World; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include "stats.h" + +#include <iostream> + +int charstats_display(CHAR_INFO * test) { + std::cout << "char_stats: " << endl; +} diff --git a/src/gui/stats.h b/src/gui/stats.h new file mode 100644 index 00000000..09ec8950 --- /dev/null +++ b/src/gui/stats.h @@ -0,0 +1,42 @@ +/* + + The Mana World + Copyright 2004 The Mana World Development Team + + This file is part of The Mana World. + + The Mana World is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + any later version. + + The Mana World is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with The Mana World; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#ifndef __STATS_H +#define __STATS_H + +#include <allegro.h> +#include "../main.h" +#include "gui.h" + +typedef struct CHAR_INFO { + int id; + char name[24]; + short hp, max_hp, sp, max_sp, lv; + int xp, zeny, job_xp, job_lv; + short statp, skillp; + char STR, AGI, VIT, INT, DEX, LUK; +}; + +int charstats_display(CHAR_INFO *); + +#endif diff --git a/src/main.cpp b/src/main.cpp index cc347ec4..df46d6bb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,7 +31,7 @@ int account_ID, session_ID1, session_ID2; char sex, n_server, n_character; SERVER_INFO *server_info; -CHAR_SEL_INFO *char_info; +CHAR_INFO *char_info = new CHAR_INFO; BITMAP *playerset; DATAFILE *graphic, *emotions; @@ -37,6 +37,7 @@ #include "./net/protocol.h" #include "./gui/login.h" #include "./gui/gui.h" +#include "./gui/stats.h" #include "./gui/char_server.h" #include "./gui/char_select.h" #include "./graphic/super_eagle.h" @@ -57,15 +58,6 @@ typedef struct { short online_users; } SERVER_INFO; -typedef struct { - int id; - char name[24]; - short hp, max_hp, sp, max_sp, lv; - int xp, zeny, job_xp, job_lv; - short statp, skillp; - char STR, AGI, VIT, INT, DEX, LUK; -} CHAR_SEL_INFO; - extern BITMAP *playerset; extern DATAFILE *graphic, *emotions; extern char username[25]; @@ -76,7 +68,7 @@ extern char map_name[16]; extern int account_ID, session_ID1, session_ID2; extern char sex, n_server, n_character; extern SERVER_INFO *server_info; -extern CHAR_SEL_INFO *char_info; +extern CHAR_INFO *char_info; extern unsigned char state; extern unsigned short x, y; extern unsigned char direction; |