diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-01-15 15:52:54 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-01-15 15:52:54 +0000 |
commit | c92d7c1188febd7c5af15fa710ab06c3af4dede5 (patch) | |
tree | f6a78141dd8b68098aaff444845068eef9caf155 /src | |
parent | ffadd9c8accbdc8f1fedf089c79bd6ec54b73884 (diff) | |
download | mana-c92d7c1188febd7c5af15fa710ab06c3af4dede5.tar.gz mana-c92d7c1188febd7c5af15fa710ab06c3af4dede5.tar.bz2 mana-c92d7c1188febd7c5af15fa710ab06c3af4dede5.tar.xz mana-c92d7c1188febd7c5af15fa710ab06c3af4dede5.zip |
Fixed and improved death
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 2 | ||||
-rw-r--r-- | src/being.h | 6 | ||||
-rw-r--r-- | src/game.cpp | 19 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 11 |
4 files changed, 25 insertions, 13 deletions
diff --git a/src/being.cpp b/src/being.cpp index 8091d7f8..4e421784 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -24,7 +24,7 @@ #include <stdio.h> #include "astar.h" -#include "Being.h" +#include "being.h" Being *player_node = NULL; diff --git a/src/being.h b/src/being.h index 368a60c6..ce6b8433 100644 --- a/src/being.h +++ b/src/being.h @@ -59,14 +59,14 @@ class Being { unsigned short weapon; Being(); - Being::~Being(); + ~Being(); }; /** Removes all beings from the list */ void empty(); /** Add a Being to the list */ -void add_node(Being *Being); +void add_node(Being *being); /** Return a specific id Being */ Being *find_node(unsigned int id); @@ -88,7 +88,7 @@ unsigned int find_monster(unsigned short x, unsigned short y); void sort(); /** Remove all path nodes from a being */ -void empty_path(Being *Being); +void empty_path(Being *being); extern Being *player_node; diff --git a/src/game.cpp b/src/game.cpp index 59a18a39..a4cde620 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -192,7 +192,7 @@ void do_exit() { } void do_input() { - if (walk_status == 0) { + if (walk_status == 0 && player_node->action != DEAD) { int x = player_node->x; int y = player_node->y; @@ -477,7 +477,8 @@ void do_parse() { being->frame = 0; being->tick_time = tick_time; } - else remove_node(RFIFOL(2)); + //else being->action = DEAD; + //remove_node(RFIFOL(2)); } else remove_node(RFIFOL(2)); } @@ -593,16 +594,22 @@ void do_parse() { memset(map_path, '\0', 480); append_filename(map_path, "./data/map/", RFIFOP(2), 480); if (load_map(map_path)) { + Being *temp; + temp = new Being(); + memcpy(temp, player_node, sizeof(Being)); empty(); - player_node = new Being(); + /*player_node = new Being(); player_node->job = 0; player_node->action = STAND; player_node->frame = 0; player_node->speed = 150; - player_node->id = account_ID; + player_node->id = account_ID;*/ + add_node(temp); + player_node = temp; + player_node->action = STAND; + player_node->frame = 0; player_node->x = RFIFOW(18); player_node->y = RFIFOW(20); - add_node(player_node); walk_status = 0; // Send "map loaded" WFIFOW(0) = net_w_value(0x007d); @@ -671,6 +678,8 @@ void do_parse() { deathNotice = new OkDialog("Message", "You're now dead, press ok to restart", &deathNoticeListener); + //remove_node(char_info->id); + being->action = DEAD; } break; // Stop walking diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 27d4498d..3fe9526b 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -84,7 +84,7 @@ void BuySellListener::action(const std::string& eventId) } -char hairtable[14][4][2] = { +char hairtable[16][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 @@ -99,7 +99,9 @@ char hairtable[14][4][2] = { { { 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 + { { 0, 4}, {-1, 6}, {-1, 6}, {0, 6} }, // SIT + { { 0, 0}, {0, 0}, {0, 0}, {0, 0} }, // ?? HIT + { { 0, 16}, {-1, 6}, {-1, 6}, {0, 6} } // DEAD }; int get_x_offset(Being *being) { @@ -295,7 +297,7 @@ void GraphicEngine::refresh() { int hf = being->hair_color - 1 + 10 * (dir + 4 * (being->hair_style - 1)); - if (being->action == SIT) being->frame = 0; + if (being->action == SIT || being->action == DEAD) being->frame = 0; if (being->action == ATTACK) { int pf = being->frame + being->action + 4 * being->weapon; @@ -323,7 +325,8 @@ void GraphicEngine::refresh() { being->emotion = 0; } } - if (being->action != STAND && being->action != SIT) { + if (being->action != STAND && being->action != SIT + && being->action != DEAD) { being->frame = (get_elapsed_time(being->tick_time) * 4) / (being->speed); |