diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 13 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 6 | ||||
-rw-r--r-- | src/graphic/graphic.h | 1 | ||||
-rw-r--r-- | src/gui/char_select.cpp | 6 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 2 | ||||
-rw-r--r-- | src/gui/inventory.cpp | 1 | ||||
-rw-r--r-- | src/gui/inventory.h | 5 | ||||
-rw-r--r-- | src/gui/login.cpp | 4 | ||||
-rw-r--r-- | src/gui/shop.cpp | 24 | ||||
-rw-r--r-- | src/gui/shop.h | 5 | ||||
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/main.h | 1 |
12 files changed, 51 insertions, 18 deletions
diff --git a/src/game.cpp b/src/game.cpp index 2cda6426..52f8e5c4 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -410,6 +410,7 @@ void do_parse() { break; // Monster moving case 0x007b: + case 0x01da: node = find_node(RFIFOL(2)); if(node==NULL) { node = create_node(); @@ -428,7 +429,7 @@ void do_parse() { } break; // Being moving - case 0x01da: + /*case 0x01da: node = find_node(RFIFOL(2)); if(node==NULL) { node = create_node(); @@ -448,7 +449,7 @@ void do_parse() { if(node->action==WALK)node->tick_time = tick_time; set_coordinates(node->coordinates, get_dest_x(RFIFOP(50)), get_dest_y(RFIFOP(50)), direction); } - break; + break;*/ // NPC dialog case 0x00b4: if(!strstr(npc_text, RFIFOP(8))) { @@ -659,14 +660,14 @@ void do_parse() { n_items = (len-4)/11; show_npc_dialog = 3; for(int k=0;k<n_items;k++) - add_item(RFIFOW(4+11*k+9), RFIFOL(4+11*k)); + add_buy_item(RFIFOW(4+11*k+9), RFIFOL(4+11*k)); break; // Sell dialog case 0x00c7: n_items = (len-4)/10; show_npc_dialog = 4; for(int k=0;k<n_items;k++) - add_item(RFIFOW(4+10*k), RFIFOL(4+10*k+2)); + add_sell_item(RFIFOW(4+10*k), RFIFOL(4+10*k+2)); break; // Answer to buy case 0x00ca: @@ -686,6 +687,10 @@ void do_parse() { case 0x00a0: inventory.add_item(RFIFOW(2), RFIFOW(6), RFIFOW(4)); break; + case 0x0119: + sprintf(pkt_nfo, "%i %i %i %i", RFIFOL(2), RFIFOW(6), RFIFOW(8), RFIFOW(10)); + alert(pkt_nfo,"","","","",0,0); + break; // Manage non implemented packets default: //alert(pkt_nfo,"","","","",0,0); diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 1631ef10..1640d7af 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -130,7 +130,7 @@ int get_y_offset(NODE *node) { } void init_graphic() { - tileset = load_datafile("./data/graphic/village.dat"); + tileset = load_datafile("./data/graphic/desert.dat"); if(!tileset)error("Unable to load tileset datafile"); //if(!(gfx_capabilities & GFX_HW_VRAM_BLIT))allegro_message("Not supporting HW accelerated blit"); buffer = create_bitmap(SCREEN_W/2, SCREEN_H/2); @@ -206,12 +206,12 @@ void do_graphic(void) { } else if(node->job==45) { // Draw a warp //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->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; if(node->action==MONSTER_DEAD)node->frame = 0; - masked_blit((BITMAP *)graphic[MOBSET_BMP].dat, buffer, (get_direction(node->coordinates)/2)*60, 60*(node->frame+node->action), node->text_x, node->text_y, 60, 60); + 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); if(node->action!=STAND) { node->frame = (get_elapsed_time(node->tick_time)*4)/(node->speed); if(node->frame>=4) { diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index 3622a665..95f2ae8a 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -42,6 +42,7 @@ extern bool show_skill_dialog; extern int show_npc_dialog; extern TmwInventory inventory; extern int map_x, map_y, camera_x, camera_y; +extern TmwInventory inventory; void do_graphic(void); void init_graphic(void); diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 6aa8c176..056cd724 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -19,6 +19,8 @@ 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" @@ -73,7 +75,7 @@ void char_select() { int gui_exit = 1; while ((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) { clear_bitmap(buffer); - if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 80, 60, 640, 480); + if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600); else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480); gui_exit = gui_update(player); blit(buffer, screen, 0, 0, 0, 0, 800, 600); @@ -161,7 +163,7 @@ void server_char_delete() { int gui_exit = 1; while ((!key[KEY_ESC])&&(gui_exit)) { clear_bitmap(buffer); - if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 80, 60, 640, 480); + if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600); else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480); gui_exit = gui_update(player); blit(buffer, screen, 0, 0, 0, 0, 800, 600); diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 752604f1..1d28bad7 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -55,7 +55,7 @@ void char_server() { if(n_server==0)char_server_dialog[2].flags |= D_DISABLED; while ((!key[KEY_ESC])&&(gui_exit)&&(!key[KEY_ENTER])) { clear_bitmap(buffer); - if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 80, 60, 640, 480); + if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600); else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480); gui_exit = gui_update(player); blit(buffer, screen, 0, 0, 0, 0, 800, 600); diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 6b806f1d..2bf7474a 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -106,6 +106,5 @@ int TmwInventory::use_item(int index, int id) { // Note: id is dest of item, usually player_node->account_ID WFIFOSET(8); while((out_size>0))flush(); - return 0; } diff --git a/src/gui/inventory.h b/src/gui/inventory.h index 653d99db..ee16d56b 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -45,7 +45,7 @@ struct itemHolder { // the holder of a item //int index; // item position }; -class TmwInventory{ +class TmwInventory { public: TmwInventory() {}; ~TmwInventory() {}; @@ -61,8 +61,9 @@ class TmwInventory{ int increase_quantity(int index, int quantity); // increase quantity of a item int use_item(int index, int id); //END API - private: + itemHolder items[INVENTORY_SIZE]; // this is the holder of items + private: DATAFILE *itemset; bool show_inventory; }; diff --git a/src/gui/login.cpp b/src/gui/login.cpp index b27a0dab..a4fa3592 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -19,6 +19,8 @@ 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 "login.h" @@ -49,7 +51,7 @@ DIALOG login_dialog[] = { int gui_exit = 1; while ((!key[KEY_ESC])&&(gui_exit)&&(state!=EXIT)&&(!key[KEY_ENTER])) { clear_bitmap(buffer); - if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 80, 60, 640, 480); + if(stretch_mode!=0)blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, 0, 0, 800, 600); else blit((BITMAP *)graphic[LOGIN_BMP].dat, buffer, 0, 0, -120, -90, 640, 480); gui_exit = gui_update(player); diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 530df8f4..3065f8ea 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -25,8 +25,6 @@ #include "shop.h" -#include <allegro.h> - int n_items; ITEM_SHOP *shop = NULL; @@ -50,7 +48,27 @@ char *shop_list(int index, int *list_size) { } } -void add_item(short id, int price) { +void add_buy_item(short id, int price) { + ITEM_SHOP *item_shop = (ITEM_SHOP *)malloc(sizeof(ITEM_SHOP)); + if(id-501>=0 && id-501<=2) + sprintf(item_shop->name, "%s %i gp", item_db[id-501], price); + else + sprintf(item_shop->name, "Unknown item %i gp", price); + item_shop->price = price; + item_shop->id = id; + item_shop->next = NULL; + if(shop==NULL) + shop = item_shop; + else { + ITEM_SHOP *temp = shop; + while(temp->next) + temp = temp->next; + temp->next = item_shop; + } +} + +void add_sell_item(short index, int price) { + int id = inventory.items[index].id; ITEM_SHOP *item_shop = (ITEM_SHOP *)malloc(sizeof(ITEM_SHOP)); if(id-501>=0 && id-501<=2) sprintf(item_shop->name, "%s %i gp", item_db[id-501], price); diff --git a/src/gui/shop.h b/src/gui/shop.h index b8051536..5aa8548a 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -29,6 +29,8 @@ #include <stdlib.h> #include <stdio.h> +#include "../graphic/graphic.h" + struct ITEM_SHOP { char name[30]; int price; @@ -39,7 +41,8 @@ struct ITEM_SHOP { extern int n_items; char *shop_list(int index, int *list_size); -void add_item(short id, int price); +void add_buy_item(short id, int price); +void add_sell_item(short index, int price); void close_shop(); short get_item_id(int index); diff --git a/src/main.cpp b/src/main.cpp index 5fd3386c..6d3cfbf3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -68,6 +68,7 @@ void init_engine() { Init_SuperEagle(16); #endif stretch_mode = get_config_int("settings", "stretch", 0); + set_window_title("The Mana World"); if(stretch_mode==0) { if(set_gfx_mode(get_config_int("settings", "screen", 0), 400, 300, 0, 0)) error(allegro_error); @@ -40,6 +40,7 @@ #include "./gui/stats.h" #include "./gui/char_server.h" #include "./gui/char_select.h" +#include "./gui/inventory.h" #include "./graphic/super_eagle.h" #include "../data/graphic/gfx_data.h" |