diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2004-12-20 08:08:32 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2004-12-20 08:08:32 +0000 |
commit | 41b0b5c0ed80d812d13c8c92d286a8663084ec58 (patch) | |
tree | 26e968bb48a886bccf8aa17e8064e6f3b8f2bc5d | |
parent | 1883b8b5e20506e41f31bdf6b802fbfd3f63f961 (diff) | |
download | mana-client-41b0b5c0ed80d812d13c8c92d286a8663084ec58.tar.gz mana-client-41b0b5c0ed80d812d13c8c92d286a8663084ec58.tar.bz2 mana-client-41b0b5c0ed80d812d13c8c92d286a8663084ec58.tar.xz mana-client-41b0b5c0ed80d812d13c8c92d286a8663084ec58.zip |
Updated Debian package, some fixes, new classes for the new graphic engine
-rwxr-xr-x | GenDeb.sh | 9 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 35 | ||||
-rw-r--r-- | src/graphic/graphic.h | 73 | ||||
-rw-r--r-- | src/graphic/image.h | 7 |
4 files changed, 116 insertions, 8 deletions
@@ -14,7 +14,7 @@ make; if [ ! -x ./tmw ]; # if tmw doesn't exist then - echo "Compilation failed somwhere. Please try to correct errors given by gcc output..."; + echo "Compilation failed somewhere. Please try to correct errors given by gcc output..."; echo "Aborting..."; exit; fi @@ -91,7 +91,7 @@ touch DEBIAN/prerm; echo '#!/bin/sh' >>DEBIAN/prerm; echo 'if [ \( "$1" = "upgrade" -o "$1" = "remove" \) ]; then' >>DEBIAN/prerm; echo ' if [ -d /usr/games ]; then' >>DEBIAN/prerm; -echo ' rm -f /usr/games/manaworld;' >>DEBIAN/prerm; +echo ' rm -rf /usr/games/manaworld;' >>DEBIAN/prerm; echo ' fi' >>DEBIAN/prerm; echo 'fi' >>DEBIAN/prerm; @@ -104,7 +104,7 @@ echo 'Version: '$TMW_VERSION >>DEBIAN/control; echo 'Section: bin' >>DEBIAN/control; echo 'Priority: optional' >>DEBIAN/control; echo 'Architecture: i386' >>DEBIAN/control; -echo 'Depends: liballegro4.1 (>= 4.1), libjgmod (>= 0.99), libalfont (>= 1.9.2)' >>DEBIAN/control; +echo 'Depends: liballegro4.1 (>= 4.1), libjgmod (>= 0.99), libguichan (>= 0.1.0)' >>DEBIAN/control; echo 'Suggests: Nothing' >>DEBIAN/control; echo 'Installed-Size: 1200' >>DEBIAN/control; echo 'Maintainer: Ferreira Yohann <bertram25@hotmail.com>' >>DEBIAN/control; @@ -138,6 +138,7 @@ echo "Cleaning ..."; rm -rf Debian; echo "You Debian Package is normally ready :" echo "His name is : manaworld_"$TMW_VERSION"_i386.deb"; - +echo "Don't forget you need libjgmod and libguichan to install manaworld."; +echo "You can find them in http://themanaworld.sourceforge.net/files"; echo "End of Debian Creation..."; diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp index 8435c5c5..375f2256 100644 --- a/src/graphic/graphic.cpp +++ b/src/graphic/graphic.cpp @@ -244,6 +244,7 @@ void init_graphic() { skill_list_player = init_dialog(skill_list_dialog, -1); npc_list_player = init_dialog(npc_list_dialog, -1); //gui_bitmap = vpage[page_num]; + text_mode(-1); inventory.create(100, 100); #ifdef WIN32 @@ -609,3 +610,37 @@ void exit_graphic() { shutdown_dialog(npc_player); shutdown_dialog(skill_player); } + +GraphicEngine::GraphicEngine() { + tileset = new Spriteset("./data/graphic/tileset.dat"); + + if(gfx_capabilities & GFX_HW_VRAM_BLIT) { + BITMAP *page1 = create_video_bitmap(SCREEN_W, SCREEN_H); + BITMAP *page2 = create_video_bitmap(SCREEN_W, SCREEN_H); + if(page1 && page2) { + surface = new VideoSurface(page1, page2); + } else { + if(page1)destroy_bitmap(page1); + if(page2)destroy_bitmap(page2); + BITMAP *buffer = create_bitmap(SCREEN_W, SCREEN_H); + if(!buffer) { + error("Not enough memory to create primary surface"); + } + else { + warning("Not enough video memory to create primary surface"); + } + surface = new MemorySurface(buffer); + } + } + else { + BITMAP *buffer = create_bitmap(SCREEN_W, SCREEN_H); + if(!buffer) { + error("Not enough memory to create primary surface"); + } + surface = new MemorySurface(buffer); + } +} + +GraphicEngine::~GraphicEngine() { + delete tileset; +}
\ No newline at end of file diff --git a/src/graphic/graphic.h b/src/graphic/graphic.h index 4c68f933..08ed79d2 100644 --- a/src/graphic/graphic.h +++ b/src/graphic/graphic.h @@ -24,10 +24,6 @@ #ifndef _GRAPHIC_H #define _GRAPHIC_H -#ifdef WIN32 -#pragma warning (disable:4312) -#endif - #include "../game.h" #include "../map.h" #include "../being.h" @@ -64,4 +60,73 @@ void do_graphic(void); void init_graphic(void); void exit_graphic(void); +class Surface { + public: + BITMAP *buffer; + virtual void lock() = 0; + virtual void show() = 0; + virtual void update() = 0; +}; + +class VideoSurface : public Surface { + private: + int current_page; + BITMAP *page[2]; + public: + VideoSurface(BITMAP *page1, BITMAP *page2) { + page[0] = page1; + page[1] = page2; + current_page = 0; + } + ~VideoSurface() { + destroy_bitmap(page[0]); + destroy_bitmap(page[2]); + } + void lock() { +#ifdef WIN32 + acquire_bitmap(buffer); +#endif + } + void show() { +#ifdef WIN32 + release_bitmap(buffer); +#endif + show_video_bitmap(buffer); + } + void update() { + current_page++; + if(current_page=2) { + current_page = 0; + } + buffer = page[current_page]; + } +}; + +class MemorySurface : public Surface { + public: + MemorySurface(BITMAP *buffer) { + this->buffer = buffer; + } + ~MemorySurface() { + destroy_bitmap(buffer); + } + void lock() { + } + void show() { + blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H); + } + void update() { + } +}; + +class GraphicEngine { + private: + Surface *surface; + Spriteset *tileset; + public: + GraphicEngine(); + ~GraphicEngine(); + void refresh(); +}; + #endif diff --git a/src/graphic/image.h b/src/graphic/image.h index 9d9e42c3..b5944b3e 100644 --- a/src/graphic/image.h +++ b/src/graphic/image.h @@ -175,6 +175,13 @@ class Spriteset { i++; } } + /** + * Destoy a spriteset + */ + ~Spriteset() { + for(int i=0;i<spriteset.size();i++) + delete spriteset[i]; + } }; #endif |