AGS: Removed redundant function domouse(int what)

From upstream 3dfda41382bdd10e3b2b78f797fade8b5dcc1efa
This commit is contained in:
Paul Gilbert 2022-04-23 18:15:02 -07:00
parent 3467180e39
commit 17bac5b1ef
10 changed files with 14 additions and 46 deletions

View File

@ -590,14 +590,14 @@ void DialogOptions::Show() {
update_polled_stuff_if_runtime();
if (!_GP(play).mouse_cursor_hidden)
ags_domouse(DOMOUSE_ENABLE);
ags_domouse();
update_polled_stuff_if_runtime();
Redraw();
while (Run() && !SHOULD_QUIT) {}
if (!_GP(play).mouse_cursor_hidden)
ags_domouse(DOMOUSE_DISABLE);
ags_domouse();
}
void DialogOptions::Redraw() {

View File

@ -272,7 +272,7 @@ int _display_main(int xx, int yy, int wii, const char *text, int disp_type, int
}
if (!_GP(play).mouse_cursor_hidden)
ags_domouse(DOMOUSE_ENABLE);
ags_domouse();
int countdown = GetTextDisplayTime(todis);
int skip_setting = user_to_internal_skip_speech((SkipSpeechStyle)_GP(play).skip_display);
// Loop until skipped
@ -333,7 +333,7 @@ int _display_main(int xx, int yy, int wii, const char *text, int disp_type, int
break;
}
if (!_GP(play).mouse_cursor_hidden)
ags_domouse(DOMOUSE_DISABLE);
ags_domouse();
remove_screen_overlay(OVER_TEXTMSG);
invalidate_screen();
} else {

View File

@ -2184,7 +2184,7 @@ void construct_game_screen_overlay(bool draw_mouse) {
// to the update loop instead of doing it in the drawing routine
// update animating mouse cursor
if (_GP(game).mcurs[_G(cur_cursor)].view >= 0) {
ags_domouse(DOMOUSE_NOCURSOR);
ags_domouse();
// only on mousemove, and it's not moving
if (((_GP(game).mcurs[_G(cur_cursor)].flags & MCF_ANIMMOVE) != 0) &&
(_G(mousex) == _G(lastmx)) && (_G(mousey) == _G(lastmy)));
@ -2212,7 +2212,7 @@ void construct_game_screen_overlay(bool draw_mouse) {
_G(lastmy) = _G(mousey);
}
ags_domouse(DOMOUSE_NOCURSOR);
ags_domouse();
// Stage: mouse cursor
if (draw_mouse && !_GP(play).mouse_cursor_hidden && _GP(play).screen_is_faded_out == 0) {

View File

@ -197,14 +197,14 @@ void setup_for_dialog() {
_G(cbuttfont) = _GP(play).normal_font;
_G(acdialog_font) = _GP(play).normal_font;
if (!_GP(play).mouse_cursor_hidden)
ags_domouse(DOMOUSE_ENABLE);
ags_domouse();
_G(oldmouse) = _G(cur_cursor);
set_mouse_cursor(CURS_ARROW);
}
void restore_after_dialog() {
set_mouse_cursor(_G(oldmouse));
if (!_GP(play).mouse_cursor_hidden)
ags_domouse(DOMOUSE_DISABLE);
ags_domouse();
invalidate_screen();
}

View File

@ -270,7 +270,7 @@ void disable_cursor_mode(int modd) {
}
void RefreshMouse() {
ags_domouse(DOMOUSE_NOCURSOR);
ags_domouse();
_GP(scmouse).x = game_to_data_coord(_G(mousex));
_GP(scmouse).y = game_to_data_coord(_G(mousey));
}

View File

@ -26,11 +26,6 @@
namespace AGS3 {
#define DOMOUSE_UPDATE 0
#define DOMOUSE_ENABLE 1
#define DOMOUSE_DISABLE 2
#define DOMOUSE_NOCURSOR 5
void Mouse_SetVisible(int isOn);
int Mouse_GetVisible();
int Mouse_GetModeGraphic(int curs);

View File

@ -208,12 +208,8 @@ void ags_mouse_get_relxy(int &x, int &y) {
_G(mouse_accum_rely) = 0;
}
void ags_domouse(int what) {
// do mouse is "update the mouse x,y and also the cursor position", unless DOMOUSE_NOCURSOR is set.
if (what == DOMOUSE_NOCURSOR)
mgetgraphpos();
else
domouse(what);
void ags_domouse() {
mgetgraphpos();
}
int ags_check_mouse_wheel() {

View File

@ -91,7 +91,7 @@ extern int ags_mgetbutton();
// Returns recent relative mouse movement
extern void ags_mouse_get_relxy(int &x, int &y);
// Updates mouse cursor position in game
extern void ags_domouse(int what);
extern void ags_domouse();
// Returns -1 for wheel down and +1 for wheel up
// TODO: introduce constants for this
extern int ags_check_mouse_wheel();

View File

@ -100,28 +100,6 @@ void msetcursorlimit(int x1, int y1, int x2, int y2) {
_G(boundy2) = y2;
}
void domouse(int str) {
int poow = _G(mousecurs)[(int)_G(currentcursor)]->GetWidth();
int pooh = _G(mousecurs)[(int)_G(currentcursor)]->GetHeight();
//int smx = _G(mousex) - _G(hotxwas), smy = _G(mousey) - _G(hotywas);
const Rect &viewport = _GP(play).GetMainViewport();
mgetgraphpos();
_G(mousex) -= _G(hotx);
_G(mousey) -= _G(hoty);
if (_G(mousex) + poow >= viewport.GetWidth())
poow = viewport.GetWidth() - _G(mousex);
if (_G(mousey) + pooh >= viewport.GetHeight())
pooh = viewport.GetHeight() - _G(mousey);
_G(mousex) += _G(hotx);
_G(mousey) += _G(hoty);
_G(hotxwas) = _G(hotx);
_G(hotywas) = _G(hoty);
}
void msetgraphpos(int xa, int ya) {
_G(real_mouse_x) = xa;
_G(real_mouse_y) = ya;

View File

@ -44,6 +44,7 @@
#include "ags/engine/ac/path_helper.h"
#include "ags/engine/ac/room_status.h"
#include "ags/engine/ac/string.h"
#include "ags/engine/ac/sys_events.h"
#include "ags/shared/ac/sprite_cache.h"
#include "ags/engine/ac/dynobj/cc_dynamic_object_addr_and_manager.h"
#include "ags/engine/ac/dynobj/script_string.h"
@ -340,10 +341,8 @@ void IAGSEngine::BlitSpriteRotated(int32 x, int32 y, BITMAP *bmp, int32 angle) {
rotate_sprite(ds->GetAllegroBitmap(), bmp, x, y, itofix(angle));
}
extern void domouse(int);
void IAGSEngine::PollSystem() {
domouse(DOMOUSE_NOCURSOR);
ags_domouse();
update_polled_stuff_if_runtime();
int mbut, mwheelz;
if (run_service_mb_controls(mbut, mwheelz) && mbut >= 0 && !_GP(play).IsIgnoringInput())