diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-02 15:23:31 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-02 15:23:31 +0000 |
commit | 40b4ecacd44bd3040d9600d6304422bdd7e2e4c4 (patch) | |
tree | 4df4181bd7f0bab6187f1f173cb94cd962eda912 | |
parent | e25b9848449f109487fdbab53f4e99c28b8d3214 (diff) | |
download | mana-40b4ecacd44bd3040d9600d6304422bdd7e2e4c4.tar.gz mana-40b4ecacd44bd3040d9600d6304422bdd7e2e4c4.tar.bz2 mana-40b4ecacd44bd3040d9600d6304422bdd7e2e4c4.tar.xz mana-40b4ecacd44bd3040d9600d6304422bdd7e2e4c4.zip |
Got rid of monsterset.dat. Oh and the monsters have a more realistic size now. ;)
-rw-r--r-- | src/graphic/graphic.cpp | 5 | ||||
-rw-r--r-- | src/graphic/image.cpp | 21 | ||||
-rw-r--r-- | src/graphic/image.h | 5 | ||||
-rw-r--r-- | src/main.h | 1 |
4 files changed, 29 insertions, 3 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index e05842d6..40a00aa4 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -204,10 +204,13 @@ GraphicEngine::GraphicEngine() { emotionset = new Spriteset("./data/graphic/emotionset.dat"); hairset = new Spriteset("./data/graphic/hairset.dat"); - monsterset = new Spriteset("./data/graphic/monsterset.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); } GraphicEngine::~GraphicEngine() { diff --git a/src/graphic/image.cpp b/src/graphic/image.cpp index da9bb1d5..c5e28bfb 100644 --- a/src/graphic/image.cpp +++ b/src/graphic/image.cpp @@ -104,9 +104,28 @@ Spriteset::Spriteset(std::string filename) } } +Spriteset::Spriteset(BITMAP *bmp, int width, int height) +{ + /* + * We're creating sub bitmaps here for plain convenience. With SDL this'll + * probably need to be done different. + */ + int x, y; + + for (y = 0; y + height <= bmp->h; y += height) + { + for (x = 0; x + width <= bmp->w; x += width) + { + spriteset.push_back(new VideoImage( + create_sub_bitmap(bmp, x, y, width, height), + 30, 40)); + } + } +} + Spriteset::~Spriteset() { - for (int i = 0; i < spriteset.size(); i++) { + for (unsigned int i = 0; i < spriteset.size(); i++) { delete spriteset[i]; } } diff --git a/src/graphic/image.h b/src/graphic/image.h index 2491b5ad..41d94a2d 100644 --- a/src/graphic/image.h +++ b/src/graphic/image.h @@ -127,6 +127,11 @@ class Spriteset { */ Spriteset(std::string filename); + /* + * Cuts the passed bitmap in a grid of sub bitmaps. + */ + Spriteset::Spriteset(BITMAP *bmp, int width, int height); + /** * Destructor */ @@ -85,7 +85,6 @@ typedef struct { } PLAYER_INFO; extern BITMAP *playerset, *login_wallpaper; -extern DATAFILE *emotions; extern char username[25]; extern char password[25]; extern int map_address, char_ID; |