[Scummvm-git-logs] scummvm master -> 684bc09dc0a76e16c9692b2e29ac3ba1262d52fa
dreammaster
paulfgilbert at gmail.com
Wed May 20 01:13:34 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d8b206db2b NUVIE: Properly handle ifdef blocks for SDL2
684bc09dc0 NUVIE: Make all debug calls level 1 so they won't print out by default
Commit: d8b206db2bd6e93983636d47dd9cf30444e64c6f
https://github.com/scummvm/scummvm/commit/d8b206db2bd6e93983636d47dd9cf30444e64c6f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-19T18:10:54-07:00
Commit Message:
NUVIE: Properly handle ifdef blocks for SDL2
Changed paths:
engines/ultima/nuvie/core/game.cpp
engines/ultima/nuvie/gui/gui.cpp
engines/ultima/nuvie/gui/widgets/gui_widget.cpp
engines/ultima/nuvie/misc/sdl_compat.h
engines/ultima/nuvie/screen/screen.cpp
engines/ultima/nuvie/screen/screen.h
engines/ultima/nuvie/script/script.cpp
engines/ultima/nuvie/views/actor_view.cpp
engines/ultima/nuvie/views/inventory_view.cpp
engines/ultima/nuvie/views/inventory_widget.cpp
engines/ultima/nuvie/views/party_view.cpp
diff --git a/engines/ultima/nuvie/core/game.cpp b/engines/ultima/nuvie/core/game.cpp
index d1f682e77b..e74040a5e6 100644
--- a/engines/ultima/nuvie/core/game.cpp
+++ b/engines/ultima/nuvie/core/game.cpp
@@ -632,10 +632,6 @@ void Game::play() {
screen->update();
//map_window->drawMap();
-//if !SDL_VERSION_ATLEAST(2, 0, 0)
-#if 0
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY / 2, SDL_DEFAULT_REPEAT_INTERVAL);
-#endif
map_window->updateBlacking();
diff --git a/engines/ultima/nuvie/gui/gui.cpp b/engines/ultima/nuvie/gui/gui.cpp
index 6dda003913..40375515e3 100644
--- a/engines/ultima/nuvie/gui/gui.cpp
+++ b/engines/ultima/nuvie/gui/gui.cpp
@@ -239,17 +239,6 @@ GUI_status GUI:: HandleEvent(Common::Event *event) {
}
}
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- if (event->type == SDL_MOUSEBUTTONDOWN || event->type == SDL_MOUSEBUTTONUP) {
- SDL_GetMouseState(&event->mouse.x, &event->mouse.y);
- screen->scale_sdl_window_coords(&event->mouse.x, &event->mouse.y);
- }
- if (event->type == SDL_MOUSEMOTION) {
- SDL_GetMouseState(&event->motion.x, &event->motion.y);
- screen->scale_sdl_window_coords(&event->motion.x, &event->motion.y);
- }
-#endif
-
if (dragging) { //&& !block_input)
if (Shared::isMouseUpEvent(event->type)) { //FIX for button up that doesn't hit a widget.
for (hit = false, i = numwidgets - 1; (i >= 0) && (hit == false); --i) {
diff --git a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
index b80b8dec40..ccf319306b 100644
--- a/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
+++ b/engines/ultima/nuvie/gui/widgets/gui_widget.cpp
@@ -373,14 +373,12 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
button = Shared::whichButton(event->type);
if (focused || HitRect(x, y)) {
set_mousedown(SDL_GetTicks(), button);
-
-//if !SDL_VERSION_ATLEAST(2, 0, 0)
-#if 0
- if (button == SDL_BUTTON_WHEELUP)
+
+ if (button == Common::EVENT_WHEELUP)
return MouseWheel(0, 1);
- else if (button == SDL_BUTTON_WHEELDOWN)
+ else if (button == Common::EVENT_WHEELDOWN)
return MouseWheel(0, -1);
-#endif
+
return(MouseDown(x, y, button));
}
break;
@@ -439,11 +437,13 @@ GUI_status GUI_Widget::HandleEvent(const Common::Event *event) {
}
}
break;
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- case SDL_MOUSEWHEEL: {
- return MouseWheel(event->wheel.x, event->wheel.y);
- }
-#endif
+
+ case Common::EVENT_WHEELUP:
+ return MouseWheel(0, 1);
+
+ case Common::EVENT_WHEELDOWN:
+ return MouseWheel(0, -1);
+
default: {
/* Pass it along.. */;
}
diff --git a/engines/ultima/nuvie/misc/sdl_compat.h b/engines/ultima/nuvie/misc/sdl_compat.h
index db04aa2d1e..f2ccf03d4f 100644
--- a/engines/ultima/nuvie/misc/sdl_compat.h
+++ b/engines/ultima/nuvie/misc/sdl_compat.h
@@ -33,7 +33,6 @@ namespace Nuvie {
#define SDL_FALSE 0
#define SDL_SWSURFACE 0
-#define SDL_VERSION_ATLEAST(A, B, C) false
typedef uint32 SDL_Color;
#define MAKE_COLOR(r, g, b) (((uint32)r) | (((uint32)g) << 8) | (((uint32)b) << 16) | (((uint32)0xff) << 24))
diff --git a/engines/ultima/nuvie/screen/screen.cpp b/engines/ultima/nuvie/screen/screen.cpp
index 17474dc8a4..651c3e5a4d 100644
--- a/engines/ultima/nuvie/screen/screen.cpp
+++ b/engines/ultima/nuvie/screen/screen.cpp
@@ -115,11 +115,6 @@ bool Screen::init() {
set_screen_mode();
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- SDL_SetRenderDrawColor(sdlRenderer, 0, 0, 0, 255);
- SDL_RenderClear(sdlRenderer);
- SDL_RenderPresent(sdlRenderer);
-#endif
return true;
}
@@ -1232,25 +1227,10 @@ bool Screen::initScaler() {
return true;
}
-#if SDL_VERSION_ATLEAST(2, 0, 0)
-bool Screen::SDL_VideoModeOK(int scaled_width, int scaled_height, int bpp, int flags) {
- return (bpp == get_screen_bpp());
-}
-#endif
-
int Screen::get_screen_bpp() {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- SDL_DisplayMode mode;
- if (SDL_GetDisplayMode(0, 0, &mode) != 0) {
- return 0;
- }
-
- return SDL_BITSPERPIXEL(mode.format);
-#else
// Get info. about video.
Graphics::PixelFormat pf = g_system->getScreenFormat();
return pf.bpp();
-#endif
}
void Screen::set_screen_mode() {
@@ -1266,42 +1246,13 @@ void Screen::set_screen_mode() {
}
bool Screen::toggle_fullscreen() {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- return set_fullscreen(!fullscreen);
-#else
- return sdl1_toggle_fullscreen();
-#endif
-}
-
-#if !SDL_VERSION_ATLEAST(2, 0, 0)
-bool Screen::sdl1_toggle_fullscreen() {
- return false;
+ // No implementation
+ return true;
}
-#endif
bool Screen::set_fullscreen(bool value) {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- fullscreen = value;
- uint32 windowFlags = SDL_GetWindowFlags(sdlWindow);
-
- if (fullscreen)
- windowFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
- else if ((windowFlags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)
- windowFlags ^= SDL_WINDOW_FULLSCREEN_DESKTOP;
-
- if (SDL_SetWindowFullscreen(sdlWindow, windowFlags) < 0) {
- DEBUG(0, LEVEL_NOTIFICATION, "error toggling fullscreen mode %s\n", SDL_GetError());
- return false;
- }
-#ifdef WIN32
- if (!fullscreen) {
- SDL_SetWindowSize(sdlWindow, (int)(width * window_scale_w), (int)(height * window_scale_h));
- }
-#endif
- return true;
-#else
+ // No implementation
return false;
-#endif
}
//Note! assumes area divides evenly by down_scale factor
@@ -1603,53 +1554,8 @@ void Screen::get_mouse_location(int *x, int *y) {
*y = pt.y;
}
-#if SDL_VERSION_ATLEAST(2, 0, 0)
-void Screen::scale_sdl_window_coords(sint32 *mx, sint32 *my) {
- if (fullscreen) {
- float sx, sy;
- SDL_RenderGetScale(sdlRenderer, &sx, &sy);
-
- Common::Rect viewport;
- SDL_RenderGetViewport(sdlRenderer, &viewport);
-
- *mx = *mx - (sint32)((float)viewport.left * sx);
-
- sx = ((float)viewport.width() / width) * sx;
- sy = ((float)viewport.height() / height) * sy;
-
- *mx = (sint32)((float) * mx / sx) ;
- *my = (sint32)((float) * my / sy) ;
- } else {
- sint32 w, h;
- SDL_RenderGetLogicalSize(sdlRenderer, &w, &h);
-
- w = w / width;
- h = h / height;
-
- *mx = (sint32)((float) * mx / window_scale_w);
- *my = (sint32)((float) * my / window_scale_h);
- }
-}
-#endif
-
void Screen::set_non_square_pixels(bool value) {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- if (value == non_square_pixels)
- return;
-
- non_square_pixels = value;
-
- if (non_square_pixels)
- window_scale_h *= 1.2;
- else
- window_scale_h /= 1.2;
-
- int sw = (int)(width * window_scale_w);
- int sh = (int)(height * window_scale_h);
-
- SDL_RenderSetLogicalSize(sdlRenderer, sw, sh); //VGA non-square pixels.
- SDL_SetWindowSize(sdlWindow, sw, sh);
-#endif
+ // No implementation
}
} // End of namespace Nuvie
diff --git a/engines/ultima/nuvie/screen/screen.h b/engines/ultima/nuvie/screen/screen.h
index 58244ccca0..9568057244 100644
--- a/engines/ultima/nuvie/screen/screen.h
+++ b/engines/ultima/nuvie/screen/screen.h
@@ -153,10 +153,6 @@ public:
void get_mouse_location(int *x, int *y);
-#if SDL_VERSION_ATLEAST(2, 0, 0)
- void scale_sdl_window_coords(sint32 *x, sint32 *y);
-#endif
-
void set_non_square_pixels(bool value);
protected:
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index b24ed7e28f..b2adf2de9e 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -942,10 +942,6 @@ bool Script::play_cutscene(const char *script_file) {
script_file_path += script_file;
ConsoleHide();
-//if !SDL_VERSION_ATLEAST(2, 0, 0)
-#if 0
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY / 2, SDL_DEFAULT_REPEAT_INTERVAL * 2);
-#endif
return run_lua_file(script_file_path.c_str());
}
diff --git a/engines/ultima/nuvie/views/actor_view.cpp b/engines/ultima/nuvie/views/actor_view.cpp
index 4679055374..f12a6889ae 100644
--- a/engines/ultima/nuvie/views/actor_view.cpp
+++ b/engines/ultima/nuvie/views/actor_view.cpp
@@ -259,7 +259,6 @@ void ActorView::display_actor_stats() {
}
GUI_status ActorView::MouseWheel(sint32 x, sint32 y) {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
int xpos, ypos;
screen->get_mouse_location(&xpos, &ypos);
@@ -267,7 +266,7 @@ GUI_status ActorView::MouseWheel(sint32 x, sint32 y) {
ypos -= area.top;
if (xpos < 0 || ypos > area.top + area.height() - 7)
return GUI_PASS; // goes to MsgScroll
-#endif
+
if (y > 0) {
View::callback(BUTTON_CB, left_button, Game::get_game()->get_view_manager());
} else if (y < 0) {
diff --git a/engines/ultima/nuvie/views/inventory_view.cpp b/engines/ultima/nuvie/views/inventory_view.cpp
index 9c87d2ad66..4a57adc1f7 100644
--- a/engines/ultima/nuvie/views/inventory_view.cpp
+++ b/engines/ultima/nuvie/views/inventory_view.cpp
@@ -656,11 +656,8 @@ GUI_status InventoryView::MouseWheel(sint32 x, sint32 y) {
xpos -= area.left;
ypos -= area.top;
-#if SDL_VERSION_ATLEAST(2, 0, 0)
bool wheel_range = (xpos >= 0 && ypos < area.top + area.height() - 6);
-#else
- bool wheel_range = (xpos < 64 || ypos > 78);
-#endif
+
if (y > 0 && wheel_range) {
View::callback(BUTTON_CB, left_button, Game::get_game()->get_view_manager());
return GUI_YUM;
diff --git a/engines/ultima/nuvie/views/inventory_widget.cpp b/engines/ultima/nuvie/views/inventory_widget.cpp
index b83485cae0..c69897a568 100644
--- a/engines/ultima/nuvie/views/inventory_widget.cpp
+++ b/engines/ultima/nuvie/views/inventory_widget.cpp
@@ -357,7 +357,6 @@ Obj *InventoryWidget::get_obj_at_location(int x, int y) {
}
GUI_status InventoryWidget::MouseWheel(sint32 x, sint32 y) {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
int xpos, ypos;
screen->get_mouse_location(&xpos, &ypos);
@@ -365,7 +364,7 @@ GUI_status InventoryWidget::MouseWheel(sint32 x, sint32 y) {
ypos -= area.top;
if (xpos < 0 || ypos > area.top + area.height() - 10)
return GUI_PASS; // goes to InventoryView
-#endif
+
if (Game::get_game()->get_game_type() == NUVIE_GAME_U6) {
if (y > 0) {
up_arrow();
diff --git a/engines/ultima/nuvie/views/party_view.cpp b/engines/ultima/nuvie/views/party_view.cpp
index a5b5276171..a522e09163 100644
--- a/engines/ultima/nuvie/views/party_view.cpp
+++ b/engines/ultima/nuvie/views/party_view.cpp
@@ -83,7 +83,6 @@ bool PartyView::init(void *vm, uint16 x, uint16 y, Font *f, Party *p, Player *pl
}
GUI_status PartyView::MouseWheel(sint32 x, sint32 y) {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
int xpos, ypos;
screen->get_mouse_location(&xpos, &ypos);
@@ -91,7 +90,7 @@ GUI_status PartyView::MouseWheel(sint32 x, sint32 y) {
ypos -= area.top;
if (xpos < 0 || ypos > area.top + area.height() - 6)
return GUI_PASS; // goes to MsgScrollw
-#endif
+
if (y > 0) {
if (up_arrow())
Redraw();
Commit: 684bc09dc0a76e16c9692b2e29ac3ba1262d52fa
https://github.com/scummvm/scummvm/commit/684bc09dc0a76e16c9692b2e29ac3ba1262d52fa
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-19T18:10:54-07:00
Commit Message:
NUVIE: Make all debug calls level 1 so they won't print out by default
Changed paths:
engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
engines/ultima/nuvie/misc/u6_misc.cpp
engines/ultima/nuvie/script/script.cpp
diff --git a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
index 292a18cc3d..3cfd34ca17 100644
--- a/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
+++ b/engines/ultima/nuvie/gui/widgets/msg_scroll.cpp
@@ -377,7 +377,7 @@ void MsgScroll::display_string(Std::string s, Font *f, uint8 color, bool include
msg_text = new MsgText(s, f);
msg_text->color = color;
- //::debug("%s", msg_text->s.c_str());
+ //::debug(1, "%s", msg_text->s.c_str());
holding_buffer.push_back(msg_text);
@@ -1082,7 +1082,7 @@ Std::string MsgScroll::get_input() {
if (input_mode == false) {
s.assign(input_buf);
}
- //::debug("%s", s.c_str());
+ //::debug(1, "%s", s.c_str());
return s;
}
diff --git a/engines/ultima/nuvie/misc/u6_misc.cpp b/engines/ultima/nuvie/misc/u6_misc.cpp
index a8d0ea41c1..bb0f469970 100644
--- a/engines/ultima/nuvie/misc/u6_misc.cpp
+++ b/engines/ultima/nuvie/misc/u6_misc.cpp
@@ -104,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;
- ::debug("%s, ", dir.c_str());
+ ::debug(1, "%s, ", dir.c_str());
if (find_path(tmp_path, dir) == false)
return false;
@@ -119,7 +119,7 @@ bool find_casesensitive_path(Std::string path, Std::string filename, Std::string
new_path = tmp_path;
- ::debug("\nproper path = %s", new_path.c_str());
+ ::debug(1, "\nproper path = %s", new_path.c_str());
return true;
}
diff --git a/engines/ultima/nuvie/script/script.cpp b/engines/ultima/nuvie/script/script.cpp
index b2adf2de9e..d23f61397e 100644
--- a/engines/ultima/nuvie/script/script.cpp
+++ b/engines/ultima/nuvie/script/script.cpp
@@ -1268,7 +1268,7 @@ bool Script::call_magic_get_spell_list(Spell **spell_list) {
lua_gettable(L, -2);
if (!lua_istable(L, -1)) { //we've hit the end of our targets
- ::debug("end = %d", i);
+ ::debug(1, "end = %d", i);
lua_pop(L, 1);
break;
}
@@ -1285,7 +1285,7 @@ bool Script::call_magic_get_spell_list(Spell **spell_list) {
if (num < 256 && spell_list[num] == NULL) {
spell_list[num] = new Spell((uint8)num, (const char *)name, (const char *)invocation, re);
- ::debug("num = %d, reagents = %d, name = %s invocation = %s\n", num, re, name, invocation);
+ ::debug(1, "num = %d, reagents = %d, name = %s invocation = %s\n", num, re, name, invocation);
}
lua_pop(L, 1);
@@ -2266,7 +2266,7 @@ static int nscript_u6link_gc(lua_State *L) {
releaseU6Link(link);
- ::debug("U6Link garbage collector!!");
+ ::debug(1, "U6Link garbage collector!!");
return 0;
}
@@ -2314,7 +2314,7 @@ static int nscript_print(lua_State *L) {
if (scroll) {
scroll->display_string(string);
} else {
- ::debug("%s", string);
+ ::debug(1, "%s", string);
}
return 0;
}
@@ -3497,7 +3497,7 @@ static int nscript_projectile_anim_multi(lua_State *L) {
lua_gettable(L, -2);
if (!lua_istable(L, -1)) { //we've hit the end of our targets
- ::debug("end = %d", i);
+ ::debug(1, "end = %d", i);
lua_pop(L, 1);
break;
}
More information about the Scummvm-git-logs
mailing list