summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/button.cpp2
-rw-r--r--src/gui/buy.h1
-rw-r--r--src/gui/buysell.h1
-rw-r--r--src/gui/char_select.cpp3
-rw-r--r--src/gui/char_server.cpp3
-rw-r--r--src/gui/chat.h166
-rw-r--r--src/gui/checkbox.cpp2
-rw-r--r--src/gui/gui.cpp27
-rw-r--r--src/gui/gui.h17
-rw-r--r--src/gui/inventory.cpp4
-rw-r--r--src/gui/inventory.h3
-rw-r--r--src/gui/login.cpp3
-rw-r--r--src/gui/playerbox.cpp6
-rw-r--r--src/gui/progressbar.cpp48
-rw-r--r--src/gui/radiobutton.cpp2
-rw-r--r--src/gui/scrollarea.cpp6
-rw-r--r--src/gui/sell.h1
-rw-r--r--src/gui/setup.cpp1
-rw-r--r--src/gui/shop.cpp90
-rw-r--r--src/gui/shop.h25
-rw-r--r--src/gui/slider.cpp8
-rw-r--r--src/gui/stats.cpp5
-rw-r--r--src/gui/stats.h10
-rw-r--r--src/gui/status.cpp1
-rw-r--r--src/gui/status.h6
-rw-r--r--src/gui/textfield.cpp2
-rw-r--r--src/gui/window.cpp33
27 files changed, 178 insertions, 298 deletions
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index 3d7b3b18..3576b1d0 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -48,7 +48,7 @@ void Button::draw(gcn::Graphics* graphics) {
int x, y;
getAbsolutePosition(x, y);
- draw_skinned_rect(gui_bitmap, &gui_skin.button.background[mode],
+ draw_skinned_rect(buffer, &gui_skin.button.background[mode],
x, y, getWidth(), getHeight());
graphics->setColor(getForegroundColor());
diff --git a/src/gui/buy.h b/src/gui/buy.h
index 7a6bd484..b6265c6e 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -24,7 +24,6 @@
#ifndef _TMW_BUY_H
#define _TMW_BUY_H
-#include "gui.h"
#include "window.h"
#include "shop.h"
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index 02ddb816..2d1d3c29 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -24,7 +24,6 @@
#ifndef _TMW_BUYSELL_H
#define _TMW_BUYSELL_H
-#include "gui.h"
#include "window.h"
/**
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 87a30000..ac644f3a 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -439,7 +439,8 @@ void charSelect()
// Draw background
login_wallpaper->draw(buffer, 0, 0);
- gui->update();
+ gui->logic();
+ gui->draw();
// Draw to screen
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 3b9d03c8..4178a8e5 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -118,7 +118,8 @@ void char_server() {
showServerList = 1;
while (showServerList) {
login_wallpaper->draw(buffer, 0, 0);
- gui->update();
+ gui->logic();
+ gui->draw();
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 4c4bb933..424a0d0b 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -24,121 +24,117 @@
#ifndef _TMW_CHAT_H
#define _TMW_CHAT_H
-#include "../main.h"
+#include "../net/network.h"
+#include <allegro.h>
#include <list>
#include <string>
#include <fstream>
-#define BY_GM 0 // those should be self-explanatory =)
-#define BY_PLAYER 1
-#define BY_OTHER 2
-#define BY_SERVER 3
+#define BY_GM 0 // those should be self-explanatory =)
+#define BY_PLAYER 1
+#define BY_OTHER 2
+#define BY_SERVER 3
-#define ACT_WHISPER 4 // getting whispered at
-#define ACT_IS 5 // equivalent to "/me" in irc
+#define ACT_WHISPER 4 // getting whispered at
+#define ACT_IS 5 // equivalent to "/me" in irc
-#define IS_ANNOUNCE "/announce "
-#define IS_ANNOUNCE_LENGTH 10
+#define IS_ANNOUNCE "/announce "
+#define IS_ANNOUNCE_LENGTH 10
#define IS_WHERE "/where "
#define IS_WHERE_LENGTH 7
/**
- gets in between usernick and message text depending on
- message type
-*/
-#define CAT_NORMAL ": "
-#define CAT_IS ""
-#define CAT_WHISPER " says: "
+ * gets in between usernick and message text depending on
+ * message type
+ */
+#define CAT_NORMAL ": "
+#define CAT_IS ""
+#define CAT_WHISPER " says: "
/** some generic color macros */
-#define COLOR_WHITE (makecol(255,255,255)) // plain white
-#define COLOR_BLUE (makecol( 97,156,236)) // cold gm blue :P
-#define COLOR_YELLOW (makecol(255,246, 98)) // sexy yellow
-#define COLOR_GREEN (makecol( 39,197, 39)) // cool green
-#define COLOR_RED (makecol(255, 0, 0)) // ack red XD
-#define COLOR_LIGHTBLUE (makecol( 83,223,246)) // bright blue
+#define COLOR_WHITE (makecol(255,255,255)) // plain white
+#define COLOR_BLUE (makecol( 97,156,236)) // cold gm blue :P
+#define COLOR_YELLOW (makecol(255,246, 98)) // sexy yellow
+#define COLOR_GREEN (makecol( 39,197, 39)) // cool green
+#define COLOR_RED (makecol(255, 0, 0)) // ack red XD
+#define COLOR_LIGHTBLUE (makecol( 83,223,246)) // bright blue
/** calculate text-width in pixel */
#define TEXT_GETWIDTH(str) (text_length(font, str))
#define TEXT_OUT(bmp, col, str) (textprintf_ex(bmp, font, 1, y, col, str, 1))
/** job dependend identifiers (?) */
-#define SKILL_BASIC 0x0001
-#define SKILL_WARP 0x001b
-#define SKILL_STEAL 0x0032
-#define SKILL_ENVENOM 0x0034
+#define SKILL_BASIC 0x0001
+#define SKILL_WARP 0x001b
+#define SKILL_STEAL 0x0032
+#define SKILL_ENVENOM 0x0034
/** basic skills identifiers */
-#define BSKILL_TRADE 0x0000
-#define BSKILL_EMOTE 0x0001
-#define BSKILL_SIT 0x0002
-#define BSKILL_CREATECHAT 0x0003
-#define BSKILL_JOINPARTY 0x0004
-#define BSKILL_SHOUT 0x0005
-#define BSKILL_PK 0x0006 // ??
-#define BSKILL_SETALLIGN 0x0007 // ??
+#define BSKILL_TRADE 0x0000
+#define BSKILL_EMOTE 0x0001
+#define BSKILL_SIT 0x0002
+#define BSKILL_CREATECHAT 0x0003
+#define BSKILL_JOINPARTY 0x0004
+#define BSKILL_SHOUT 0x0005
+#define BSKILL_PK 0x0006 // ??
+#define BSKILL_SETALLIGN 0x0007 // ??
/** reasons why action failed */
-#define RFAIL_SKILLDEP 0x00
-#define RFAIL_INSUFHP 0x01
-#define RFAIL_INSUFSP 0x02
-#define RFAIL_NOMEMO 0x03
-#define RFAIL_SKILLDELAY 0x04
-#define RFAIL_ZENY 0x05
-#define RFAIL_WEAPON 0x06
-#define RFAIL_REDGEM 0x07
-#define RFAIL_BLUEGEM 0x08
-#define RFAIL_OVERWEIGHT 0x09
-#define RFAIL_GENERIC 0x0a
+#define RFAIL_SKILLDEP 0x00
+#define RFAIL_INSUFHP 0x01
+#define RFAIL_INSUFSP 0x02
+#define RFAIL_NOMEMO 0x03
+#define RFAIL_SKILLDELAY 0x04
+#define RFAIL_ZENY 0x05
+#define RFAIL_WEAPON 0x06
+#define RFAIL_REDGEM 0x07
+#define RFAIL_BLUEGEM 0x08
+#define RFAIL_OVERWEIGHT 0x09
+#define RFAIL_GENERIC 0x0a
/** should always be zero if failed */
-#define SKILL_FAILED 0x00
+#define SKILL_FAILED 0x00
struct CHATSKILL {
- short skill;
- short bskill;
- short unused;
- char success;
- char reason;
+ short skill;
+ short bskill;
+ short unused;
+ char success;
+ char reason;
};
/**
- Simple ChatLog Object v0.5 (i'd say...)
-
- Bestviewd w/ Bitstream Vera Sans Mono @ 9pt and a tab-width of 2 spaces
-
- Author: kth5 aka Alexander Baldeck
- pipe your questions, suggestions and flames to: kth5@gawab.com
-*/
+ * Simple chatlog object.
+ */
class Chat {
- public :
- Chat(const char *, int);
- void chat_dlgrsize(int);
-
- void chat_log(std::string, int, FONT *);
- void chat_log(CHATSKILL, FONT *);
-
- void chat_draw(BITMAP *, int, FONT *);
- char * chat_send(std::string, std::string);
- ~Chat();
- private :
- std::ofstream chatlog_file;
-
- typedef struct CHATLOG { // list item container object
- std::string nick;
- std::string text;
- int own;
- int width;
- };
-
- std::list<CHATLOG> chatlog; // list object ready to accept out CHATLOG struct :)
- std::list<CHATLOG>::iterator iter;
-
- int items;
- int items_keep;
-
- std::string const_msg(CHATSKILL); // contructs action-fail messages
- std::string const_msg(int); // constructs normal messages (not implemented yet)
+ public :
+ Chat(const char *, int);
+ void chat_dlgrsize(int);
+
+ void chat_log(std::string, int, FONT *);
+ void chat_log(CHATSKILL, FONT *);
+
+ void chat_draw(BITMAP *, int, FONT *);
+ char * chat_send(std::string, std::string);
+ ~Chat();
+ private :
+ std::ofstream chatlog_file;
+
+ typedef struct CHATLOG { // list item container object
+ std::string nick;
+ std::string text;
+ int own;
+ int width;
+ };
+
+ std::list<CHATLOG> chatlog; // list object ready to accept out CHATLOG struct :)
+ std::list<CHATLOG>::iterator iter;
+
+ int items;
+ int items_keep;
+
+ std::string const_msg(CHATSKILL); // contructs action-fail messages
+ std::string const_msg(int); // constructs normal messages (not implemented yet)
};
#endif
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp
index 4d348e98..aa6a665a 100644
--- a/src/gui/checkbox.cpp
+++ b/src/gui/checkbox.cpp
@@ -49,5 +49,5 @@ void CheckBox::drawBox(gcn::Graphics* graphics) {
x += 2;
y += 2;
- masked_blit(box, gui_bitmap, 0, 0, x, y, box->w, box->h);
+ masked_blit(box, buffer, 0, 0, x, y, box->w, box->h);
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 14e76efd..eab34a4b 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -45,7 +45,6 @@ static BITMAP *gui__repository[GUI_BMP_COUNT];
// The currently active skin
LexSkin gui_skin;
-BITMAP *gui_bitmap;
DATAFILE *gui_gfx;
@@ -55,11 +54,10 @@ gcn::AllegroGraphics *guiGraphics; // Graphics driver
WindowContainer *guiTop; // The top container
-Gui::Gui(BITMAP *screen)
+Gui::Gui(Graphics *graphics)
{
// Set graphics
- guiGraphics = new gcn::AllegroGraphics();
- guiGraphics->setTarget(screen);
+ guiGraphics = graphics;
// Set input
guiInput = new AllegroInput();
@@ -96,15 +94,6 @@ Gui::~Gui()
delete focusHandler;
}
-void Gui::update()
-{
- logic();
- draw();
-
- // Draw the mouse
- draw_sprite(gui_bitmap, mouse_sprite, mouse_x, mouse_y);
-}
-
void Gui::logic()
{
guiInput->_pollInput();
@@ -190,6 +179,9 @@ void Gui::draw()
guiTop->draw(guiGraphics);
guiGraphics->popClipArea();
+ // Draw the mouse
+ draw_sprite(buffer, mouse_sprite, mouse_x, mouse_y);
+
guiGraphics->_endDraw();
}
@@ -199,12 +191,11 @@ void Gui::focusNone()
}
-void init_gui(BITMAP *bitmap, const char *skin) {
- gui = new Gui(bitmap);
+void init_gui(Graphics *graphics) {
+ gui = new Gui(graphics);
- gui_bitmap = bitmap;
- gui_load_skin(skin);
- show_mouse(NULL);
+ // TODO: Remove Allegro config file usage from GUI look
+ gui_load_skin("data/Skin/aqua.skin");
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 197d0c97..73858be3 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -33,6 +33,7 @@
#include <allegro.h>
#include <string.h>
#include "windowcontainer.h"
+#include "../graphic/graphic.h"
/**
* \defgroup GUI GUI related classes
@@ -49,7 +50,7 @@ class Gui
/**
* Constructor.
*/
- Gui(BITMAP *screen);
+ Gui(Graphics *screen);
/**
* Destructor.
@@ -57,16 +58,10 @@ class Gui
~Gui();
/**
- * Performs GUI logic and drawing.
- */
- void update();
-
- /**
* Focus none of the Widgets in the Gui.
*/
void focusNone();
- private:
/**
* Performs the Gui:s logic by calling all logic functions
* down in the Gui heirarchy. Logic can be just about anything
@@ -79,10 +74,11 @@ class Gui
/**
* Draws the whole Gui by calling draw functions down in the
- * Gui hierarchy.
+ * Gui hierarchy. It also draws the mouse pointer.
*/
void draw();
+ private:
gcn::Gui* gui; /**< The GUI system */
gcn::Input* guiInput; /**< Input driver */
gcn::ImageLoader* imageLoader; /**< For loading images */
@@ -147,21 +143,20 @@ typedef struct {
} LexSkin;
extern LexSkin gui_skin;
-extern BITMAP *gui_bitmap;
extern Gui* gui;
extern WindowContainer* guiTop; // The top container
extern gcn::AllegroGraphics* guiGraphics; // Graphics driver
/** Initialize gui system */
-void init_gui(BITMAP *dest_bitmap, const char *skin);
+void init_gui(Graphics *graphics);
void gui_exit();
int gui_load_skin(const char* skinname);
void gui_shutdown(void);
/** Helper procedure to draw skinned rectangles */
-void draw_skinned_rect(BITMAP*dst, LexSkinnedRect *skin,
+void draw_skinned_rect(BITMAP *dst, LexSkinnedRect *skin,
int x, int y, int w, int h);
#endif
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index c77dcfdd..dcaedc6f 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -21,6 +21,7 @@
* $Id$
*/
+#include "../graphic/graphic.h"
#include "inventory.h"
#include "../resources/resourcemanager.h"
#include "../resources/image.h"
@@ -54,8 +55,7 @@ void InventoryWindow::draw(gcn::Graphics *graphics)
// Draw window graphics
Window::draw(graphics);
- gcn::AllegroGraphics *alGraphics = (gcn::AllegroGraphics*)graphics;
- BITMAP *target = alGraphics->getTarget();
+ BITMAP *target = ((Graphics*)graphics)->getTarget();
for (int i = 0; i < INVENTORY_SIZE; i++) {
if (items[i].quantity > 0) {
diff --git a/src/gui/inventory.h b/src/gui/inventory.h
index 7e7b7963..cedc1697 100644
--- a/src/gui/inventory.h
+++ b/src/gui/inventory.h
@@ -25,12 +25,9 @@
#define _INVENTORY_H
#include <allegro.h>
-#include "../main.h"
-#include "../game.h"
#include "../log.h"
#include "../net/network.h"
#include "../graphic/spriteset.h"
-#include "gui.h"
#include "window.h"
#define INVENTORY_SIZE 100
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 6db212b2..13a8c2f3 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -132,7 +132,8 @@ void login() {
while (state == LOGIN) {
login_wallpaper->draw(buffer, 0, 0);
- gui->update();
+ gui->logic();
+ gui->draw();
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
if (key[KEY_ESC]) {
state = EXIT;
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 243849e6..67d0e9e3 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -41,12 +41,12 @@ void PlayerBox::draw(gcn::Graphics *graphics)
getAbsolutePosition(x, y);
// Draw character
- playerset->spriteset[0]->draw(gui_bitmap, x - 25, y - 25);
+ playerset->spriteset[0]->draw(buffer, x - 25, y - 25);
// Draw his hair
int hf = hairColor + 40 * (hairStyle);
if (hf >= 0 && hf < (int)hairset->spriteset.size()) {
- hairset->spriteset[hf]->draw(gui_bitmap, x + 37, y + 5);
+ hairset->spriteset[hf]->draw(buffer, x + 37, y + 5);
}
}
}
@@ -61,5 +61,5 @@ void PlayerBox::drawBorder(gcn::Graphics *graphics)
x -= bs;
y -= bs;
- draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, x, y, w, h);
+ draw_skinned_rect(buffer, &gui_skin.textbox.bg, x, y, w, h);
}
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index bfc481cf..55fadd60 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -43,15 +43,15 @@ void ProgressBar::draw(gcn::Graphics *graphics)
// outer bar
int MyColor = makecol(abs(Red-70), abs(Green-70), abs(Blue-70));
- hline(gui_bitmap, absx+X+7, absy+Y, absx+X+Width, MyColor);
- hline(gui_bitmap, absx+X, absy+Y+7, absx+X+Width-7, MyColor);
- line(gui_bitmap, absx+X+7, absy+Y, absx+X, absy+Y+7, MyColor);
- line(gui_bitmap, absx+X+Width, absy+Y, absx+X+Width-7, absy+Y+7, MyColor);
+ hline(buffer, absx+X+7, absy+Y, absx+X+Width, MyColor);
+ hline(buffer, absx+X, absy+Y+7, absx+X+Width-7, MyColor);
+ line(buffer, absx+X+7, absy+Y, absx+X, absy+Y+7, MyColor);
+ line(buffer, absx+X+Width, absy+Y, absx+X+Width-7, absy+Y+7, MyColor);
// Shadow of outer bar
MyColor = makeacol(0, 0, 0, 80);
- hline(gui_bitmap, absx+X+1, absy+Y+7+1, absx+X+Width-7, MyColor);
- line(gui_bitmap, absx+X+Width+1, absy+Y, absx+X+Width-7+1, absy+Y+7, MyColor);
+ hline(buffer, absx+X+1, absy+Y+7+1, absx+X+Width-7, MyColor);
+ line(buffer, absx+X+Width+1, absy+Y, absx+X+Width-7+1, absy+Y+7, MyColor);
// Inner bar
@@ -62,48 +62,48 @@ void ProgressBar::draw(gcn::Graphics *graphics)
for(int i = 1; i < 7; i++)
{
- Temp = absx+X+int(float(Width)*progress)-i-1;
- if ( Temp < (absx+X+8-i) ) Temp = (absx+X+8-i);
- hline(gui_bitmap, absx+X+8-i, absy+Y+i, Temp, MyColor);
+ Temp = absx+X+int(float(Width)*progress)-i-1;
+ if (Temp < (absx + X + 8 - i)) Temp = (absx + X + 8 - i);
+ hline(buffer, absx+X+8-i, absy+Y+i, Temp, MyColor);
}
// Shadow of inner bar
Temp = absx+X+int(float(Width)*progress)-2;
if ( Temp < (absx+X+7+1) ) Temp = absx+X+7;
MyColor = makeacol(abs(Red-40), abs(Green-40), abs(Blue-40), 80);
- hline(gui_bitmap, absx+X+7+1, absy+Y+1, Temp, MyColor);
- line(gui_bitmap, absx+X+7, absy+Y+1, absx+X+2, absy+Y+7-1, MyColor);
+ hline(buffer, absx+X+7+1, absy+Y+1, Temp, MyColor);
+ line(buffer, absx+X+7, absy+Y+1, absx+X+2, absy+Y+7-1, MyColor);
- //rectfill(gui_bitmap, absx+7, absy+7, absx+39, absy+9, MyColor);
+ //rectfill(buffer, absx+7, absy+7, absx+39, absy+9, MyColor);
/*
if (progress != 0) {
- masked_blit(gui_skin.bar.bg.grid[3], gui_bitmap,
- 0, 0, x, y, gui_bitmap->w, gui_bitmap->h);
+ masked_blit(gui_skin.bar.bg.grid[3], buffer,
+ 0, 0, x, y, buffer->w, buffer->h);
}
else {
- masked_blit(gui_skin.bar.bg.grid[0], gui_bitmap,
- 0, 0, x, y, gui_bitmap->w, gui_bitmap->h);
+ masked_blit(gui_skin.bar.bg.grid[0], buffer,
+ 0, 0, x, y, buffer->w, buffer->h);
}
for (int i = 3; i < (w - 3); i++) {
if (i < progress * w - 3) {
- masked_blit(gui_skin.bar.bg.grid[4], gui_bitmap,
- 0, 0, x + 1 * i, y, gui_bitmap->w, gui_bitmap->h);
+ masked_blit(gui_skin.bar.bg.grid[4], buffer,
+ 0, 0, x + 1 * i, y, buffer->w, buffer->h);
}
else {
- masked_blit(gui_skin.bar.bg.grid[1], gui_bitmap,
- 0, 0, x + 1 * i, y, gui_bitmap->w, gui_bitmap->h);
+ masked_blit(gui_skin.bar.bg.grid[1], buffer,
+ 0, 0, x + 1 * i, y, buffer->w, buffer->h);
}
}
if (progress == 1) {
- masked_blit(gui_skin.bar.bg.grid[5], gui_bitmap,
- 0, 0, x + w - 3, y, gui_bitmap->w, gui_bitmap->h);
+ masked_blit(gui_skin.bar.bg.grid[5], buffer,
+ 0, 0, x + w - 3, y, buffer->w, buffer->h);
}
else {
- masked_blit(gui_skin.bar.bg.grid[2], gui_bitmap,
- 0, 0, x + w - 3, y, gui_bitmap->w, gui_bitmap->h);
+ masked_blit(gui_skin.bar.bg.grid[2], buffer,
+ 0, 0, x + w - 3, y, buffer->w, buffer->h);
}*/
}
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index 97c93954..f5bbeca5 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -57,6 +57,6 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
x += 2;
y += 2;
if (box != NULL) {
- box->draw(gui_bitmap, x, y);
+ box->draw(buffer, x, y);
}
}
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index f994ea52..80943ef7 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -104,7 +104,7 @@ void ScrollArea::drawBorder(gcn::Graphics *graphics)
x -= bs;
y -= bs;
- draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, x, y, w, h);
+ draw_skinned_rect(buffer, &gui_skin.textbox.bg, x, y, w, h);
}
void ScrollArea::drawUpButton(gcn::Graphics *graphics)
@@ -133,7 +133,7 @@ void ScrollArea::drawVBar(gcn::Graphics *graphics)
gcn::Rectangle dim = getVerticalBarDimension();
getAbsolutePosition(x, y);
- draw_skinned_rect(gui_bitmap, &gui_skin.listbox.bg,
+ draw_skinned_rect(buffer, &gui_skin.listbox.bg,
x + dim.x, y + dim.y, dim.width, dim.height);
}
@@ -148,7 +148,7 @@ void ScrollArea::drawVMarker(gcn::Graphics *graphics)
gcn::Rectangle dim = getVerticalMarkerDimension();
getAbsolutePosition(x, y);
- draw_skinned_rect(gui_bitmap, &gui_skin.listbox.vscroll,
+ draw_skinned_rect(buffer, &gui_skin.listbox.vscroll,
x + dim.x, y + dim.y, dim.width, dim.height);
}
diff --git a/src/gui/sell.h b/src/gui/sell.h
index 50da5a10..e1c5d804 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -24,7 +24,6 @@
#ifndef _TMW_SELL_H
#define _TMW_SELL_H
-#include "gui.h"
#include "window.h"
#include "shop.h"
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 589935be..e9675ab3 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -33,6 +33,7 @@
#include "listbox.h"
#include "radiobutton.h"
#include "ok_dialog.h"
+#include "../main.h"
#ifndef WIN32
extern Sound sound;
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index cc9d80ab..77e33ee0 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -22,85 +22,17 @@
*/
#include "shop.h"
-#include "../graphic/graphic.h"
-
-int n_items;
-char* selectedItem = "You got 4";
-ITEM_SHOP *shop = NULL;
char *item_db[] = {
- "Cactus Drink", "Cactus potion", "Casino coins", "Decor Candy", "Maggot Slime",
- "Candy Cane", "Scorpion Stinger", "Xmas Cake", "Chocolate", "Candy", "Santa Hat"
+ "Cactus Drink",
+ "Cactus potion",
+ "Casino coins",
+ "Decor Candy",
+ "Maggot Slime",
+ "Candy Cane",
+ "Scorpion Stinger",
+ "Xmas Cake",
+ "Chocolate",
+ "Candy",
+ "Santa Hat"
};
-
-char *shop_list(int index, int *list_size) {
- if(index<0) {
- *list_size = n_items;
- return NULL;
- } else {
- int iterator = 0;
- ITEM_SHOP *item_shop = shop;
- while(iterator<index) {
- item_shop = item_shop->next;
- iterator++;
- }
- return item_shop->name;
- }
-}
-
-void close_shop() {
- ITEM_SHOP *temp, *next;
- temp = shop;
- while(temp) {
- next = temp->next;
- free(temp);
- temp = next;
- }
- shop = NULL;
-}
-
-short get_item_id(int index) {
- int iterator = 0;
- ITEM_SHOP *item_shop = shop;
- while(iterator<index) {
- item_shop = item_shop->next;
- iterator++;
- }
- return item_shop->id;
-}
-
-int get_item_quantity(int index) {
- int iterator = 0;
- ITEM_SHOP *item_shop = shop;
- while(iterator<index) {
- item_shop = item_shop->next;
- iterator++;
- }
- if(item_shop)return item_shop->quantity;
- else return 0;
-}
-
-int get_item_index(int index) {
- int iterator = 0;
- ITEM_SHOP *item_shop = shop;
- while(iterator<index) {
- item_shop = item_shop->next;
- iterator++;
- }
- return item_shop->index;
-}
-
-int get_item_price(int index) {
- int iterator = 0;
- ITEM_SHOP *item_shop = shop;
- while(iterator<index) {
- item_shop = item_shop->next;
- iterator++;
- }
- return item_shop->price;
-}
-
-void changeQ(void *dp3, int d2) {
- sprintf(itemCurrenyQ,"%i",d2);
- printf("%s\n",itemCurrenyQ);
-}
diff --git a/src/gui/shop.h b/src/gui/shop.h
index c223ef7c..635075a1 100644
--- a/src/gui/shop.h
+++ b/src/gui/shop.h
@@ -27,29 +27,14 @@
#include <stdlib.h>
#include <stdio.h>
-#include "inventory.h"
-
-
struct ITEM_SHOP {
- char name[30];
- int price;
- short id;
- int index;
- int quantity;
- ITEM_SHOP *next;
+ char name[30];
+ int price;
+ short id;
+ int index;
+ int quantity;
};
-extern int n_items;
-extern char* selectedItem;
-extern char itemCurrenyQ[10];
extern char *item_db[];
-char *shop_list(int index, int *list_size);
-void changeQ(void *dp3, int d2);
-void close_shop();
-short get_item_id(int index);
-int get_item_quantity(int index);
-int get_item_index(int index);
-int get_item_price(int index);
-
#endif
diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp
index 11254f09..48c89472 100644
--- a/src/gui/slider.cpp
+++ b/src/gui/slider.cpp
@@ -46,18 +46,18 @@ void Slider::draw(gcn::Graphics *graphics)
y += (h - gui_skin.slider.hSlider[0]->h) / 2;
- masked_blit(gui_skin.slider.hSlider[0], gui_bitmap, 0, 0, x, y,
+ masked_blit(gui_skin.slider.hSlider[0], buffer, 0, 0, x, y,
gui_skin.slider.hSlider[0]->w, gui_skin.slider.hSlider[0]->h);
w -= gui_skin.slider.hSlider[0]->w + gui_skin.slider.hSlider[2]->w;
x += gui_skin.slider.hSlider[0]->w;
- masked_stretch_blit(gui_skin.slider.hSlider[1], gui_bitmap, 0, 0,
+ masked_stretch_blit(gui_skin.slider.hSlider[1], buffer, 0, 0,
gui_skin.slider.hSlider[1]->w, gui_skin.slider.hSlider[1]->h,
x, y, w, gui_skin.slider.hSlider[1]->h);
x += w;
- masked_blit(gui_skin.slider.hSlider[2], gui_bitmap, 0, 0, x, y,
+ masked_blit(gui_skin.slider.hSlider[2], buffer, 0, 0, x, y,
gui_skin.slider.hSlider[2]->w, gui_skin.slider.hSlider[2]->h);
drawMarker(graphics);
@@ -72,6 +72,6 @@ void Slider::drawMarker(gcn::Graphics *graphics)
x += mMarkerPosition;
y += (h - gui_skin.slider.hGrip->h) / 2;
- masked_blit(gui_skin.slider.hGrip, gui_bitmap, 0, 0, x, y,
+ masked_blit(gui_skin.slider.hGrip, buffer, 0, 0, x, y,
gui_skin.slider.hGrip->w, gui_skin.slider.hGrip->h);
}
diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp
index 7e9f6924..bc2e4f34 100644
--- a/src/gui/stats.cpp
+++ b/src/gui/stats.cpp
@@ -22,8 +22,9 @@
*/
#include "stats.h"
-
-extern PLAYER_INFO *char_info;
+#include "button.h"
+#include "../main.h"
+#include "../net/network.h"
StatsWindow::StatsWindow():
Window("Stats")
diff --git a/src/gui/stats.h b/src/gui/stats.h
index a220f125..e03c2a86 100644
--- a/src/gui/stats.h
+++ b/src/gui/stats.h
@@ -24,10 +24,7 @@
#ifndef _TMW_STATS_WINDOW_H
#define _TMW_STATS_WINDOW_H
-#include "button.h"
#include "window.h"
-#include "../main.h"
-#include "../net/network.h"
#include <string>
#include <sstream>
@@ -66,12 +63,7 @@ class StatsWindow : public Window, public gcn::ActionListener {
/**
* Stats buttons.
*/
- Button *statsButton[6];
-
- /**
- * Stats window ptr.
- */
- static StatsWindow *ptr;
+ gcn::Button *statsButton[6];
};
#endif /* _TMW_STATS_WINDOW_H */
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 99ab948c..fa31919d 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -22,6 +22,7 @@
*/
#include "status.h"
+#include "../main.h"
StatusWindow::StatusWindow():
Window("%s Lvl: % 2i Job: % 2i")
diff --git a/src/gui/status.h b/src/gui/status.h
index 27df19da..1e71dcd1 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -25,11 +25,9 @@
#pragma warning(disable:4312)
#endif
-#ifndef _STATS_H
-#define _STATS_H
+#ifndef _TMW_STATS_H
+#define _TMW_STATS_H
-#include "../main.h"
-#include "gui.h"
#include "window.h"
#include "progressbar.h"
#include <allegro.h>
diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp
index 4022ca2d..0d9a21c3 100644
--- a/src/gui/textfield.cpp
+++ b/src/gui/textfield.cpp
@@ -59,5 +59,5 @@ void TextField::drawBorder(gcn::Graphics *graphics)
x -= bs;
y -= bs;
- draw_skinned_rect(gui_bitmap, &gui_skin.textbox.bg, x, y, w, h);
+ draw_skinned_rect(buffer, &gui_skin.textbox.bg, x, y, w, h);
}
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 9c08df9c..665295cb 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -107,27 +107,18 @@ void Window::draw(gcn::Graphics* graphics)
getWidth(), getHeight() - titlebarHeight + 1));
// Skinned dialog render
- if (typeid(*graphics) == typeid(gcn::AllegroGraphics))
- {
- gcn::AllegroGraphics *gfx = (gcn::AllegroGraphics*)graphics;
- BITMAP *screen = gfx->getTarget();
- int x, y;
- getAbsolutePosition(x, y);
-
- // Draw title bar
- dLeft->draw(screen, x, y);
- dMid->drawPattern(screen,
- x + dLeft->getWidth(), y,
- getWidth() - dLeft->getWidth() - dRight->getWidth(),
- dMid->getHeight());
- dRight->draw(screen, x + getWidth() - dRight->getWidth(), y);
- }
- else {
- // Plain title bar
- graphics->setColor(titlebarColor);
- graphics->fillRectangle(gcn::Rectangle(0, 0,
- getWidth(), titlebarHeight));
- }
+ Graphics *gfx = (Graphics*)graphics;
+ BITMAP *screen = gfx->getTarget();
+ int x, y;
+ getAbsolutePosition(x, y);
+
+ // Draw title bar
+ dLeft->draw(screen, x, y);
+ dMid->drawPattern(screen,
+ x + dLeft->getWidth(), y,
+ getWidth() - dLeft->getWidth() - dRight->getWidth(),
+ dMid->getHeight());
+ dRight->draw(screen, x + getWidth() - dRight->getWidth(), y);
// Draw title
graphics->setFont(getFont());