ULTIMA6: Added misc/ folder

This commit is contained in:
Paul Gilbert 2019-12-17 18:44:42 -08:00 committed by Paul Gilbert
parent d720efdfe5
commit 40b35da05c
165 changed files with 480 additions and 473 deletions

View File

@ -10,7 +10,11 @@ MODULE_OBJS += \
ultima6/conf/configuration.o \
ultima6/conf/misc.o \
ultima6/conf/xml_node.o \
ultima6/conf/xml_tree.o
ultima6/conf/xml_tree.o \
ultima6/misc/iavl_tree.o \
ultima6/misc/u6_line_walker.o \
ultima6/misc/u6_list.o \
ultima6/misc/u6_misc.o
endif
ifdef ENABLE_ULTIMA8

View File

@ -78,6 +78,10 @@ double sqrt(double val) {
return ::sqrt(val);
}
int labs(int v) {
return ABS(v);
}
const char *strstr(const char *str, const char *substr) {
return ::strstr(str, substr);
}

View File

@ -54,6 +54,7 @@ extern double atof(const char *str);
extern const char *strstr(const char *str, const char *substr);
extern double pow(double x, double y);
extern double sqrt(double val);
extern int labs(int v);
extern void *malloc(size_t size);
extern void *calloc(size_t num, size_t size);

View File

@ -67,6 +67,16 @@ public:
size_t length() const { return size(); }
/**
* Assign a new string
*/
void assign(const char *s) {
*this = s;
}
void assign(const string &s) {
*this = s;
}
/**
* String square brackets allows modifying characters
*/
@ -100,11 +110,13 @@ public:
* Does a find for the passed string
*/
size_t find(const char *s) const;
size_t find(const string &s) const { return find(s.c_str()); }
/**
* Does a reverse find for the passed string
*/
size_t rfind(const char *s) const;
size_t rfind(const string &s) const { return rfind(s.c_str()); }
/**
* Does a reverse find for a passed character
@ -120,6 +132,9 @@ public:
* Find first character in the string that's any character of the passed string
*/
size_t find_first_of(const char *chars, size_t pos = 0) const;
size_t find_first_of(const string &chars, size_t pos = 0) const {
return find_first_of(chars.c_str(), pos);
}
/**
* Find first character in the string that's not the specified character
@ -130,6 +145,9 @@ public:
* Find first character in the string that's not any character of the passed string
*/
size_t find_first_not_of(const char *chars, size_t pos = 0) const;
size_t find_first_not_of(const string &chars, size_t pos = 0) const {
return find_first_not_of(chars.c_str(), pos);
}
/**
* Find the last character in the string that's not the specified character
@ -140,6 +158,9 @@ public:
* Find the last character in the string that's not in any of the passed characters
*/
size_t find_last_not_of(const char *chars) const;
size_t find_last_not_of(const string &chars) const {
return find_last_not_of(chars.c_str());
}
/**
* Return a substring of this string

View File

@ -24,8 +24,8 @@
#include <cstdlib>
#include <cmath>
#include <cassert>
#include "U6misc.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "Game.h"
#include "GameClock.h"
#include "MapWindow.h"

View File

@ -23,7 +23,7 @@
#ifndef ULTIMA6_ACTORS_ACTOR_H
#define ULTIMA6_ACTORS_ACTOR_H
#include <vector>
#include "ultima/shared/std/containers.h"
#include <list>
#include "ultima/shared/std/string.h"
#include <map>

View File

@ -24,7 +24,7 @@
#include <sstream>
#include <cstdlib>
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/conf/configuration.h"
#include "NuvieFileList.h"
#include "Objlist.h"
@ -35,7 +35,7 @@
#include "MDActor.h"
#include "U6WorkTypes.h"
#include "TileManager.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "ActorManager.h"
#include "NuvieIOFile.h"
#include "GameClock.h"

View File

@ -23,8 +23,8 @@
#include <cstdlib>
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "Game.h"
#include "U6UseCode.h"

View File

@ -21,10 +21,10 @@
*/
#include <cmath>
#include <vector>
#include "ultima/shared/std/containers.h"
#include "SDL.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Font.h"
#include "FontManager.h"
@ -86,7 +86,7 @@ static float get_relative_degrees(sint16 sx, sint16 sy, float angle_up) {
}
AnimManager::AnimManager(sint16 x, sint16 y, Screen *screen, SDL_Rect *clipto)
AnimManager::AnimManager(sint16 x, sint16 y, Screen *screen, Common::Rect *clipto)
: next_id(0) {
map_window = Game::get_game()->get_map_window();
tile_pitch = 16;

View File

@ -31,7 +31,7 @@
#include "TimedEvent.h"
#include "CallBack.h"
#include "MapEntity.h"
#include "U6LineWalker.h"
#include "ultima/ultima6/misc/u6_line_walker.h"
namespace Ultima {
namespace Ultima6 {
@ -57,7 +57,7 @@ typedef std::list<NuvieAnim *>::iterator AnimIterator;
class AnimManager {
MapWindow *map_window;
Screen *viewsurf;
SDL_Rect viewport; // clip anims to location
Common::Rect viewport; // clip anims to location
std::list<NuvieAnim *> anim_list; // in paint order
uint32 next_id;
@ -69,7 +69,7 @@ class AnimManager {
AnimIterator get_anim_iterator(uint32 anim_id);
public:
AnimManager(sint16 x, sint16 y, Screen *screen = NULL, SDL_Rect *clipto = NULL);
AnimManager(sint16 x, sint16 y, Screen *screen = NULL, Common::Rect *clipto = NULL);
~AnimManager() {
destroy_all();
}
@ -83,7 +83,7 @@ public:
void set_surface(Screen *screen) {
viewsurf = screen;
}
void set_area(SDL_Rect clipto) {
void set_area(Common::Rect clipto) {
viewport = clipto;
}
void set_tile_pitch(uint8 p) {

View File

@ -25,7 +25,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "U6Lib_n.h"
#include "U6Bmp.h"
#include "Dither.h"

View File

@ -26,7 +26,7 @@
#include "ultima/ultima6/conf/configuration.h"
#include "U6Lib_n.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Book.h"

View File

@ -26,7 +26,7 @@
#include "ultima/ultima6/conf/configuration.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Game.h"
#include "Screen.h"
#include "Event.h"

View File

@ -26,7 +26,7 @@
#include "ultima/ultima6/conf/configuration.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Game.h"
#include "Screen.h"
#include "Event.h"

View File

@ -24,7 +24,7 @@
#include <cmath>
#include "ultima/shared/std/string.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "GUI.h"
#include "Console.h"

View File

@ -27,7 +27,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "Game.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "U6Lzw.h"
#include "Player.h"
#include "Party.h"

View File

@ -26,7 +26,7 @@
#include <cstdio>
#include "ultima/shared/std/string.h"
#include <stack>
#include <vector>
#include "ultima/shared/std/containers.h"
#include "Actor.h"
#include "MsgScroll.h"

View File

@ -26,7 +26,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "FontManager.h"
#include "Font.h"
#include "GamePalette.h"

View File

@ -28,7 +28,7 @@
#include <stdarg.h>
#include <list>
#include <vector>
#include "ultima/shared/std/containers.h"
#include "ultima/shared/std/string.h"
namespace Ultima {

View File

@ -26,7 +26,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "FontManager.h"
#include "Font.h"
#include "GamePalette.h"
@ -140,7 +140,7 @@ void ConverseGumpWOU::display_bg() {
if (game_type == NUVIE_GAME_U6) {
if (game_w >= 335) { // get right size
SDL_Rect dst;
Common::Rect dst;
dst.x = x_off;
dst.y = y_off;
dst.w = 176;

View File

@ -28,7 +28,7 @@
#include "Font.h"
#include <list>
#include <vector>
#include "ultima/shared/std/containers.h"
#include "ultima/shared/std/string.h"
namespace Ultima {
@ -107,7 +107,7 @@ protected:
private:
SDL_Surface *bg_image;
Graphics::ManagedSurface *bg_image;
};
} // End of namespace Ultima6

View File

@ -23,7 +23,7 @@
#include <ctype.h>
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Player.h"
#include "Party.h"

View File

@ -28,7 +28,7 @@
#include "Screen.h"
#include "NuvieIO.h"
#include "NuvieIOFile.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "U6Lzw.h"
#include "U6Shape.h"
#include "U6Lib_n.h"

View File

@ -24,7 +24,7 @@
#define ULTIMA6_CORE_CURSOR_H
#include "ultima/shared/std/string.h"
#include <vector>
#include "ultima/shared/std/containers.h"
#include "SDL.h"
namespace Ultima {
@ -53,8 +53,8 @@ class Cursor {
uint8 cursor_id; // which pointer is active
unsigned char *cleanup; // restore image behind cursor
SDL_Rect cleanup_area;
SDL_Rect update_area; // clear & display are updated at once (avoid flicker)
Common::Rect cleanup_area;
Common::Rect update_area; // clear & display are updated at once (avoid flicker)
bool hidden;

View File

@ -934,20 +934,20 @@ FadeEffect::FadeEffect(FadeType fade, FadeDirection dir, uint32 color, uint32 sp
}
/* Takes an image to fade from/to. */
FadeEffect::FadeEffect(FadeType fade, FadeDirection dir, SDL_Surface *capture, uint32 speed) {
FadeEffect::FadeEffect(FadeType fade, FadeDirection dir, Graphics::ManagedSurface *capture, uint32 speed) {
speed = speed ? speed : game->get_map_window()->get_win_area() * 1620; // was 196000
init(fade, dir, 0, capture, 0, 0, speed); // color=black
}
/* Localizes effect to specific coordinates. The size of the effect is determined
* by the size of the image. */
FadeEffect::FadeEffect(FadeType fade, FadeDirection dir, SDL_Surface *capture, uint16 x, uint16 y, uint32 speed) {
FadeEffect::FadeEffect(FadeType fade, FadeDirection dir, Graphics::ManagedSurface *capture, uint16 x, uint16 y, uint32 speed) {
speed = speed ? speed : 1024;
init(fade, dir, 0, capture, x, y, speed); // color=black
}
void FadeEffect::init(FadeType fade, FadeDirection dir, uint32 color, SDL_Surface *capture, uint16 x, uint16 y, uint32 speed) {
void FadeEffect::init(FadeType fade, FadeDirection dir, uint32 color, Graphics::ManagedSurface *capture, uint16 x, uint16 y, uint32 speed) {
if (current_fade) {
delete_self();
return;
@ -956,7 +956,7 @@ void FadeEffect::init(FadeType fade, FadeDirection dir, uint32 color, SDL_Surfac
screen = game->get_screen();
map_window = game->get_map_window();
viewport = new SDL_Rect(map_window->GetRect());
viewport = new Common::Rect(map_window->GetRect());
fade_type = fade;
fade_dir = dir;
@ -1012,7 +1012,7 @@ void FadeEffect::init_pixelated_fade() {
if (fade_from) { // fade from captured surface to transparent
// put surface on transparent background (not checked)
fillret = SDL_FillRect(overlay, NULL, uint32(TRANSPARENT_COLOR));
SDL_Rect overlay_rect = { (Sint16)fade_x, (Sint16)fade_y, 0, 0 };
Common::Rect overlay_rect = { (Sint16)fade_x, (Sint16)fade_y, 0, 0 };
fillret = SDL_BlitSurface(fade_from, NULL,
overlay, &overlay_rect);
} else // fade from transparent to color
@ -1152,8 +1152,8 @@ bool FadeEffect::pixelated_fade_core(uint32 pixels_to_check, sint16 fade_to) {
if (fade_to >= 0)
SDL_FillRect(overlay, NULL, (uint32)fade_to);
else { // Note: assert(fade_from) if(fade_to < 0)
SDL_Rect fade_from_rect = { 0, 0, (Uint16)fade_from->w, (Uint16)fade_from->h };
SDL_Rect overlay_rect = { (Sint16)fade_x, (Sint16)fade_y, (Uint16)fade_from->w, (Uint16)fade_from->h };
Common::Rect fade_from_rect = { 0, 0, (Uint16)fade_from->w, (Uint16)fade_from->h };
Common::Rect overlay_rect = { (Sint16)fade_x, (Sint16)fade_y, (Uint16)fade_from->w, (Uint16)fade_from->h };
SDL_BlitSurface(fade_from, &fade_from_rect, overlay, &overlay_rect);
}
return (true);
@ -1240,7 +1240,7 @@ FadeObjectEffect::FadeObjectEffect(Obj *obj, FadeDirection dir) {
fade_obj = obj;
fade_dir = dir;
SDL_Surface *capture = game->get_map_window()->get_sdl_surface();
Graphics::ManagedSurface *capture = game->get_map_window()->get_sdl_surface();
if (fade_dir == FADE_IN) { // fading IN to object, so fade OUT from capture
effect_manager->watch_effect(this, /* call me */
new FadeEffect(FADE_PIXELATED, FADE_OUT, capture));
@ -1273,7 +1273,7 @@ uint16 FadeObjectEffect::callback(uint16 msg, CallBack *caller, void *data) {
*/
VanishEffect::VanishEffect(bool pause_user)
: input_blocked(pause_user) {
SDL_Surface *capture = game->get_map_window()->get_sdl_surface();
Graphics::ManagedSurface *capture = game->get_map_window()->get_sdl_surface();
// effect_manager->watch_effect(this, /* call me */
// new FadeEffect(FADE_PIXELATED, FADE_OUT, capture, 0, 0, 128000));
effect_manager->watch_effect(this, /* call me */

View File

@ -421,14 +421,14 @@ protected:
MapWindow *map_window;
Screen *screen; // for PIXELATED, the overlay is blitted to the screen...
SDL_Rect *viewport; // ...at the MapWindow coordinates set here
SDL_Surface *overlay; // this is what gets blitted
Common::Rect *viewport; // ...at the MapWindow coordinates set here
Graphics::ManagedSurface *overlay; // this is what gets blitted
FadeType fade_type; // PIXELATED[_ONTOP] or CIRCLE
FadeDirection fade_dir; // IN (removing color) or OUT (adding color)
uint32 fade_speed; // meaning of this depends on fade_type
uint8 pixelated_color; // color from palette that is being faded to/from
SDL_Surface *fade_from; // image being faded from or to (or NULL if coloring)
Graphics::ManagedSurface *fade_from; // image being faded from or to (or NULL if coloring)
uint16 fade_x, fade_y; // start fade from this point (to fade_from size)
uint32 evtime, prev_evtime; // time of last message to callback()
@ -437,8 +437,8 @@ protected:
public:
FadeEffect(FadeType fade, FadeDirection dir, uint32 color = 0, uint32 speed = 0);
FadeEffect(FadeType fade, FadeDirection dir, SDL_Surface *capture, uint32 speed = 0);
FadeEffect(FadeType fade, FadeDirection dir, SDL_Surface *capture, uint16 x, uint16 y, uint32 speed = 0);
FadeEffect(FadeType fade, FadeDirection dir, Graphics::ManagedSurface *capture, uint32 speed = 0);
FadeEffect(FadeType fade, FadeDirection dir, Graphics::ManagedSurface *capture, uint16 x, uint16 y, uint32 speed = 0);
~FadeEffect();
virtual uint16 callback(uint16 msg, CallBack *caller, void *data);
@ -450,7 +450,7 @@ public:
void delete_self();
protected:
void init(FadeType fade, FadeDirection dir, uint32 color, SDL_Surface *capture, uint16 x, uint16 y, uint32 speed);
void init(FadeType fade, FadeDirection dir, uint32 color, Graphics::ManagedSurface *capture, uint16 x, uint16 y, uint32 speed);
void init_pixelated_fade();
void init_circle_fade();
@ -548,7 +548,7 @@ protected:
class XorEffect : public TimedEffect {
MapWindow *map_window;
uint32 length;
SDL_Surface *capture; // this is what gets blitted
Graphics::ManagedSurface *capture; // this is what gets blitted
void xor_capture(uint8 mod);
void init_effect();
@ -569,7 +569,7 @@ class U6WhitePotionEffect : public TimedEffect {
MapWindow *map_window;
uint8 state; // 0=start, 1=eff1, 2=eff2, 3=x-ray, 4=complete
uint32 start_length, eff1_length, eff2_length, xray_length;
SDL_Surface *capture; // this is what gets blitted
Graphics::ManagedSurface *capture; // this is what gets blitted
Obj *potion; // allows effect to call usecode and delete object
void xor_capture(uint8 mod);
@ -655,7 +655,7 @@ const uint8 peer_tile[PEER_TILEW * PEER_TILEW] = {
*/
class PeerEffect : public PauseEffect {
MapWindow *map_window;
SDL_Surface *overlay; // this is what gets blitted
Graphics::ManagedSurface *overlay; // this is what gets blitted
Obj *gem; // allows effect to call usecode and delete object
MapCoord area; // area to display (top-left corner)
uint8 tile_trans; // peer_tile transparency mask (0 or 1)

View File

@ -23,7 +23,7 @@
#ifndef ULTIMA6_CORE_EFFECT_MANAGER_H
#define ULTIMA6_CORE_EFFECT_MANAGER_H
#include <vector>
#include "ultima/shared/std/containers.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -28,8 +28,8 @@
#include "Actor.h"
#include "TileManager.h"
#include "ActorManager.h"
#include "U6misc.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "EggManager.h"
#include "NuvieIOFile.h"
#include "GameClock.h"

View File

@ -25,7 +25,7 @@
#include "SDL.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/conf/configuration.h"
#include "Game.h"
#include "GameClock.h"
@ -2388,9 +2388,9 @@ void Event::wait() {
//Protected
inline Uint32 Event::TimeLeft() {
static Uint32 next_time = 0;
Uint32 now;
inline uint32 Event::TimeLeft() {
static uint32 next_time = 0;
uint32 now;
now = clock->get_ticks();
if (fps_counter == 60) {
@ -2406,7 +2406,7 @@ inline Uint32 Event::TimeLeft() {
next_time = now + NUVIE_INTERVAL;
return (0);
}
Uint32 delay = next_time - now;
uint32 delay = next_time - now;
next_time += NUVIE_INTERVAL;
return (delay);
}

View File

@ -164,7 +164,7 @@ class Event : public CallBack {
bool looking_at_spellbook;
bool direction_selects_target;
Uint32 fps_timestamp;
uint32 fps_timestamp;
uint16 fps_counter;
FpsCounter *fps_counter_widget;
ScriptThread *scriptThread;
@ -365,7 +365,7 @@ public:
that we don't need to check for WAIT mode in all of them. */
protected:
inline Uint32 TimeLeft();
inline uint32 TimeLeft();
uint16 callback(uint16 msg, CallBack *caller, void *data);
bool handleSDL_KEYDOWN(const SDL_Event *event);

View File

@ -27,7 +27,7 @@
#include "ultima/ultima6/conf/configuration.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Game.h"
#include "Screen.h"
#include "FontManager.h"

View File

@ -22,7 +22,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "GUI.h"
#include "Console.h"

View File

@ -23,7 +23,7 @@
#ifndef ULTIMA6_CORE_GAME_H
#define ULTIMA6_CORE_GAME_H
#include <vector>
#include "ultima/shared/std/containers.h"
#include "ultima/shared/std/string.h"
namespace Ultima {

View File

@ -23,7 +23,7 @@
#ifndef ULTIMA6_CORE_GAME_CLOCK_H
#define ULTIMA6_CORE_GAME_CLOCK_H
#include <vector>
#include "ultima/shared/std/containers.h"
#include "SDL.h"
#include "ultima/ultima6/core/nuvie_defs.h"

View File

@ -22,7 +22,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "GameSelect.h"
#include "Console.h"

View File

@ -27,7 +27,7 @@
#include "ultima/ultima6/conf/configuration.h"
#include "NuvieIOFile.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "U6Lib_n.h"
#include "U6Lzw.h"

View File

@ -25,7 +25,7 @@
//#include <iostream>
#include "SDL.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Party.h"
#include "MsgScroll.h"
#include "ultima/ultima6/conf/configuration.h"
@ -46,7 +46,7 @@
#include "Magic.h"
#include "Game.h"
#include "GameClock.h"
#include "misc/U6LList.h"
#include "misc/ultima/ultima6/misc/u6_llist.h"
#include "Effect.h"
#include "Weather.h"
#include "Script.h"

View File

@ -32,7 +32,7 @@
#include "Map.h"
#include "MapWindow.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -24,8 +24,8 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "Actor.h"
#include "ActorManager.h"
#include "ViewManager.h"
@ -1276,7 +1276,7 @@ void MapWindow::drawRoofs() {
uint16 *roof_map_ptr = map->get_roof_data(cur_level);
SDL_Rect src, dst;
Common::Rect src, dst;
src.w = 16;
src.h = 16;
dst.w = 16;
@ -2544,7 +2544,7 @@ unsigned char *MapWindow::make_thumbnail() {
}
void MapWindow::create_thumbnail() {
SDL_Rect src_rect;
Common::Rect src_rect;
src_rect.w = MAPWINDOW_THUMBNAIL_SIZE * MAPWINDOW_THUMBNAIL_SCALE;
src_rect.h = src_rect.w;
@ -2568,14 +2568,14 @@ void MapWindow::free_thumbnail() {
/* Returns a new 8bit copy of the mapwindow as displayed. Caller must free it. */
SDL_Surface *MapWindow::get_sdl_surface() {
Graphics::ManagedSurface *MapWindow::get_sdl_surface() {
return (get_sdl_surface(0, 0, area.w, area.h));
}
SDL_Surface *MapWindow::get_sdl_surface(uint16 x, uint16 y, uint16 w, uint16 h) {
SDL_Surface *new_surface = NULL;
Graphics::ManagedSurface *MapWindow::get_sdl_surface(uint16 x, uint16 y, uint16 w, uint16 h) {
Graphics::ManagedSurface *new_surface = NULL;
unsigned char *screen_area;
SDL_Rect copy_area = { (Sint16)(area.x + x), (Sint16)(area.y + y), w, h };
Common::Rect copy_area = { (Sint16)(area.x + x), (Sint16)(area.y + y), w, h };
GUI::get_gui()->Display();
screen_area = screen->copy_area(&copy_area);
@ -2589,7 +2589,7 @@ SDL_Surface *MapWindow::get_sdl_surface(uint16 x, uint16 y, uint16 w, uint16 h)
}
/* Returns the overlay surface. A new 8bit overlay is created if necessary. */
SDL_Surface *MapWindow::get_overlay() {
Graphics::ManagedSurface *MapWindow::get_overlay() {
if (!overlay)
overlay = SDL_CreateRGBSurface(SDL_SWSURFACE, area.w, area.h,
8, 0, 0, 0, 0);
@ -2597,7 +2597,7 @@ SDL_Surface *MapWindow::get_overlay() {
}
/* Set the overlay surface. The current overlay is deleted if necessary. */
void MapWindow::set_overlay(SDL_Surface *surfpt) {
void MapWindow::set_overlay(Graphics::ManagedSurface *surfpt) {
if (overlay && (overlay != surfpt))
SDL_FreeSurface(overlay);
overlay = surfpt;

View File

@ -23,7 +23,7 @@
#ifndef ULTIMA6_CORE_MAP_WINDOW_H
#define ULTIMA6_CORE_MAP_WINDOW_H
#include <vector>
#include "ultima/shared/std/containers.h"
#include "SDL.h"
#include "ultima/ultima6/core/nuvie_defs.h"
@ -89,7 +89,7 @@ class MapWindow: public GUI_Widget {
uint16 *tmp_map_buf; // tempory buffer for flood fill, hide rooms.
uint16 tmp_map_width, tmp_map_height;
SDL_Surface *overlay; // used for visual effects
Graphics::ManagedSurface *overlay; // used for visual effects
uint8 overlay_level; // where the overlay surface is placed
int min_brightness;
@ -119,7 +119,7 @@ class MapWindow: public GUI_Widget {
uint8 cur_x_add, cur_y_add; // pixel offset from cur_x,cur_y (set by shiftMapRelative)
sint32 vel_x, vel_y; // velocity of automatic map movement (pixels per second)
SDL_Rect clip_rect;
Common::Rect clip_rect;
Obj *selected_obj;
Actor *look_actor;
@ -136,7 +136,7 @@ class MapWindow: public GUI_Widget {
bool roof_mode;
RoofDisplayType roof_display;
SDL_Surface *roof_tiles;
Graphics::ManagedSurface *roof_tiles;
WizardEye wizard_eye_info;
@ -171,7 +171,7 @@ public:
vel_x = vx;
vel_y = vy;
}
void set_overlay(SDL_Surface *surfpt);
void set_overlay(Graphics::ManagedSurface *surfpt);
void set_overlay_level(int level = MAP_OVERLAY_DEFAULT) {
overlay_level = level;
}
@ -262,10 +262,10 @@ public:
AnimManager *get_anim_manager() {
return anim_manager;
}
SDL_Rect *get_clip_rect() {
Common::Rect *get_clip_rect() {
return &clip_rect;
}
SDL_Surface *get_overlay();
Graphics::ManagedSurface *get_overlay();
void get_level(uint8 *level);
void get_pos(uint16 *x, uint16 *y, uint8 *px = NULL, uint8 *py = NULL);
@ -319,9 +319,9 @@ public:
unsigned char *make_thumbnail();
void free_thumbnail();
SDL_Surface *get_sdl_surface();
SDL_Surface *get_sdl_surface(uint16 x, uint16 y, uint16 w, uint16 h);
SDL_Surface *get_roof_tiles() {
Graphics::ManagedSurface *get_sdl_surface();
Graphics::ManagedSurface *get_sdl_surface(uint16 x, uint16 y, uint16 w, uint16 h);
Graphics::ManagedSurface *get_roof_tiles() {
return roof_tiles;
}

View File

@ -27,7 +27,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "FontManager.h"
#include "Font.h"
#include "GamePalette.h"

View File

@ -43,7 +43,7 @@
#define MSGSCROLL_NO_MAP_DISPLAY false
#include <list>
#include <vector>
#include "ultima/shared/std/containers.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -26,7 +26,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "FontManager.h"
#include "Font.h"
#include "GamePalette.h"

View File

@ -28,7 +28,7 @@
#include <stdarg.h>
#include <list>
#include <vector>
#include "ultima/shared/std/containers.h"
#include "ultima/shared/std/string.h"
namespace Ultima {

View File

@ -24,7 +24,7 @@
#define ULTIMA6_CORE_OBJ_H
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_llist.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -30,9 +30,9 @@
#include "TileManager.h"
#include "ObjManager.h"
#include "UseCode.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "U6objects.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "NuvieIOFile.h"
#include "Game.h"
#include "MapWindow.h"

View File

@ -25,9 +25,9 @@
#include <list>
#include <cstring>
#include "iAVLTree.h"
#include "ultima/ultima6/misc/iavl_tree.h"
#include "TileManager.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_llist.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -22,7 +22,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "NuvieIO.h"
#include "Game.h"
#include "Converse.h"

View File

@ -23,7 +23,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "NuvieIO.h"
#include "ActorManager.h"
#include "Actor.h"

View File

@ -34,7 +34,7 @@
#include "Game.h"
#include "GamePalette.h"
#include "Dither.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Look.h"
#include "GameClock.h"
#include "SaveManager.h"

View File

@ -32,7 +32,7 @@
#include "UseCode.h"
#include "U6objects.h"
#include "U6WorkTypes.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "MsgScroll.h"
#include "GameClock.h"
#include "CommandBar.h"
@ -384,7 +384,7 @@ void TimedPartyMove::hide_actor(Actor *person) {
*/
void TimedPartyMove::change_location() {
EffectManager *effect_mgr = Game::get_game()->get_effect_manager();
SDL_Surface *mapwindow_capture = NULL;
Graphics::ManagedSurface *mapwindow_capture = NULL;
if (wait_for_effect != 1) {
bool is_moongate = moongate != NULL;
if (moongate && moongate->obj_n == OBJ_U6_RED_GATE) { // leave blue moongates

View File

@ -28,8 +28,8 @@
#include "CallBack.h"
#include "NuvieIO.h"
#include "U6misc.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/misc/u6_llist.h"
#include "Weather.h"
#include "Game.h"
#include "GameClock.h"

View File

@ -276,12 +276,12 @@ unsigned char *NuvieBmpFile::getRawIndexedDataCopy() {
return copy;
}
SDL_Surface *NuvieBmpFile::getSdlSurface32(std::string filename) {
Graphics::ManagedSurface *NuvieBmpFile::getSdlSurface32(std::string filename) {
load(filename);
return getSdlSurface32();
}
SDL_Surface *NuvieBmpFile::getSdlSurface32() {
Graphics::ManagedSurface *NuvieBmpFile::getSdlSurface32() {
uint32 rmask = 0x000000ff;
uint32 gmask = 0x0000ff00;
uint32 bmask = 0x00ff0000;
@ -291,7 +291,7 @@ SDL_Surface *NuvieBmpFile::getSdlSurface32() {
return NULL;
}
SDL_Surface *surface = SDL_CreateRGBSurface(SDL_SWSURFACE, infoHeader.width, infoHeader.height, 32,
Graphics::ManagedSurface *surface = SDL_CreateRGBSurface(SDL_SWSURFACE, infoHeader.width, infoHeader.height, 32,
rmask, gmask, bmask, 0);
unsigned char *src_buf = data;

View File

@ -84,8 +84,8 @@ public:
Tile *getTile();
unsigned char *getRawIndexedData();
unsigned char *getRawIndexedDataCopy();
SDL_Surface *getSdlSurface32();
SDL_Surface *getSdlSurface32(std::string filename);
Graphics::ManagedSurface *getSdlSurface32();
Graphics::ManagedSurface *getSdlSurface32(std::string filename);
private:
bool handleError(std::string error);

View File

@ -34,7 +34,7 @@
#include "Console.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "NuvieFileList.h"

View File

@ -23,7 +23,7 @@
#include "TileManager.h"
#include "Map.h"
#include "ObjManager.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "TMXMap.h"
namespace Ultima {

View File

@ -26,7 +26,7 @@
#include <cctype>
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "NuvieIOFile.h"
#include "U6Lzw.h"

View File

@ -23,7 +23,7 @@
#ifndef ULTIMA6_FILES_U6LIB_N_H
#define ULTIMA6_FILES_U6LIB_N_H
#include <vector>
#include "ultima/shared/std/containers.h"
#include "ultima/shared/std/string.h"
#include <cstdio> /* FILE */

View File

@ -38,7 +38,7 @@
#include "ultima/ultima6/core/nuvie_defs.h"
#include "NuvieIOFile.h"
#include "U6Lzw.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -30,7 +30,7 @@
#include "SDL.h"
#include "SDL_endian.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "U6Lzw.h"
#include "U6Lib_n.h"
#include "NuvieIO.h"
@ -330,14 +330,14 @@ unsigned char *U6Shape::get_data() {
/*
* ============================================
* SDL_Surface *U6Shape::get_shape_surface();
* Graphics::ManagedSurface *U6Shape::get_shape_surface();
* ============================================
*
* Returns a SDL_Surface representing the shape
* Returns a Graphics::ManagedSurface representing the shape
* or NULL on failure. NOTE! user must free this
* data.
*/
SDL_Surface *U6Shape::get_shape_surface() {
Graphics::ManagedSurface *U6Shape::get_shape_surface() {
if (raw == NULL)
return NULL;
/* NOT REACHED */

View File

@ -43,7 +43,7 @@ class Configuration;
* ==================
*
* U6Shape can load Ultima VI shape files and return the shapes
* stored into these files either as a SDL_Surface or as raw data.
* stored into these files either as a Graphics::ManagedSurface or as raw data.
*/
class U6Shape {
private:
@ -65,7 +65,7 @@ public:
bool load_WoU_background(Configuration *config, nuvie_game_t game_type);
unsigned char *get_data();
SDL_Surface *get_shape_surface();
Graphics::ManagedSurface *get_shape_surface();
bool get_hot_point(uint16 *x, uint16 *y);
bool get_size(uint16 *w, uint16 *h);

View File

@ -113,8 +113,8 @@ uint16 BMPFont::getCharWidth(uint8 c) {
uint16 BMPFont::drawChar(Screen *screen, uint8 char_num, uint16 x, uint16 y,
uint8 color) {
SDL_Rect src;
SDL_Rect dst;
Common::Rect src;
Common::Rect dst;
if (dual_font_mode) {
if (char_num == '<') {

View File

@ -32,7 +32,7 @@ class Configuration;
class Screen;
class BMPFont : public Font {
SDL_Surface *sdl_font_data;
Graphics::ManagedSurface *sdl_font_data;
uint8 *font_width_data;
uint16 char_w, char_h;

View File

@ -34,7 +34,7 @@
#include "ConvFont.h"
#include "U6Font.h"
#include "WOUFont.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -46,7 +46,7 @@ const int GUI::mouseclick_delay = 300; /* SB-X */
GUI *GUI::gui = NULL;
GUI:: GUI(Configuration *c, Screen *s) {
SDL_Surface *sdl_surface;
Graphics::ManagedSurface *sdl_surface;
gui = this;
config = c;

View File

@ -66,7 +66,7 @@ GUI_Area:: SetDisplay(Screen *s) {
/* Show the widget */
void GUI_Area::Display(bool full_redraw) {
SDL_Rect framerect;
Common::Rect framerect;
int x, dy, r1, r2, x0, y0;
switch (shape) {

View File

@ -53,14 +53,14 @@ public:
protected:
Uint8 R, G, B;
Uint32 color;
uint32 color;
/* flag */
int useFrame;
/* frame color values */
Uint8 fR, fG, fB;
Uint32 frameColor;
uint32 frameColor;
/* remember me */
int frameThickness;

View File

@ -33,11 +33,11 @@ namespace Ultima6 {
/* the check marks bitmap */
//#include "the_checker.h"
SDL_Surface *checkmarks = NULL;
Graphics::ManagedSurface *checkmarks = NULL;
GUI_Button:: GUI_Button(void *data, int x, int y, SDL_Surface *image,
SDL_Surface *image2, GUI_CallBack *callback, bool free_surfaces)
GUI_Button:: GUI_Button(void *data, int x, int y, Graphics::ManagedSurface *image,
Graphics::ManagedSurface *image2, GUI_CallBack *callback, bool free_surfaces)
: GUI_Widget(data, x, y, image->w, image->h) {
callback_object = callback;
@ -151,7 +151,7 @@ void GUI_Button::ChangeTextButton(int x, int y, int w, int h, const char *text,
/* Show the widget */
void GUI_Button:: Display(bool full_redraw) {
SDL_Rect src, dest = area;
Common::Rect src, dest = area;
if (button) {
if ((button2 != NULL) && ((pressed[0]) == 1 || is_highlighted))
@ -210,7 +210,7 @@ void GUI_Button:: Display(bool full_redraw) {
pointer += 6;
break;
case 4:
*((Uint32 *)(pointer)) = (Uint32)pixel;
*((uint32 *)(pointer)) = (uint32)pixel;
pointer += 8;
break;
}
@ -275,23 +275,23 @@ void GUI_Button::Enable(int flag) {
Redraw();
}
SDL_Surface *GUI_Button::CreateTextButtonImage(int style, const char *text, int alignment) {
SDL_Rect fillrect;
Graphics::ManagedSurface *GUI_Button::CreateTextButtonImage(int style, const char *text, int alignment) {
Common::Rect fillrect;
int th, tw;
int tx = 0, ty = 0;
char *duptext = 0;
// SDL_Surface *img=SDL_AllocSurface(SDL_SWSURFACE,area.w,area.h,
// Graphics::ManagedSurface *img=SDL_AllocSurface(SDL_SWSURFACE,area.w,area.h,
// 16,31 << 11,63 << 5,31,0);
SDL_Surface *img = SDL_CreateRGBSurface(SDL_SWSURFACE, area.w, area.h,
Graphics::ManagedSurface *img = SDL_CreateRGBSurface(SDL_SWSURFACE, area.w, area.h,
16, 31 << 11, 63 << 5, 31, 0);
if (img == NULL) return NULL;
Uint32 color1 = SDL_MapRGB(img->format, BL_R, BL_G, BL_B);
Uint32 color2 = SDL_MapRGB(img->format, BS_R, BS_G, BS_B);
Uint32 color3 = SDL_MapRGB(img->format, BF_R, BF_G, BF_B);
Uint32 color4 = SDL_MapRGB(img->format, BI2_R, BI2_G, BI2_B);
uint32 color1 = SDL_MapRGB(img->format, BL_R, BL_G, BL_B);
uint32 color2 = SDL_MapRGB(img->format, BS_R, BS_G, BS_B);
uint32 color3 = SDL_MapRGB(img->format, BF_R, BF_G, BF_B);
uint32 color4 = SDL_MapRGB(img->format, BI2_R, BI2_G, BI2_B);
buttonFont->SetColoring(0, 0, 0);

View File

@ -70,8 +70,8 @@ class GUI_Button : public GUI_Widget {
public:
/* Passed the button data, position, images (pressed/unpressed) and callback */
GUI_Button(void *data, int x, int y, SDL_Surface *image,
SDL_Surface *image2, GUI_CallBack *callback, bool free_surfaces = true);
GUI_Button(void *data, int x, int y, Graphics::ManagedSurface *image,
Graphics::ManagedSurface *image2, GUI_CallBack *callback, bool free_surfaces = true);
/* I don't know what this one is for */
GUI_Button(void *data, int x, int y, int w, int h,
@ -117,13 +117,13 @@ public:
protected:
/* yields an appropriate image */
virtual SDL_Surface *CreateTextButtonImage(int style, const char *text, int alignment);
virtual Graphics::ManagedSurface *CreateTextButtonImage(int style, const char *text, int alignment);
/* The button font */
GUI_Font *buttonFont;
/* The button images */
SDL_Surface *button, *button2;
Graphics::ManagedSurface *button, *button2;
/* The activation callback */
GUI_CallBack *callback_object;

View File

@ -24,7 +24,7 @@
#include <cmath>
#include "ultima/shared/std/string.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "GUI.h"
#include "GUI_widget.h"
#include "GUI_Console.h"
@ -54,7 +54,7 @@ void GUI_Console::SetDisplay(Screen *s) {
/* Show the widget */
void GUI_Console:: Display(bool full_redraw) {
SDL_Rect framerect;
Common::Rect framerect;
framerect = area;

View File

@ -23,7 +23,7 @@
#include <cmath>
#include "ultima/shared/std/string.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "GUI.h"
#include "GUI_Dialog.h"
@ -81,8 +81,8 @@ void GUI_Dialog::SetDisplay(Screen *s) {
void
GUI_Dialog:: Display(bool full_redraw) {
int i;
SDL_Rect framerect;
SDL_Rect src, dst;
Common::Rect framerect;
Common::Rect src, dst;
if (old_x != area.x || old_y != area.y) {
if (backingstore) {

View File

@ -39,14 +39,14 @@ class GUI_Dialog : public GUI_Widget {
int old_x, old_y;
int button_x, button_y;
Uint8 R, G, B;
Uint32 bg_color;
uint32 bg_color;
bool drag;
SDL_Surface *border[8];
Graphics::ManagedSurface *border[8];
unsigned char *backingstore;
SDL_Rect backingstore_rect;
Common::Rect backingstore_rect;
public:
/* Passed the area, color and shape */
GUI_Dialog(int x, int y, int w, int h, Uint8 r, Uint8 g, Uint8 b, bool is_moveable);

View File

@ -22,7 +22,7 @@
#include <stdlib.h>
#include <cmath>
#include <misc/U6misc.h>
#include <misc/ultima/ultima6/misc/u6_misc.h>
#include <misc/SDLUtils.h>
#include "GUI_font.h"
@ -33,7 +33,7 @@ namespace Ultima6 {
/* use default 8x8 font */
GUI_Font::GUI_Font(Uint8 fontType) {
SDL_Surface *temp;
Graphics::ManagedSurface *temp;
w_data = NULL;
@ -70,7 +70,7 @@ GUI_Font::GUI_Font(char *name) {
}
/* use given YxY surface */
GUI_Font::GUI_Font(SDL_Surface *bitmap) {
GUI_Font::GUI_Font(Graphics::ManagedSurface *bitmap) {
if (bitmap == NULL)
fontStore = GUI_DefaultFont();
else
@ -84,7 +84,7 @@ GUI_Font::GUI_Font(SDL_Surface *bitmap) {
/* copy constructor */
GUI_Font::GUI_Font(GUI_Font &font) {
SDL_Surface *temp = font.fontStore;
Graphics::ManagedSurface *temp = font.fontStore;
fontStore = SDL_ConvertSurface(temp, temp->format, SDL_SWSURFACE);
charh = fontStore->h / 16;
charw = fontStore->w / 16;
@ -118,12 +118,12 @@ void GUI_Font::SetColoring(Uint8 fr, Uint8 fg, Uint8 fb, Uint8 fr1, Uint8 fg1, U
}
/* put the text onto the given surface using the preset mode and colors */
void GUI_Font::TextOut(SDL_Surface *context, int x, int y, const char *text, int line_wrap) {
void GUI_Font::TextOut(Graphics::ManagedSurface *context, int x, int y, const char *text, int line_wrap) {
int i;
int j;
Uint8 ch;
SDL_Rect src;
SDL_Rect dst;
Common::Rect src;
Common::Rect dst;
src.w = charw;
src.h = charh - 1;

View File

@ -44,7 +44,7 @@ public:
GUI_Font(char *name);
/* use given YxY surface */
GUI_Font(SDL_Surface *bitmap);
GUI_Font(Graphics::ManagedSurface *bitmap);
/* copy constructor */
GUI_Font(GUI_Font &font);
@ -70,7 +70,7 @@ public:
}
/* put the text onto the given surface using the preset mode and colors */
virtual void TextOut(SDL_Surface *context, int x, int y, const char *text, int line_wrap = 0);
virtual void TextOut(Graphics::ManagedSurface *context, int x, int y, const char *text, int line_wrap = 0);
/* yields pixel width and height of a string when printed with this font */
void TextExtent(const char *text, int *w, int *h, int line_wrap = 0);
@ -80,7 +80,7 @@ public:
protected:
/* the font source surface */
SDL_Surface *fontStore;
Graphics::ManagedSurface *fontStore;
/* flags */
int transparent;

View File

@ -33,8 +33,8 @@ namespace Ultima6 {
/* */
/************************************************************************/
SDL_Surface *GUI_LoadImage(int w, int h, Uint8 *pal, Uint8 *data) {
SDL_Surface *image;
Graphics::ManagedSurface *GUI_LoadImage(int w, int h, Uint8 *pal, Uint8 *data) {
Graphics::ManagedSurface *image;
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8, 0, 0, 0, 0);
if (image) {
@ -59,25 +59,25 @@ SDL_Surface *GUI_LoadImage(int w, int h, Uint8 *pal, Uint8 *data) {
#include "the_font.h"
static SDL_Surface *the_font = NULL;
static SDL_Surface *the_font_6x8 = NULL;
static SDL_Surface *the_font_gump = NULL;
static Graphics::ManagedSurface *the_font = NULL;
static Graphics::ManagedSurface *the_font_6x8 = NULL;
static Graphics::ManagedSurface *the_font_gump = NULL;
SDL_Surface *GUI_DefaultFont(void) {
Graphics::ManagedSurface *GUI_DefaultFont(void) {
if (the_font == NULL) {
the_font = GUI_LoadImage(font_w, font_h, font_pal, font_data);
}
return (the_font);
}
SDL_Surface *GUI_Font6x8(void) {
Graphics::ManagedSurface *GUI_Font6x8(void) {
if (the_font_6x8 == NULL) {
the_font_6x8 = GUI_LoadImage(font_6x8_w, font_6x8_h, font_pal, font_6x8_data);
}
return (the_font_6x8);
}
SDL_Surface *GUI_FontGump(void) {
Graphics::ManagedSurface *GUI_FontGump(void) {
if (the_font_gump == NULL) {
the_font_gump = GUI_LoadImage(font_gump_w, font_gump_h, font_pal, font_gump_data);
}

View File

@ -35,14 +35,14 @@ namespace Ultima6 {
*/
/************************************************************************/
extern SDL_Surface *GUI_LoadImage(int w, int h, Uint8 *pal, Uint8 *data);
extern Graphics::ManagedSurface *GUI_LoadImage(int w, int h, Uint8 *pal, Uint8 *data);
/* Load the internal 8x8 font and return the associated font surface */
extern SDL_Surface *GUI_DefaultFont(void);
extern Graphics::ManagedSurface *GUI_DefaultFont(void);
extern SDL_Surface *GUI_Font6x8(void);
extern Graphics::ManagedSurface *GUI_Font6x8(void);
extern SDL_Surface *GUI_FontGump(void);
extern Graphics::ManagedSurface *GUI_FontGump(void);
extern Uint8 *GUI_FontGumpWData(void);

View File

@ -23,7 +23,7 @@
#include <cmath>
#include "ultima/shared/std/string.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "GUI.h"
#include "GUI_button.h"
#include "GUI_ScrollBar.h"
@ -71,7 +71,7 @@ GUI_ScrollBar::GUI_ScrollBar(int x, int y, int h, GUI_CallBack *callback)
void GUI_ScrollBar::loadButtons() {
std::string datadir = GUI::get_gui()->get_data_dir();
std::string imagefile;
SDL_Surface *image, *image1;
Graphics::ManagedSurface *image, *image1;
build_path(datadir, "ScrollBarUp_1.bmp", imagefile);
image = SDL_LoadBMP(imagefile.c_str());
@ -117,8 +117,8 @@ void GUI_ScrollBar::set_slider_position(float percentage) {
/* Show the widget */
void GUI_ScrollBar::Display(bool full_redraw) {
SDL_Rect framerect;
// SDL_Rect src, dst;
Common::Rect framerect;
// Common::Rect src, dst;
if (slider_y > 0) {
framerect.x = area.x;
@ -186,7 +186,7 @@ void GUI_ScrollBar::Display(bool full_redraw) {
}
inline void GUI_ScrollBar::DisplaySlider() {
SDL_Rect rect;
Common::Rect rect;
rect.x = area.x;
rect.y = area.y + button_height + slider_y;

View File

@ -23,7 +23,7 @@
#include <cmath>
#include "ultima/shared/std/string.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "GUI.h"
#include "GUI_widget.h"
#include "GUI_ScrollBar.h"
@ -103,7 +103,7 @@ void GUI_Scroller::update_viewport(bool update_slider) {
/* Show the widget */
void GUI_Scroller:: Display(bool full_redraw) {
SDL_Rect framerect;
Common::Rect framerect;
framerect = area;
framerect.w -= SCROLLBAR_WIDTH;

View File

@ -36,7 +36,7 @@ class GUI_ScrollBar;
class GUI_Scroller : public GUI_Widget {
Uint8 R, G, B;
Uint32 bg_color;
uint32 bg_color;
uint16 row_height;
uint16 rows_per_page;
uint16 num_rows;

View File

@ -282,7 +282,7 @@ void GUI_TextInput::SetDisplay(Screen *s) {
/* Show the widget */
void GUI_TextInput:: Display(bool full_redraw) {
SDL_Rect r;
Common::Rect r;
if (full_redraw && focused) {
r = area;
@ -297,7 +297,7 @@ void GUI_TextInput:: Display(bool full_redraw) {
}
void GUI_TextInput::display_cursor() {
SDL_Rect r;
Common::Rect r;
uint16 x, y;
uint16 cw, ch;

View File

@ -41,8 +41,8 @@ protected:
GUI_CallBack *callback_object;
Uint32 cursor_color;
Uint32 selected_bgcolor;
uint32 cursor_color;
uint32 selected_bgcolor;
public:

View File

@ -36,13 +36,13 @@ public:
/* Load an image from a BMP file */
GUI_image(char *file);
/* Use a SDL_Surface as the image
/* Use a Graphics::ManagedSurface as the image
The surface shouldn't be freed while the miage object exists.
*/
GUI_image(SDL_Surface *picture, int shouldfree = 0);
GUI_image(Graphics::ManagedSurface *picture, int shouldfree = 0);
private:
SDL_Surface *image;
Graphics::ManagedSurface *image;
};
class GUI_Color {
@ -67,7 +67,7 @@ public:
r = g = b = 0;
sdl_color = 0;
};
void map_color(SDL_Surface *surface) {
void map_color(Graphics::ManagedSurface *surface) {
sdl_color = SDL_MapRGB(surface->format, r, g, b);
};

View File

@ -197,7 +197,7 @@ GUI_Widget:: SetRect(int x, int y, int w, int h) {
}
}
void
GUI_Widget:: SetRect(SDL_Rect **bounds) {
GUI_Widget:: SetRect(Common::Rect **bounds) {
int minx, maxx;
int miny, maxy;
int i, v;
@ -235,7 +235,7 @@ int GUI_Widget::HitRect(int x, int y) {
return (HitRect(x, y, area));
}
int GUI_Widget::HitRect(int x, int y, SDL_Rect &rect) {
int GUI_Widget::HitRect(int x, int y, Common::Rect &rect) {
int hit;
hit = 1;

View File

@ -49,7 +49,7 @@ protected:
Screen *screen;
/* The display surface for the widget */
SDL_Surface *surface;
Graphics::ManagedSurface *surface;
int offset_x, offset_y; /* original offsets to parent */
@ -85,7 +85,7 @@ protected:
public:
/* The area covered by the widget */
SDL_Rect area;
Common::Rect area;
GUI_Widget(void *data);
GUI_Widget(void *data, int x, int y, int w, int h);
@ -119,10 +119,10 @@ public:
If 'w' or 'h' is -1, that parameter will not be changed.
*/
virtual void SetRect(int x, int y, int w, int h);
virtual void SetRect(SDL_Rect **bounds);
virtual void SetRect(Common::Rect **bounds);
/* Return the whole area */
virtual SDL_Rect GetRect() {
virtual Common::Rect GetRect() {
return area;
}
@ -143,7 +143,7 @@ public:
/* Check to see if a point intersects the bounds of the widget.
*/
virtual int HitRect(int x, int y);
virtual int HitRect(int x, int y, SDL_Rect &rect);
virtual int HitRect(int x, int y, Common::Rect &rect);
/* Set the display surface for this widget */
virtual void SetDisplay(Screen *s);

View File

@ -40,7 +40,7 @@
#include "SoundManager.h"
#include "Background.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -33,7 +33,7 @@
#include "Utils.h"
#include "MsgScroll.h"
#include "ultima/ultima6/conf/configuration.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Console.h"
#include "Effect.h"

View File

@ -38,7 +38,7 @@
typedef enum { AXES_PAIR1, AXES_PAIR2, AXES_PAIR3, AXES_PAIR4, UNHANDLED_AXES_PAIR } joy_axes_pairs;
#endif
#include <vector>
#include "ultima/shared/std/containers.h"
#include <map>
#include "ultima/shared/std/string.h"

View File

@ -38,7 +38,7 @@
#include "Keys.h"
#include "Party.h"
#include "Converse.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include <math.h>
namespace Ultima {

View File

@ -34,7 +34,7 @@
#include "GUI_Dialog.h"
#include "CheatsDialog.h"
#include "EggManager.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Converse.h"
#include "ObjManager.h"
#include "MapWindow.h"

View File

@ -35,7 +35,7 @@
#include "GameplayDialog.h"
#include "Party.h"
#include "Script.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Converse.h"
#include "ConverseGump.h"
#include "ultima/ultima6/conf/configuration.h"

View File

@ -39,7 +39,7 @@
#include "PartyView.h"
#include "ViewManager.h"
#include "CommandBarNewUI.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Keys.h"
namespace Ultima {

View File

@ -30,7 +30,7 @@
#include "GUI_TextToggleButton.h"
#include "GUI_CallBack.h"
#include "GUI_area.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "Dither.h"
#include "Scale.h"
#include "Screen.h"

View File

@ -24,8 +24,7 @@
#define ULTIMA6_MISC_ACTOR_LIST_H
// include this if using ActorList
#include <vector>
#include <algorithm>
#include "ultima/shared/std/containers.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -23,7 +23,7 @@
#ifndef ULTIMA6_MISC_CALLBACK_H
#define ULTIMA6_MISC_CALLBACK_H
#include <cstdio>
#include "ultima/ultima6/core/nuvie_defs.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -20,8 +20,8 @@
*
*/
#include <stdlib.h>
#include "iAVLTree.h"
#include "ultima/ultima6/misc/iavl_tree.h"
#include "ultima/ultima6/core/nuvie_defs.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -23,6 +23,8 @@
#ifndef ULTIMA6_MISC_MAP_ENTITY_H
#define ULTIMA6_MISC_MAP_ENTITY_H
#include "ultima/ultima6/core/nuvie_defs.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -20,7 +20,7 @@
*
*/
#include "U6LineWalker.h"
#include "ultima/ultima6/misc/u6_line_walker.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -21,8 +21,7 @@
*/
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6LList.h"
#include "ultima/ultima6/misc/u6_llist.h"
namespace Ultima {
namespace Ultima6 {

View File

@ -20,18 +20,14 @@
*
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <vector>
#include "ultima/shared/std/containers.h"
#include "ultima/shared/std/misc.h"
#include "ultima/ultima6/core/nuvie_defs.h"
#include "U6misc.h"
#include "ultima/ultima6/misc/u6_misc.h"
#include "ultima/ultima6/conf/configuration.h"
#include "common/file.h"
#include "common/fs.h"
#include "common/str.h"
namespace Ultima {
namespace Ultima6 {
@ -42,8 +38,7 @@ bool find_casesensitive_path(std::string path, std::string filename, std::string
bool find_path(std::string path, std::string &dir_str);
void Tokenise(const std::string &str, std::vector<std::string> &tokens, char delimiter = ' ') {
std::string delimiters = string();
delimiters = delimiter;
std::string delimiters(delimiter);
// Skip delimiters at beginning.
string::size_type lastPos = str.find_first_not_of(delimiters, 0);
@ -95,18 +90,7 @@ void config_get_path(Configuration *config, std::string filename, std::string &p
tmp_path = game_dir + filename;
struct stat s;
if (stat(tmp_path.c_str(), &s) == 0) {
path = tmp_path;
return;
}
find_casesensitive_path(game_dir, filename, tmp_path);
path = tmp_path;
return;
}
bool find_casesensitive_path(std::string path, std::string filename, std::string &new_path) {
@ -120,7 +104,7 @@ bool find_casesensitive_path(std::string path, std::string filename, std::string
for (dir_iter = directories.begin(); dir_iter != directories.end();) {
string dir = *dir_iter;
printf("%s, ", dir.c_str());
::debug("%s, ", dir.c_str());
if (find_path(tmp_path, dir) == false)
return false;
@ -135,11 +119,14 @@ bool find_casesensitive_path(std::string path, std::string filename, std::string
new_path = tmp_path;
printf("\nproper path = %s\n", new_path.c_str());
::debug("\nproper path = %s", new_path.c_str());
return true;
}
bool find_path(std::string path, std::string &dir_str) {
dir_str = path;
return true;
#if 0
DIR *dir;
struct dirent *item;
@ -148,14 +135,15 @@ bool find_path(std::string path, std::string &dir_str) {
return false;
for (item = readdir(dir); item != NULL; item = readdir(dir)) {
printf("trying %s, want %s\n", item->d_name, dir_str.c_str());
if (strlen(item->d_name) == dir_str.length() && strcasecmp(item->d_name, dir_str.c_str()) == 0) {
debug("trying %s, want %s\n", item->d_name, dir_str.c_str());
if (strlen(item->d_name) == dir_str.length() && Common::scumm_stricmp(item->d_name, dir_str.c_str()) == 0) {
dir_str = item->d_name;
return true;
}
}
return false;
#endif
}
void stringToUpper(std::string &str) {
@ -171,6 +159,7 @@ void stringToLower(std::string &str) {
}
int mkdir_recursive(std::string path, int mode) {
#ifdef TODO
vector<string> directories;
string tmp_path;
@ -184,7 +173,7 @@ int mkdir_recursive(std::string path, int mode) {
for (dir_iter = directories.begin(); dir_iter != directories.end();) {
string dir = *dir_iter;
printf("%s, ", dir.c_str());
debug("%s, ", dir.c_str());
tmp_path += dir;
tmp_path += U6PATH_DELIMITER;
@ -201,6 +190,9 @@ int mkdir_recursive(std::string path, int mode) {
}
return 0;
#else
error("TODO");
#endif
}
//return the uint8 game_type from a char string
@ -245,24 +237,12 @@ bool has_fmtowns_support(Configuration *config) {
}
bool directory_exists(const char *directory) {
struct stat sb;
if (stat(directory, &sb) != 0)
return false;
if (!(sb.st_mode | S_IFDIR))
return false;
return true;
Common::FSNode dir(directory);
return dir.exists();
}
bool file_exists(const char *path) {
FILE *f = fopen(path, "rb");
if (f == NULL)
return false;
fclose(f);
return true;
return Common::File::exists(path);
}
void print_b(DebugLevelType level, uint8 num) {
@ -323,26 +303,26 @@ void print_flags(DebugLevelType level, uint8 num, const char *f[8]) {
/* Where rect1 and rect2 merge, subtract and copy that rect to sub_rect.
* Returns false if the rectangles don't intersect.
*/
bool subtract_rect(SDL_Rect *rect1, SDL_Rect *rect2, SDL_Rect *sub_rect) {
uint16 rect1_x2 = rect1->x + rect1->w, rect1_y2 = rect1->y + rect1->h;
uint16 rect2_x2 = rect2->x + rect2->w, rect2_y2 = rect2->y + rect2->h;
bool subtract_rect(Common::Rect *rect1, Common::Rect *rect2, Common::Rect *sub_rect) {
uint16 rect1_x2 = rect1->right, rect1_y2 = rect1->bottom;
uint16 rect2_x2 = rect2->right, rect2_y2 = rect2->bottom;
uint16 x1, x2, y1, y2;
if (line_in_rect(rect1->x, rect1->y, rect1_x2, rect1->y, rect2)
|| line_in_rect(rect1_x2, rect1->y, rect1_x2, rect1_y2, rect2)
|| line_in_rect(rect1->x, rect1->y, rect1->x, rect1_y2, rect2)
|| line_in_rect(rect1->x, rect1_y2, rect1_x2, rect1_y2, rect2)) {
x1 = rect2->x >= rect1->x ? rect2->x : rect1->x;
y1 = rect2->y >= rect1->y ? rect2->y : rect1->y;
if (line_in_rect(rect1->left, rect1->top, rect1_x2, rect1->top, rect2)
|| line_in_rect(rect1_x2, rect1->top, rect1_x2, rect1_y2, rect2)
|| line_in_rect(rect1->left, rect1->top, rect1->left, rect1_y2, rect2)
|| line_in_rect(rect1->left, rect1_y2, rect1_x2, rect1_y2, rect2)) {
x1 = rect2->left >= rect1->left ? rect2->left : rect1->left;
y1 = rect2->top >= rect1->top ? rect2->top : rect1->top;
x2 = rect2_x2 <= rect1_x2 ? rect2_x2 : rect1_x2;
y2 = rect2_y2 <= rect1_y2 ? rect2_y2 : rect1_y2;
} else
return (false);
if (sub_rect) { // you can perform test without returning a subtraction
sub_rect->x = x1;
sub_rect->y = y1;
sub_rect->w = x2 - x1;
sub_rect->h = y2 - y1;
sub_rect->left = x1;
sub_rect->top = y1;
sub_rect->setWidth(x2 - x1);
sub_rect->setHeight(y2 - y1);
}
return (true);
}
@ -684,7 +664,7 @@ void draw_line_8bit(int sx, int sy, int ex, int ey, uint8 col, uint8 *pixels, ui
}
bool string_i_compare(const std::string &s1, const std::string &s2) {
return strcasecmp(s1.c_str(), s2.c_str()) == 0;
return scumm_stricmp(s1.c_str(), s2.c_str()) == 0;
}
void *nuvie_realloc(void *ptr, size_t size) {
@ -695,10 +675,10 @@ void *nuvie_realloc(void *ptr, size_t size) {
}
Uint32 sdl_getpixel(SDL_Surface *surface, int x, int y) {
int bpp = surface->format->BytesPerPixel;
uint32 sdl_getpixel(Graphics::ManagedSurface *surface, int x, int y) {
int bpp = surface->format.bytesPerPixel;
/* Here p is the address to the pixel we want to retrieve */
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp;
byte *p = (byte *)surface->getBasePtr(x, y);
switch (bpp) {
case 1:
@ -706,18 +686,15 @@ Uint32 sdl_getpixel(SDL_Surface *surface, int x, int y) {
break;
case 2:
return *(Uint16 *)p;
return *(uint16 *)p;
break;
case 3:
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
return p[0] << 16 | p[1] << 8 | p[2];
else
return p[0] | p[1] << 8 | p[2] << 16;
error("TODO: RGB24 unsupported");
break;
case 4:
return *(Uint32 *)p;
return *(uint32 *)p;
break;
default:
@ -770,7 +747,8 @@ void scale_rect_8bit(unsigned char *Source, unsigned char *Target, int SrcWidth,
}
bool has_file_extension(const char *filename, const char *extension) {
if (strlen(filename) > strlen(extension) && strcasecmp((const char *)&filename[strlen(filename) - 4], extension) == 0)
if (strlen(filename) > strlen(extension) &&
scumm_stricmp((const char *)&filename[strlen(filename) - 4], extension) == 0)
return true;
return false;

Some files were not shown because too many files have changed in this diff Show More