summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ManaWorld.vcproj6
-rw-r--r--src/game.cpp21
-rw-r--r--src/graphic/graphic.cpp60
-rw-r--r--src/gui/gui.cpp6
-rw-r--r--src/gui/stats.h4
-rw-r--r--src/net/protocol.cpp2
-rw-r--r--tmw.ini6
7 files changed, 79 insertions, 26 deletions
diff --git a/ManaWorld.vcproj b/ManaWorld.vcproj
index a4b988aa..852ce215 100644
--- a/ManaWorld.vcproj
+++ b/ManaWorld.vcproj
@@ -280,6 +280,12 @@
<File
RelativePath=".\src\gui\skill.h">
</File>
+ <File
+ RelativePath=".\src\gui\stats.cpp">
+ </File>
+ <File
+ RelativePath=".\src\gui\stats.h">
+ </File>
</Filter>
<Filter
Name="sound"
diff --git a/src/game.cpp b/src/game.cpp
index 5b776845..3dbd599f 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -298,8 +298,9 @@ int get_packet_length(short id) {
void do_parse() {
unsigned short id;
char *temp;
- //char direction;
+ char direction;
NODE *node = NULL;
+ PATH_NODE *pn;
int len;
// We need at least 2 bytes to identify a packet
@@ -422,8 +423,22 @@ void do_parse() {
add_node(node);
}
node->path = calculate_path(get_src_x(RFIFOP(50)),get_src_y(RFIFOP(50)),get_dest_x(RFIFOP(50)),get_dest_y(RFIFOP(50)));
- if(node->path!=NULL) {
- set_coordinates(node->coordinates, node->path->x, node->path->y, 0);
+ if(node->path!=NULL) {
+ direction = 0;
+ if(node->path->next) {
+ if(node->path->next->x>node->path->x && node->path->next->y>node->path->y)direction = SE;
+ else if(node->path->next->x<node->path->x && node->path->next->y>node->path->y)direction = SW;
+ else if(node->path->next->x>node->path->x && node->path->next->y<node->path->y)direction = NE;
+ else if(node->path->next->x<node->path->x && node->path->next->y<node->path->y)direction = NW;
+ else if(node->path->next->x>node->path->x)direction = EAST;
+ else if(node->path->next->x<node->path->x)direction = WEST;
+ else if(node->path->next->y>node->path->y)direction = SOUTH;
+ else if(node->path->next->y<node->path->y)direction = NORTH;
+ }
+ pn = node->path;
+ node->path = node->path->next;
+ free(pn);
+ set_coordinates(node->coordinates, node->path->x, node->path->y, direction);
node->action = WALK;
node->tick_time = tick_time;
}
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 48d1b5c7..9946b613 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -65,24 +65,24 @@ DIALOG buy_sell_dialog[] = {
DIALOG buy_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
- { tmw_dialog_proc, 300, 200, 260, 175, 0, 0, 0, 0, 0, 0, (char *)"Buy", NULL, NULL },
- { tmw_button_proc, 450, 326+25, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL },
- { tmw_button_proc, 508, 326+25, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL },
+ { tmw_dialog_proc, 300, 200, 260, 200, 0, 0, 0, 0, 0, 0, (char *)"Buy", NULL, NULL },
+ { tmw_button_proc, 450, 376, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL },
+ { tmw_button_proc, 508, 376, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL },
{ tmw_list_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, (char *)shop_list, NULL, NULL },
- { tmw_text_proc, 304, 326+25, 180, 100, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
+ { tmw_text_proc, 304, 326+25, 50, 20, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ tmw_slider_proc, 304, 326, 200, 20, 255, 0, 0, 0, 10, 0, NULL, (void *)changeQ, NULL },
- { tmw_text_proc, 514, 326, 40, 100, 0, 0, 0, 0, 0, 0, (char *)itemCurrenyQ, NULL, NULL },
+ { tmw_text_proc, 514, 326, 40, 20, 0, 0, 0, 0, 0, 0, (char *)itemCurrenyQ, NULL, NULL },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};
DIALOG sell_dialog[] = {
/* (dialog proc) (x) (y) (w) (h) (fg) (bg) (key) (flags) (d1) (d2) (dp) (dp2) (dp3) */
- { tmw_dialog_proc, 300, 200, 260, 175, 0, 0, 0, 0, 0, 0, (char *)"Sell", NULL, NULL },
- { tmw_button_proc, 450, 326+25, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL },
- { tmw_button_proc, 508, 326+25, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL },
+ { tmw_dialog_proc, 300, 200, 260, 200, 0, 0, 0, 0, 0, 0, (char *)"Sell", NULL, NULL },
+ { tmw_button_proc, 450, 376, 50, 20, 255, 0, 'o', D_EXIT, 0, 0, (char *)"&Ok", NULL, NULL },
+ { tmw_button_proc, 508, 376, 50, 20, 255, 0, 'c', D_EXIT, 0, 0, (char *)"&Cancel", NULL, NULL },
{ tmw_slider_proc, 304, 326, 200, 20, 255, 0, 0, 0, 10, 0, NULL, (void *)changeQ, NULL },
{ tmw_list_proc, 304, 224, 252, 100, 0, 0, 0, 0, 0, 0, (char *)shop_list, NULL, NULL },
- { tmw_text_proc, 514, 326, 40, 100, 0, 0, 0, 0, 0, 0, (char *)itemCurrenyQ, NULL, NULL },
+ { tmw_text_proc, 514, 326, 40, 20, 0, 0, 0, 0, 0, 0, (char *)itemCurrenyQ, NULL, NULL },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};
@@ -96,11 +96,11 @@ int get_x_offset(NODE *node) {
int offset = 0;
char direction = get_direction(node->coordinates);
if(node->action==WALK) {
- if(direction==WEST || direction==EAST) {
+ if(direction!=NORTH && direction!=SOUTH) {
offset = node->frame + 1;
if(offset==5)offset = 0;
offset *= 4;
- if(direction==WEST) {
+ if(direction==WEST || direction==NW || direction==SW) {
offset = -offset;
offset += 16;
} else offset -= 16;
@@ -113,11 +113,11 @@ int get_y_offset(NODE *node) {
int offset = 0;
char direction = get_direction(node->coordinates);
if(node->action==WALK) {
- if(direction==SOUTH || direction==NORTH) {
+ if(direction!=EAST && direction!=WEST) {
offset = node->frame + 1;
if(offset==5)offset = 0;
offset *= 4;
- if(direction==NORTH) {
+ if(direction==NORTH || direction==NW || direction==NE) {
offset = -offset;
offset += 16;
} else offset -= 16;
@@ -206,19 +206,42 @@ void do_graphic(void) {
//rectfill(buffer, (get_x(node->coordinates)-map_x)*16-player_x-get_x_offset(node->frame, get_direction(node->coordinates)), (get_y(node->coordinates)-map_y)*16-player_y-get_y_offset(node->frame, get_direction(node->coordinates)), (get_x(node->coordinates)-map_x)*16-player_x-get_x_offset(node->frame, get_direction(node->coordinates))+16, (get_y(node->coordinates)-map_y)*16-player_y-get_y_offset(node->frame, get_direction(node->coordinates))+16, makecol(0,0,255));
} else { // Draw a monster
+ //node->speed = 10000;
+
+ //set_coordinates(node->coordinates, get_x(node->coordinates), get_y(node->coordinates), direction);*/
+
node->text_x = (get_x(node->coordinates)-camera_x)*16-20+get_x_offset(node)-offset_x;
node->text_y = (get_y(node->coordinates)-camera_y)*16-25+get_y_offset(node)-offset_y;
+ int r_x = node->text_x-get_x_offset(node);
+ int r_y = node->text_y-get_y_offset(node);
+
if(node->action==MONSTER_DEAD)node->frame = 0;
masked_blit((BITMAP *)graphic[MOBSET_BMP].dat, buffer, (get_direction(node->coordinates)/2)*60+240*(node->job-1002), 60*(node->frame+node->action), node->text_x, node->text_y, 60, 60);
+ //rectfill(buffer, r_x, r_y, r_x+16, r_y+16, makecol(0,0,255));
+ //alfont_textprintf(buffer, gui_font, node->text_x, node->text_y, MAKECOL_WHITE, "%i", node->frame);
+
if(node->action!=STAND) {
node->frame = (get_elapsed_time(node->tick_time)*4)/(node->speed);
if(node->frame>=4) {
if(node->action!=MONSTER_DEAD) {
- if(node->path && node->action!=MONSTER_DEAD) {
+ if(node->path->next && node->action!=MONSTER_DEAD) {
PATH_NODE *old = node->path;
- set_coordinates(node->coordinates, node->path->x, node->path->y, 0);
- node->path = node->path->next;
+ node->path = node->path->next;
+ direction = 0;
+ //if(node->path->next) {
+ if(node->path->x>old->x && node->path->y>old->y)direction = SE;
+ else if(node->path->x<old->x && node->path->y>old->y)direction = SW;
+ else if(node->path->x>old->x && node->path->y<old->y)direction = NE;
+ else if(node->path->x<old->x && node->path->y<old->y)direction = NW;
+ else if(node->path->x>old->x)direction = EAST;
+ else if(node->path->x<old->x)direction = WEST;
+ else if(node->path->y>old->y)direction = SOUTH;
+ else if(node->path->y<old->y)direction = NORTH;
+ //}
+
+ set_coordinates(node->coordinates, node->path->x, node->path->y, direction);
+
if(old!=NULL)
free(old);
} else node->action = STAND;
@@ -290,7 +313,9 @@ void do_graphic(void) {
char money[20];
sprintf(money, "%i gp", char_info->zeny);
buy_dialog[4].dp = &money;
- buy_dialog[5].d1 = (int)(char_info->zeny/get_item_price(buy_dialog[6].d1));
+ buy_dialog[5].d1 = (int)(char_info->zeny/get_item_price(buy_dialog[3].d1));
+ if(buy_dialog[5].d2>buy_dialog[5].d1)
+ //alfont_textprintf(double_buffer, gui_font, 0, 10, MAKECOL_WHITE, "%i", buy_dialog[5].d1);
dialog_message(buy_dialog, MSG_DRAW, 0, 0);
if(!gui_update(buy_player)) {
show_npc_dialog = shutdown_dialog(buy_player);
@@ -313,6 +338,7 @@ void do_graphic(void) {
sell_dialog[3].d2 = sell_dialog[3].d1;
sprintf((char *)sell_dialog[5].dp, "%i %i", sell_dialog[3].d1, sell_dialog[3].d2);
}*/
+ alfont_textprintf(double_buffer, gui_font, 0, 10, MAKECOL_WHITE, "%i", sell_dialog[3].d1);
dialog_message(sell_dialog, MSG_DRAW, 0, 0);
if(!gui_update(sell_player)) {
show_npc_dialog = shutdown_dialog(sell_player);
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 10021020..18dcfb41 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -582,8 +582,10 @@ int tmw_slider_proc(int msg, DIALOG *d, int c) {
}
//textprintf(gui_bitmap, gui_font,10, 10, makecol(255,255,255), "%i", d->d2);
} else {
- ret = d_slider_proc(msg,d,c);
- }
+ if(d->d1==0)d->d1 = 1;
+ ret = d_slider_proc(msg,d,c);
+ }
+
if (watchdog == 1) {
d->dp2 = (void*)gui__external_slider_callback;
}
diff --git a/src/gui/stats.h b/src/gui/stats.h
index a34dd1cc..4cb29642 100644
--- a/src/gui/stats.h
+++ b/src/gui/stats.h
@@ -21,6 +21,10 @@
*/
+#ifdef WIN32
+#pragma warning(disable:4312)
+#endif
+
#ifndef _STATS_H
#define _STATS_H
diff --git a/src/net/protocol.cpp b/src/net/protocol.cpp
index d2b1ceb7..39d4ce91 100644
--- a/src/net/protocol.cpp
+++ b/src/net/protocol.cpp
@@ -188,7 +188,7 @@ void map_start() {
y = get_y(RFIFOP(6));
log_int("Player", "x", x);
log_int("Player", "y", y);
- direction = get_direction(RFIFOP(6));
+ //direction = get_direction(RFIFOP(6));
log_int("Player", "direction", direction);
RFIFOSKIP(11);
} else if(0x0081) {
diff --git a/tmw.ini b/tmw.ini
index 8dcd01dd..6eb92a80 100644
--- a/tmw.ini
+++ b/tmw.ini
@@ -4,8 +4,8 @@ keyboard = en
language =
[server]
-host = animesites.de
-;host = themanaworld.homeip.net
+;host = animesites.de
+host = themanaworld.homeip.net
;host = localhost
;host = telekommunisten.dyndns.org
port = 6901
@@ -29,4 +29,4 @@ stretch = 1
[login]
remember = 1
-username = kth5
+username = elven