summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-02 16:31:19 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-01-02 16:31:19 +0000
commite76a6e3d2cc40e382e2ca1c7348e36a4082a221b (patch)
tree5608d032613e083d86923ad7b339352e9f157498 /src
parent40b4ecacd44bd3040d9600d6304422bdd7e2e4c4 (diff)
downloadmana-e76a6e3d2cc40e382e2ca1c7348e36a4082a221b.tar.gz
mana-e76a6e3d2cc40e382e2ca1c7348e36a4082a221b.tar.bz2
mana-e76a6e3d2cc40e382e2ca1c7348e36a4082a221b.tar.xz
mana-e76a6e3d2cc40e382e2ca1c7348e36a4082a221b.zip
Got rid of hairset.dat and playerset.dat.
Diffstat (limited to 'src')
-rw-r--r--src/game.h9
-rw-r--r--src/graphic/graphic.cpp16
-rw-r--r--src/graphic/graphic.h3
-rw-r--r--src/graphic/image.cpp4
-rw-r--r--src/graphic/image.h2
-rw-r--r--src/gui/char_select.cpp33
-rw-r--r--src/gui/inventory.cpp4
-rw-r--r--src/main.cpp34
-rw-r--r--src/main.h34
9 files changed, 73 insertions, 66 deletions
diff --git a/src/game.h b/src/game.h
index 181a6ce0..148596f1 100644
--- a/src/game.h
+++ b/src/game.h
@@ -21,13 +21,13 @@
* $Id$
*/
+#ifndef _TMW_GAME_H
+#define _TMW_GAME_H
+
#ifdef WIN32
#pragma warning (disable:4312)
#endif
-#ifndef _GAME_H
-#define _GAME_H
-
#include "main.h"
#include "./gui/gui.h"
#include "./gui/skill.h"
@@ -38,9 +38,6 @@
#define EMOTION_TIME 40
#define SPEECH_MAX_TIME 100
-#define MAKECOL_WHITE makecol(255,255,255)
-#define MAKECOL_BLACK makecol(0,0,0)
-
// Action defines
#define STAND 0
#define WALK 1
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 40a00aa4..20649d3c 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -203,14 +203,12 @@ GraphicEngine::GraphicEngine() {
gui_bitmap = this->buffer;
emotionset = new Spriteset("./data/graphic/emotionset.dat");
- hairset = new Spriteset("./data/graphic/hairset.dat");
npcset = new Spriteset("./data/graphic/npcset.dat");
- playerset = new Spriteset("./data/graphic/playerset.dat");
tileset = new Spriteset("./data/graphic/tileset.dat");
BITMAP *monsterbitmap = load_bitmap("data/graphic/monsterset.bmp", NULL);
if (!monsterbitmap) error("Unable to load monsterset.bmp");
- monsterset = new Spriteset(monsterbitmap, 60, 60);
+ monsterset = new Spriteset(monsterbitmap, 60, 60, 30, 40);
}
GraphicEngine::~GraphicEngine() {
@@ -291,18 +289,18 @@ void GraphicEngine::refresh() {
playerset->spriteset[4 * pf + dir]->draw(buffer,
node->text_x - 64, node->text_y - 80);
- hairset->spriteset[hf]->draw(
- buffer, node->text_x - 2 + 2 * hairtable[pf][dir][0],
- node->text_y - 50 + 2 * hairtable[pf][dir][1]);
+ hairset->spriteset[hf]->draw(buffer,
+ node->text_x - 2 + 2 * hairtable[pf][dir][0],
+ node->text_y - 50 + 2 * hairtable[pf][dir][1]);
}
else {
int pf = node->frame + node->action;
playerset->spriteset[4 * pf + dir]->draw(buffer,
node->text_x - 64, node->text_y - 80);
- hairset->spriteset[hf]->draw(
- buffer, node->text_x - 2 + 2 * hairtable[pf][dir][0],
- node->text_y - 50 + 2 * hairtable[pf][dir][1]);
+ hairset->spriteset[hf]->draw(buffer,
+ node->text_x - 2 + 2 * hairtable[pf][dir][0],
+ node->text_y - 50 + 2 * hairtable[pf][dir][1]);
}
if (node->emotion != 0) {
emotionset->spriteset[node->emotion - 1]->draw(buffer,
diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h
index 05b92acb..c87cf3ca 100644
--- a/src/graphic/graphic.h
+++ b/src/graphic/graphic.h
@@ -52,7 +52,6 @@ extern Chat chatlog;
extern bool show_skill_dialog, show_skill_list_dialog;
extern int show_npc_dialog;
extern int map_x, map_y, camera_x, camera_y;
-extern BITMAP *hairset;
extern char npc_button[10];
extern StatusWindow *statusWindow;
@@ -77,7 +76,7 @@ class BuySellListener : public gcn::ActionListener {
class GraphicEngine {
private:
- Spriteset *tileset, *emotionset, *npcset, *playerset, *monsterset, *hairset;
+ Spriteset *tileset, *emotionset, *npcset, *monsterset;
BITMAP *buffer;
public:
diff --git a/src/graphic/image.cpp b/src/graphic/image.cpp
index c5e28bfb..7bbf6a68 100644
--- a/src/graphic/image.cpp
+++ b/src/graphic/image.cpp
@@ -104,7 +104,7 @@ Spriteset::Spriteset(std::string filename)
}
}
-Spriteset::Spriteset(BITMAP *bmp, int width, int height)
+Spriteset::Spriteset(BITMAP *bmp, int width, int height, int offx, int offy)
{
/*
* We're creating sub bitmaps here for plain convenience. With SDL this'll
@@ -118,7 +118,7 @@ Spriteset::Spriteset(BITMAP *bmp, int width, int height)
{
spriteset.push_back(new VideoImage(
create_sub_bitmap(bmp, x, y, width, height),
- 30, 40));
+ offx, offy));
}
}
}
diff --git a/src/graphic/image.h b/src/graphic/image.h
index 41d94a2d..fd3000f6 100644
--- a/src/graphic/image.h
+++ b/src/graphic/image.h
@@ -130,7 +130,7 @@ class Spriteset {
/*
* Cuts the passed bitmap in a grid of sub bitmaps.
*/
- Spriteset::Spriteset(BITMAP *bmp, int width, int height);
+ Spriteset::Spriteset(BITMAP *bmp, int w, int h, int offx, int offy);
/**
* Destructor
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index eaada80d..0bc49084 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -24,6 +24,7 @@
#include "char_select.h"
#include "textfield.h"
#include "../graphic/graphic.h"
+#include "../main.h"
CharSelectDialog::CharSelectDialog(gcn::Container *parent)
: Window(parent, "Select Character")
@@ -230,16 +231,16 @@ void charSelect()
gui_update(NULL);
// Draw character
- const int pX = 16, pY = 32;
+ const int pX = 8, pY = 16;
if (n_character > 0) {
- masked_blit(playerset, buffer, 0, 0,
- pX + sel->getDimension().x,
- pY + sel->getDimension().y, 80, 60);
- masked_blit(hairset, buffer,
- 20 * (char_info->hair_color - 1),
- 20 * 4 * (char_info->hair_style - 1),
- pX + 31 + sel->getDimension().x,
- pY + 15 + sel->getDimension().y, 20, 20);
+ playerset->spriteset[0]->draw(buffer,
+ pX + sel->getX() - 31,
+ pY + sel->getY() - 15);
+
+ int hf = char_info->hair_color + 40 * (char_info->hair_style) - 41;
+ hairset->spriteset[hf]->draw(buffer,
+ pX + 31 + sel->getX(),
+ pY + 15 + sel->getY());
}
// Draw to screen
@@ -318,12 +319,14 @@ void charCreate()
// Draw character
const int pX = 96, pY = 40;
- masked_blit(playerset, buffer, 0, 0,
- pX + create->getDimension().x,
- pY + create->getDimension().y, 80, 60);
- masked_blit(hairset, buffer, 20 * curHairColor, 20 * 4 * curHairStyle,
- pX + 31 + create->getDimension().x,
- pY + 15 + create->getDimension().y, 20, 20);
+ playerset->spriteset[0]->draw(buffer,
+ pX + create->getX() - 31,
+ pY + create->getY() - 15);
+
+ int hf = curHairColor + 40 * (curHairStyle);
+ hairset->spriteset[hf]->draw(buffer,
+ pX + 31 + create->getX(),
+ pY + 15 + create->getY());
// Draw to screen
blit(buffer, screen, 0, 0, 0, 0, 800, 600);
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index d506d8ed..1a8f59d7 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -101,7 +101,7 @@ void InventoryWindow::draw(gcn::Graphics *graphics)
}
else {
textprintf_ex(buffer, font, x + itemMeny_x,
- y + itemMeny_y, MAKECOL_BLACK, -1, "Use item");
+ y + itemMeny_y, makecol(0,0,0), -1, "Use item");
}
if (y + itemMeny_y + 10 < mouse_y && y + itemMeny_y + 20 > mouse_y) {
if (mouse_b & 1) {
@@ -114,7 +114,7 @@ void InventoryWindow::draw(gcn::Graphics *graphics)
}
else {
textprintf_ex(buffer, font, x + itemMeny_x,
- y + itemMeny_y + 10, MAKECOL_BLACK, -1, "Del item");
+ y + itemMeny_y + 10, makecol(0,0,0), -1, "Del item");
}
}
*/
diff --git a/src/main.cpp b/src/main.cpp
index a73f65eb..eb36e171 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -72,7 +72,8 @@ char sex, n_server, n_character;
SERVER_INFO *server_info;
PLAYER_INFO *char_info = new PLAYER_INFO;
-BITMAP *playerset, *hairset, *login_wallpaper;
+Spriteset *hairset, *playerset;
+BITMAP *login_wallpaper;
char username[LEN_USERNAME];
char password[LEN_PASSWORD];
@@ -266,21 +267,30 @@ void init_engine() {
error("Not enough memory to create buffer");
}
- login_wallpaper = load_bitmap("./data/graphic/login.bmp", NULL);
+ login_wallpaper = load_bitmap("data/graphic/login.bmp", NULL);
if (!login_wallpaper) error("Couldn't load login.bmp");
- playerset = load_bitmap("./data/graphic/playerset.bmp", NULL);
- if (!playerset) error("Couldn't load playerset.bmp");
-
- hairset = load_bitmap("./data/graphic/hairset.bmp", NULL);
- if (!hairset) error("Couldn't load hairset.bmp");
-
- if (hairset == NULL) {
- error("Unable to load hairset bitmap");
- }
+ BITMAP *playerbitmap = load_bitmap("data/graphic/playerset.bmp", NULL);
+ if (!playerbitmap) error("Couldn't load playerset.bmp");
+ // Stretch the bitmap while it hasn't been replaced with higher res yet
+ BITMAP *playerbitmap2 = create_bitmap(
+ playerbitmap->w * 2, playerbitmap->h * 2);
+ stretch_blit(playerbitmap, playerbitmap2,
+ 0, 0, playerbitmap->w, playerbitmap->h,
+ 0, 0, playerbitmap2->w, playerbitmap2->h);
+ playerset = new Spriteset(playerbitmap2, 160, 120, 0, 0);
+
+ BITMAP *hairbitmap = load_bitmap("data/graphic/hairset.bmp", NULL);
+ if (!hairbitmap) error("Couldn't load hairset.bmp");
+ // Stretch the bitmap while it hasn't been replaced with higher res yet
+ BITMAP *hairbitmap2 = create_bitmap(hairbitmap->w * 2, hairbitmap->h * 2);
+ stretch_blit(hairbitmap, hairbitmap2,
+ 0, 0, hairbitmap->w, hairbitmap->h,
+ 0, 0, hairbitmap2->w, hairbitmap2->h);
+ hairset = new Spriteset(hairbitmap2, 40, 40, 0, 0);
// TODO: Remove Allegro config file usage from GUI look
- init_gui(buffer, "./data/Skin/aqua.skin");
+ init_gui(buffer, "data/Skin/aqua.skin");
state = LOGIN;
}
diff --git a/src/main.h b/src/main.h
index 59d3377d..7f258168 100644
--- a/src/main.h
+++ b/src/main.h
@@ -18,30 +18,29 @@
* 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.upagiro.net)
+ * $Id$
*/
+#ifndef _TMW_MAIN_H
+#define _TMW_MAIN_H
+
#ifdef WIN32
#pragma warning (disable:4312)
#endif
-#ifndef _MAIN_H
-#define _MAIN_H
-
-#define CORE_VERSION "0.0.8"
-
#include <guichan.hpp>
#include <guichan/allegro.hpp>
-#include "./configuration.h"
-#include "./gui/login.h"
-#include "./gui/gui.h"
-#include "./gui/char_server.h"
-#include "./gui/char_select.h"
-#include "./gui/inventory.h"
+#include "configuration.h"
+#include "gui/login.h"
+#include "gui/gui.h"
+#include "gui/char_server.h"
+#include "gui/char_select.h"
+#include "gui/inventory.h"
+#include "graphic/image.h"
#include "log.h"
#include "game.h"
-#include "./net/protocol.h"
+#include "net/protocol.h"
#include "../data/graphic/gfx_data.h"
#include <allegro.h>
#ifdef WIN32
@@ -49,6 +48,7 @@
#endif
#include <stdio.h>
+#define CORE_VERSION "0.0.8"
#define EXIT 0
#define LOGIN 1
@@ -60,8 +60,8 @@
/* length definitions for several char[]s in order
* to be able to use strncpy instead of strcpy for
- * security and stability reasons */
-
+ * security and stability reasons
+ */
#define LEN_USERNAME 25
#define LEN_PASSWORD 25
@@ -84,7 +84,8 @@ typedef struct {
short weapon;
} PLAYER_INFO;
-extern BITMAP *playerset, *login_wallpaper;
+extern BITMAP *login_wallpaper;
+extern Spriteset *hairset, *playerset;
extern char username[25];
extern char password[25];
extern int map_address, char_ID;
@@ -97,7 +98,6 @@ extern PLAYER_INFO *char_info;
extern unsigned char state;
extern unsigned short x, y;
extern unsigned char direction;
-//extern unsigned short job, hair, hair_color;
extern unsigned char stretch_mode;
#endif