summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2004-11-19 15:58:06 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2004-11-19 15:58:06 +0000
commitff858300d4b303d4c48b2d915ac6cea30182aa8d (patch)
tree786c2808202abdae93d6a48c2272b66f28da6a94 /src
parenta2cc2aa19f7dacdd719c9459cdfedb952e0c8d09 (diff)
downloadmana-ff858300d4b303d4c48b2d915ac6cea30182aa8d.tar.gz
mana-ff858300d4b303d4c48b2d915ac6cea30182aa8d.tar.bz2
mana-ff858300d4b303d4c48b2d915ac6cea30182aa8d.tar.xz
mana-ff858300d4b303d4c48b2d915ac6cea30182aa8d.zip
Hair styles
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp1
-rw-r--r--src/being.h37
-rw-r--r--src/game.cpp3
-rw-r--r--src/game.h56
-rw-r--r--src/graphic/graphic.cpp24
-rw-r--r--src/gui/char_select.cpp1
-rw-r--r--src/gui/char_server.cpp1
-rw-r--r--src/main.cpp7
-rw-r--r--src/main.h3
9 files changed, 77 insertions, 56 deletions
diff --git a/src/being.cpp b/src/being.cpp
index be26dd18..e37b3cd1 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -79,6 +79,7 @@ NODE *create_node() {
node->text_x = node->text_y = 0;
node->hair_style = 1;
node->hair_color = 1;
+ node->weapon = 0;
return node;
}
diff --git a/src/being.h b/src/being.h
index de4b7e29..3ab9ba92 100644
--- a/src/being.h
+++ b/src/being.h
@@ -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)
*/
@@ -56,6 +56,7 @@ struct NODE {
unsigned char emotion_time;
int text_x, text_y; // temp solution to fix speech position
short hair_style, hair_color;
+ short weapon;
};
void empty();
diff --git a/src/game.cpp b/src/game.cpp
index 9c1c8c82..84aa85d3 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -144,8 +144,9 @@ void do_init() {
player_node->speed = 150;
player_node->hair_color = char_info->hair_color;
player_node->hair_style = char_info->hair_style;
+ if(char_info->weapon==11)char_info->weapon = 1;
+ player_node->weapon = char_info->weapon;
add_node(player_node);
- //keyb_state = IDLE;
show_npc_dialog = 0;
remove("./docs/packet.list");
diff --git a/src/game.h b/src/game.h
index b4ec5a50..59cf2642 100644
--- a/src/game.h
+++ b/src/game.h
@@ -2,22 +2,26 @@
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
+
+ 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)
+
+ kth5 aka Alexander Baldeck
*/
@@ -44,19 +48,17 @@
#define MAKECOL_WHITE makecol(255,255,255)
#define MAKECOL_BLACK makecol(0,0,0)
-#define GET_WALKING_SPEECH_XCOORDS ((get_x(node->coordinates)-map_x+13)*16-25-(alfont_text_length(gui_font, node->speech)/2)-player_x-coeff_x*(16-4*node->frame))
-#define GET_WALKING_SPEECH_YCOORDS ((get_y(node->coordinates)-map_y+6)*16-55-player_y-coeff_y*(16-4*node->frame))
-
-#define GET_STANDING_SPEECH_XCOODRS ((get_x(node->coordinates)-map_x+13)*16-25-(alfont_text_length(gui_font, node->speech)/2)-player_x)
-#define GET_STANDING_SPEECH_YCOORDS ((get_y(node->coordinates)-map_y+6)*16-55-player_y)
-
-#define PLAYERSETS 4
-#define SIT 9
-#define STAND 0
-#define WALK 1
+// Action defines
+#define STAND 0
+#define WALK 1
+#define ATTACK 5
+#define BOW_ATTACK 9
+#define SIT 13
+#define HIT 14
+#define DEAD 15
#define MONSTER_ATTACK 5
#define MONSTER_DEAD 9
-#define ATTACK 5
+
#define LOCK 254
#define IDLE 255
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 42b6856e..d3abd21f 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -117,7 +117,7 @@ DIALOG npc_list_dialog[] = {
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};
-char hairtable[10][4][2] = {
+char hairtable[14][4][2] = {
// S(x,y) W(x,y) N(x,y) E(x,y)
{ { 0, 0}, {-1, 2}, {-1, 2}, {0, 2} }, // STAND
{ { 0, 2}, {-2, 3}, {-1, 2}, {1, 3} }, // WALK 1st frame
@@ -128,7 +128,11 @@ char hairtable[10][4][2] = {
{ { 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
- { { 0, 4}, {-1, 6}, {-1, 6}, {0, 6} }, // SIT
+ { { 0, 0}, {-1, 2}, {-1, 2}, {-1, 2} }, // BOW_ATTACK 1st frame
+ { { 0, 0}, {-1, 2}, {-1, 2}, {-1, 2} }, // BOW_ATTACK 2nd frame
+ { { 0, 0}, {-1, 2}, {-1, 2}, {-1, 2} }, // BOW_ATTACK 3rd frame
+ { { 0, 0}, {-1, 2}, {-1, 2}, {-1, 2} }, // BOW_ATTACK 4th frame
+ { { 0, 4}, {-1, 6}, {-1, 6}, {0, 6} } // SIT
};
void set_npc_dialog(int show) {
@@ -229,8 +233,15 @@ 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;
if(node->action==SIT)node->frame = 0;
- 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+4*(node->hair_style-1)), 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);
+ if(node->action==ATTACK) {
+ masked_blit((BITMAP *)graphic[PLAYERSET_BMP].dat, buffer, 80*(get_direction(node->coordinates)/2), 60*(node->frame+node->action+4*node->weapon), node->text_x, node->text_y, 80, 60);
+ draw_rle_sprite(buffer, (RLE_SPRITE *)weaponset[16*node->weapon+4*node->frame+get_direction(node->coordinates)/2].dat, node->text_x, node->text_y);
+ masked_blit(hairset, buffer, 20*(node->hair_color-1), 20*(get_direction(node->coordinates)/2+4*(node->hair_style-1)), node->text_x+31+hairtable[node->action+node->frame+4*node->weapon][get_direction(node->coordinates)/2][0], node->text_y+15+hairtable[node->action+node->frame+4*node->weapon][get_direction(node->coordinates)/2][1], 20, 20);
+ } else {
+ 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+4*(node->hair_style-1)), 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) {
@@ -420,8 +431,7 @@ void do_graphic(void) {
show_npc_dialog = 0;
buy_player = init_dialog(buy_dialog, -1);
close_shop();
- }
- break;
+ }break;
case 4:
//alert("","","","","",0,0);
//char ds[20];
@@ -495,7 +505,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 %i %i %i", fps, get_x(player_node->coordinates), get_y(player_node->coordinates),src_x,src_y,server_tick);
+ alfont_textprintf(double_buffer, gui_font, 0, 0, MAKECOL_WHITE, "FPS:%i %i %i %i %i %i %i", fps, get_x(player_node->coordinates), get_y(player_node->coordinates),src_x,src_y,server_tick,player_node->weapon);
//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 edb2f2dc..206b5850 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -259,6 +259,7 @@ void server_char_delete() {
char_info->LUK = RFIFOB(2+103);
char_info->hair_style = RFIFOW(2+54);
char_info->hair_color = RFIFOW(2+70);
+ char_info->weapon = RFIFOW(2+56);
RFIFOSKIP(108);
//n_character++;
} else if(RFIFOW(0)==0x006c) {
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 447860e9..6ff0baf8 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -116,6 +116,7 @@ void server_char_server() {
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);
+ char_info[i].weapon = RFIFOW(24+106*i+56);
}
state = CHAR_SELECT;
diff --git a/src/main.cpp b/src/main.cpp
index 1cf0fa1c..17dfdd2e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -48,7 +48,7 @@ SERVER_INFO *server_info;
PLAYER_INFO *char_info = new PLAYER_INFO;
BITMAP *playerset, *hairset;
-DATAFILE *graphic, *emotions;
+DATAFILE *graphic, *emotions, *weaponset;
char username[25];
char password[25];
@@ -207,7 +207,10 @@ void init_engine() {
hairset = load_bitmap("./data/graphic/hairset.bmp", NULL);
if(hairset==NULL)
error("Unable to load hairset bitmap");
-
+ weaponset = load_datafile("./data/graphic/weapon.dat");
+ if(weaponset==NULL)
+ error("Unable to load weaponset datafile");
+
init_gui(buffer, "./data/Skin/aqua.skin");
state = LOGIN;
}
diff --git a/src/main.h b/src/main.h
index b17f8bc2..fd832a0b 100644
--- a/src/main.h
+++ b/src/main.h
@@ -70,10 +70,11 @@ typedef struct {
int xp, gp, job_xp, job_lv;
short statp, skill_point, hair_color, hair_style;
char STR, AGI, VIT, INT, DEX, LUK;
+ short weapon;
} PLAYER_INFO;
extern BITMAP *playerset;
-extern DATAFILE *graphic, *emotions;
+extern DATAFILE *graphic, *emotions, *weaponset;
extern char username[25];
extern char password[25];
extern int map_address, char_ID;