diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 2 | ||||
-rw-r--r-- | src/being.h | 1 | ||||
-rw-r--r-- | src/game.cpp | 4 | ||||
-rw-r--r-- | src/game.h | 2 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 52 | ||||
-rw-r--r-- | src/graphic/graphic.h | 1 | ||||
-rw-r--r-- | src/gui/char_select.cpp | 122 | ||||
-rw-r--r-- | src/gui/char_select.h | 2 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 38 | ||||
-rw-r--r-- | src/gui/gui.cpp | 7 | ||||
-rw-r--r-- | src/main.cpp | 7 | ||||
-rw-r--r-- | src/main.h | 42 |
12 files changed, 179 insertions, 101 deletions
diff --git a/src/being.cpp b/src/being.cpp index e52fc76e..be26dd18 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -77,6 +77,8 @@ NODE *create_node() { node->emotion = 0; node->emotion_time = 0; node->text_x = node->text_y = 0; + node->hair_style = 1; + node->hair_color = 1; return node; } diff --git a/src/being.h b/src/being.h index f5187cb6..de4b7e29 100644 --- a/src/being.h +++ b/src/being.h @@ -55,6 +55,7 @@ struct NODE { unsigned char emotion; unsigned char emotion_time; int text_x, text_y; // temp solution to fix speech position + short hair_style, hair_color; }; void empty(); diff --git a/src/game.cpp b/src/game.cpp index 510de2cd..be8454b9 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -103,6 +103,8 @@ void game() { do_parse(); status("FLUSH"); flush(); + + rest(1); // This one should work only in Win32 } exit_graphic(); @@ -139,6 +141,8 @@ void do_init() { player_node->type = ACTION_NODE; set_coordinates(player_node->coordinates, x, y, 0); player_node->speed = 150; + player_node->hair_color = char_info->hair_color; + player_node->hair_style = char_info->hair_style; add_node(player_node); //keyb_state = IDLE; show_npc_dialog = 0; @@ -56,7 +56,7 @@ #define WALK 1 #define MONSTER_ATTACK 5 #define MONSTER_DEAD 9 -#define ATTACK 7 +#define ATTACK 5 #define LOCK 254 #define IDLE 255 diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index af32dc63..ca082ce7 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -2,24 +2,24 @@ 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 - - By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net) + + 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 + + By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net) */ @@ -107,6 +107,19 @@ DIALOG chat_dialog[] = { { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; +char hairtable[9][4][2] = { + // S(x,y) W(x,y) N(x,y) E(x,y) + { { 0, 0}, {-1, 2}, {-1, 2}, {0, 2} }, // STAND 1st frame + { { 0, 2}, {-2, 3}, {-1, 2}, {1, 3} }, // WALK 1st frame + { { 0, 3}, {-2, 4}, {-1, 3}, {1, 4} }, // WALK 2nd frame + { { 0, 1}, {-2, 2}, {-1, 2}, {1, 2} }, // WALK 3rd frame + { { 0, 2}, {-2, 3}, {-1, 2}, {1, 3} }, // WALK 4th frame + { { 0, 1}, {1, 2}, {-1, 3}, {-2, 2} }, // ATTACK 1st frame + { { 0, 1}, {-1, 2}, {-1, 3}, {0, 2} }, // ATTACK 2nd frame + { { 0, 2}, {-4, 3}, {0, 4}, {3, 3} }, // ATTACK 3rd frame + { { 0, 2}, {-4, 3}, {0, 4}, {3, 3} } // ATTACK 4th frame +}; + void set_npc_dialog(int show) { show_npc_dialog = show; } @@ -204,6 +217,7 @@ void do_graphic(void) { 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); + masked_blit(hairset, buffer, 20*(node->hair_color-1), 20*(get_direction(node->coordinates)/2), node->text_x+31+hairtable[node->action+node->frame][get_direction(node->coordinates)/2][0], node->text_y+15+hairtable[node->action+node->frame][get_direction(node->coordinates)/2][1], 20, 20); //alfont_textprintf(buffer, gui_font, 0, 20, MAKECOL_WHITE, "%i %i", node->text_x,node->text_y); if(node->emotion!=0) { @@ -438,7 +452,7 @@ void do_graphic(void) { update_stats_dialog(); gui_update(stats_player); - alfont_textprintf(double_buffer, gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i", fps); + 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, 20, MAKECOL_WHITE, "%i", show_npc_dialog); diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index e35d7b85..a652b5cf 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -50,6 +50,7 @@ extern bool show_skill_dialog, show_skill_list_dialog; extern int show_npc_dialog; extern TmwInventory inventory; extern int map_x, map_y, camera_x, camera_y; +extern BITMAP *hairset; void set_npc_dialog(int show); void do_graphic(void); diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 3422ad7f..ad151f25 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -1,40 +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 - - By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net) + 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 + + By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net) */ #include "char_select.h" #include "../graphic/graphic.h" +#include "../graphic/2xsai.h" char button_state[3]; char address[41]; char name[25]; +//short hair_color = 0; +//short hair_style = 0; DIALOG char_select_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ { tmw_dialog_proc, 300, 240, 200, 208, 0, -1, 0, 0, 0, 0, (char*)"Char select", NULL, NULL }, - { tmw_text_proc, 308, 268, 192, 10, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, - { tmw_bitmap_proc, 304, 282, 192, 70, 0, 0, 0, 0, 80, 60, playerset, NULL, NULL }, + { tmw_text_proc, 304, 268, 192, 10, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, + { tmw_player_proc, 304, 282, 142, 100, 0, 0, 0, 0, 80, 60, NULL, 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 }, @@ -45,20 +47,53 @@ DIALOG char_select_dialog[] = { DIALOG char_create_dialog[] = { /* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */ - { tmw_dialog_proc, 276, 240, 248, 116, 0, -1, 0, 0, 0, 0, (char*)"Char create", NULL, NULL }, - { tmw_text_proc, 280, 268, 192, 20, 0, 0, 0, 0, 0, 0, (char *)"Name: ", NULL, NULL }, - { tmw_edit_proc, 336, 268, 162, 20, 0, 0, 0, 0, 24, 0, name, NULL, NULL }, - { tmw_button_proc, 398, 334, 44, 18, 0, -1, 'o', D_EXIT, -1, 0, (char*)"&Ok", NULL, NULL }, - { tmw_button_proc, 446, 334, 44, 18, 0, -1, 'c', D_EXIT, -1, 0, (char*)"&Cancel", NULL, NULL }, + { tmw_dialog_proc, 300, 240, 200, 208, 0, -1, 0, 0, 0, 0, (char*)"Char create", NULL, NULL }, + { tmw_text_proc, 302, 386, 192, 20, 0, 0, 0, 0, 0, 0, (char *)"Name: ", NULL, NULL }, + { tmw_edit_proc, 340, 386, 156, 20, 0, 0, 0, 0, 24, 0, name, 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_player_proc, 304, 282, 142, 100, 0, 0, 0, 0, 80, 60, NULL, NULL, NULL }, + { tmw_incbutt_proc, 450, 282, 20, 20, 0, 0, 0, 0, 2, 0, (char*)"<", &char_info->hair_color, NULL }, + { tmw_incbutt_proc, 472, 282, 20, 20, 0, 0, 0, 0, 1, 0, (char*)">", &char_info->hair_color, NULL }, { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }, }; +#define MAX_HAIR_COLOR 6 + +int tmw_incbutt_proc(int msg, DIALOG *d, int c) { + if(msg==MSG_CLICK) { + //alert("","","","","",0,0); + if(d->d1==1)char_info->hair_color++; + else if(d->d1==2)char_info->hair_color--; + if(char_info->hair_color<1)char_info->hair_color = MAX_HAIR_COLOR+1; + if(char_info->hair_color>MAX_HAIR_COLOR+1)char_info->hair_color = 1; + d->flags = 0; + return D_O_K; + } + return tmw_button_proc(msg, d, c); +} + +int tmw_player_proc(int msg, DIALOG *d, int c) { + if(msg==MSG_DRAW) { + tmw_bitmap_proc(MSG_DRAW, d, 0); + //BITMAP *temp = create_bitmap(60, 50); + //clear_to_color(temp, makecol(255, 255, 255)); + if(n_character>0) { + masked_blit(playerset, gui_bitmap, 0, 0, d->x-10+40, d->y-10+30, 80, 60); + masked_blit(hairset, gui_bitmap, 20*(char_info->hair_color-1), 0, d->x+21+40, d->y+5+30, 20, 20); + } + //Super2xSaI(temp, gui_bitmap, 0, 0, d->x, d->y, temp->w*2, temp->h*2); + //blit(temp, gui_bitmap, 0, 0, d->x, d->y, 60,50); + } + return D_O_K; +} + void char_select() { state = LOGIN; if(n_character>0) { char_select_dialog[1].dp = char_info->name; char_select_dialog[1].x = 400-alfont_text_length(gui_font, char_info->name)/2; - char_select_dialog[2].dp = playerset; + //char_select_dialog[2].dp = playerset; if(playerset==NULL)ok("Error", "Playerset not loaded"); strcpy(button_state, "Del"); char_select_dialog[3].flags &= D_CLOSE; @@ -69,18 +104,21 @@ void char_select() { char_select_dialog[3].flags |= D_DISABLED; char_select_dialog[2].dp = NULL; strcpy(button_state, "New"); + char_info->hair_color = 1; + char_info->hair_style = 1; } - //centre_dialog(char_select_dialog); + //centre_dialog(char_select_dialog); DIALOG_PLAYER *player = init_dialog(char_select_dialog, -1); + //centre_dialog(char_select_dialog); int gui_exit = 1; - while ((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) { + while((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) { clear_bitmap(buffer); blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600); gui_exit = gui_update(player); blit(buffer, screen, 0, 0, 0, 0, 800, 600); } gui_exit = shutdown_dialog(player); - if((gui_exit==3)||(key[KEY_ENTER]))server_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(); if(state==LOGIN)close_session(); @@ -134,7 +172,7 @@ void server_char_delete() { if(yes_no("Confirm", "Are you sure?")==0) { // Request character deletion WFIFOW(0) = net_w_value(0x0068); - WFIFOL(2) = net_l_value(char_info[0].id); + WFIFOL(2) = net_l_value(char_info->id); WFIFOSET(46); while((in_size<2)||(out_size>0))flush(); @@ -157,6 +195,8 @@ void server_char_delete() { } // Create a new character } else { + n_character = 1; + centre_dialog(char_create_dialog); DIALOG_PLAYER *player = init_dialog(char_create_dialog, -1); int gui_exit = 1; @@ -177,15 +217,15 @@ void server_char_delete() { WFIFOB(30) = net_b_value(5); WFIFOB(31) = net_b_value(5); WFIFOB(32) = net_b_value(0); - WFIFOW(33) = net_w_value(1); - WFIFOW(35) = net_w_value(1); + WFIFOW(33) = net_w_value(char_info->hair_color); + WFIFOW(35) = net_w_value(char_info->hair_style); WFIFOSET(37); while((in_size<3)||(out_size>0))flush(); if(RFIFOW(0)==0x006d) { while(in_size<108)flush(); char_info = (PLAYER_INFO *)malloc(sizeof(PLAYER_INFO)); - char_info->id = account_ID; + char_info->id = RFIFOL(2);//account_ID; memset(char_info->name, '\0', 24); strcpy(char_info[0].name, RFIFOP(2+74)); char_info->hp = RFIFOW(2+42); @@ -203,8 +243,10 @@ void server_char_delete() { char_info->INT = RFIFOB(2+101); char_info->DEX = RFIFOB(2+102); char_info->LUK = RFIFOB(2+103); + char_info->hair_style = RFIFOW(2+54); + char_info->hair_color = RFIFOW(2+70); RFIFOSKIP(108); - n_character++; + //n_character++; } else if(RFIFOW(0)==0x006c) { switch(RFIFOB(2)) { case 0: @@ -215,7 +257,11 @@ void server_char_delete() { break; } RFIFOSKIP(3); - } else ok("Error", "Unknown error"); - } + n_character = 0; + } else { + ok("Error", "Unknown error"); + n_character = 0; + } + } else n_character = 0; } } diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 32c801e0..80e5716a 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -34,6 +34,8 @@ #include "../net/network.h" #include "gui.h" +int tmw_incbutt_proc(int msg, DIALOG *d, int c); +int tmw_player_proc(int msg, DIALOG *d, int c); void char_select(); void server_char_select(); void server_char_delete(); diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index dd51e0f1..447860e9 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -2,24 +2,24 @@ 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 - - By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net) + + 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 + + By ElvenProgrammer aka Eugenio Favalli (umperio@users.sourceforge.net) */ @@ -114,6 +114,8 @@ void server_char_server() { char_info[i].INT = RFIFOB(24+106*i+101); char_info[i].DEX = RFIFOB(24+106*i+102); char_info[i].LUK = RFIFOB(24+106*i+103); + char_info[i].hair_style = RFIFOW(24+106*i+54); + char_info[i].hair_color = RFIFOW(24+106*i+70); } state = CHAR_SELECT; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index b69db97a..c5568a74 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -540,7 +540,12 @@ int tmw_button_proc(int msg, DIALOG *d, int c) { alfont_text_mode(rtm); ret = D_O_K; } else { - ret = d_button_proc(msg,d,c); + /*if(msg==MSG_CLICK) { + if(d->d1==1)((int)d->dp2) + 1; + else if(d->d1==2)((int)d->dp2) - 1; + }*/ + + ret = d_button_proc(msg,d,c); } return ret; } diff --git a/src/main.cpp b/src/main.cpp index a64a4076..1cf0fa1c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,7 +47,7 @@ char sex, n_server, n_character; SERVER_INFO *server_info; PLAYER_INFO *char_info = new PLAYER_INFO; -BITMAP *playerset; +BITMAP *playerset, *hairset; DATAFILE *graphic, *emotions; char username[25]; @@ -58,7 +58,7 @@ char map_name[16]; unsigned char state; unsigned short x, y; unsigned char direction; -unsigned short job, hair, hair_color; +//unsigned short job, hair, hair_color; unsigned char stretch_mode; // new sound-engine /- kth5 @@ -204,6 +204,9 @@ void init_engine() { emotions = load_datafile("./data/graphic/emotions.dat"); if(emotions==NULL) error("Unable to load emotions datafile"); + hairset = load_bitmap("./data/graphic/hairset.bmp", NULL); + if(hairset==NULL) + error("Unable to load hairset bitmap"); init_gui(buffer, "./data/Skin/aqua.skin"); state = LOGIN; @@ -1,27 +1,25 @@ /* - - 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 - - By ElvenProgrammer aka Eugenio Favalli (umperio@users.upagiro.net) + + 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 + + By ElvenProgrammer aka Eugenio Favalli (umperio@users.upagiro.net) */ @@ -70,7 +68,7 @@ typedef struct { char name[24]; short hp, max_hp, sp, max_sp, lv; int xp, gp, job_xp, job_lv; - short statp, skill_point; + short statp, skill_point, hair_color, hair_style; char STR, AGI, VIT, INT, DEX, LUK; } PLAYER_INFO; @@ -88,7 +86,7 @@ extern PLAYER_INFO *char_info; extern unsigned char state; extern unsigned short x, y; extern unsigned char direction; -extern unsigned short job, hair, hair_color; +//extern unsigned short job, hair, hair_color; extern unsigned char stretch_mode; #endif |