summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.cpp33
-rw-r--r--src/gui/inventory.cpp5
-rw-r--r--src/gui/inventory.h11
-rw-r--r--src/gui/shop.cpp5
-rw-r--r--tmw.ini2
5 files changed, 31 insertions, 25 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 969c83c5..0003170b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -457,16 +457,17 @@ void do_parse() {
show_npc_dialog = 1;
}
break;
- case 0x01ee: //Get the items
- for(int loop = 0; loop < RFIFOW(4); loop++)
- inventory.addItem(loop,RFIFOW(10+18*loop));
- break;
- case 0x00a8: // could I use the item?
- // index RFIFOW(2)
- // succes or not RFIFOB(6);
- if(RFIFOB(6))
- inventory.addItem(RFIFOW(2),RFIFOW(4));
- break;
+ //Get the items
+ case 0x01ee:
+ for(int loop=0;loop<(RFIFOW(2)-4)/18;loop++)
+ inventory.addItem(RFIFOW(4+loop*18+2), RFIFOW(4+loop*18+6));
+ break;
+ case 0x00a8: // could I use the item?
+ // index RFIFOW(2)
+ // succes or not RFIFOB(6);
+ if(RFIFOB(6))
+ inventory.addItem(RFIFOW(2),RFIFOW(4));
+ break;
// Warp
case 0x0091:
memset(map_path, '\0', 480);
@@ -594,9 +595,6 @@ void do_parse() {
break;
// Status change
case 0x00b1:
- /*char sto[40];
- sprintf(sto, "%i %i", RFIFOW(2), RFIFOL(4));
- alert(sto,"","","","",0,0);*/
switch(RFIFOW(2)) {
case 1:
char_info->xp = RFIFOL(4);
@@ -671,19 +669,20 @@ void do_parse() {
// Answer to buy
case 0x00ca:
if(RFIFOB(2)==0)
- ok("Transaction", "Thanks for buying");
+ chatlog.chat_log("Thanks for buying", BY_SERVER, gui_font);
else
- ok("Transaction", "Unable to buy");
+ chatlog.chat_log("Unable to buy", BY_SERVER, gui_font);
break;
// Answer to sell
case 0x00cb:
if(RFIFOB(2)==0)
- ok("Transaction", "Thanks for selling");
+ chatlog.chat_log("Thanks for selling", BY_SERVER, gui_font);
else
- ok("Transaction", "Unable to sell");
+ chatlog.chat_log("Unable to sell", BY_SERVER, gui_font);
break;
// Add item to inventory
case 0x00a0:
+ inventory.addItem(RFIFOW(6), RFIFOW(4));
break;
// Manage non implemented packets
default:
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index 8d001880..cc330895 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -159,7 +159,10 @@ void TmwInventory::draw(BITMAP * buffer) {
ypos = inventory_dialog[0].y;
if(items[itemX][itemY].flag) //draw the item
- masked_blit((BITMAP *)itemset[items[itemX][itemY].itemIDNum].dat, buffer, 0, 0, (xpos+items[itemX][itemY].xpos), (ypos+items[itemX][itemY].ypos), 32, 32);
+ if(items[itemX][itemY].itemIDNum>=501 && items[itemX][itemY].itemIDNum<=510)
+ masked_blit((BITMAP *)itemset[items[itemX][itemY].itemIDNum-501].dat, buffer, 0, 0, (xpos+items[itemX][itemY].xpos), (ypos+items[itemX][itemY].ypos), 32, 32);
+ else
+ masked_blit((BITMAP *)itemset[0].dat, buffer, 0, 0, (xpos+items[itemX][itemY].xpos), (ypos+items[itemX][itemY].ypos), 32, 32);
//the number of that item
if(!bigwindow)
diff --git a/src/gui/inventory.h b/src/gui/inventory.h
index 82a98497..e88094ed 100644
--- a/src/gui/inventory.h
+++ b/src/gui/inventory.h
@@ -29,10 +29,11 @@
#ifndef _INVENTORY_H
#define _INVENTORY_H
+
#include <allegro.h>
-#ifdef WIN32
+/*#ifdef WIN32
#include <winalleg.h>
-#endif
+#endif*/
#include "../main.h"
#include "../game.h"
#include "../log.h"
@@ -43,7 +44,7 @@ struct itemHolder { // the holder of a item
int flag; // don't really know why I use this :)
int itemIDNum; // the id of the item
int num; // number of items
- int xpos,ypos; // where am I?
+ int xpos, ypos; // where am I?
};
@@ -55,12 +56,12 @@ class TmwInventory{
void create(int tempxpos, int tempypos); // create the window
void draw(BITMAP *); // draw the window (if areDisplaying != 0 )
- void show(int val); // choose between the show and don't show the window
+ void show(int val); // choose between showing and not showing the window
void toggle() { if(areDisplaying){show(0);}else{show(1);} }
//API
int addItem(int idnum, int antal); //add a item
int rmItem(int idnum); //remove a item
- int changeNum(int idnum, int antal); // change nummber of a item
+ int changeNum(int idnum, int antal); // change number of a item
int useItem(int idnum);
//END API
private:
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 84fe279e..530df8f4 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -30,7 +30,10 @@
int n_items;
ITEM_SHOP *shop = NULL;
-char *item_db[] = { "Candy", "Medical Herb", "Chocolate" };
+char *item_db[] = {
+ "Candy", "Medical Herb", "Chocolate", "Royal Jam", "Faerie Walnut",
+ "Cup of wishes", "Magic rope", "Midge mallet", "Flammie drum", "Moogle belt"
+};
char *shop_list(int index, int *list_size) {
if(index<0) {
diff --git a/tmw.ini b/tmw.ini
index 705ce2e2..43ef5f29 100644
--- a/tmw.ini
+++ b/tmw.ini
@@ -29,4 +29,4 @@ stretch = 1
[login]
remember = 1
-username = kth5
+username = elven