Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ags/engine/gui/animating_gui_button.h"
#include "ags/shared/gui/gui_defines.h"
#include "ags/shared/util/stream.h"
namespace AGS3 {
using namespace AGS::Shared;
void AnimatingGUIButton::ReadFromSavegame(Stream *in, int cmp_ver) {
buttonid = in->ReadInt16();
ongui = in->ReadInt16();
onguibut = in->ReadInt16();
view = in->ReadInt16();
loop = in->ReadInt16();
frame = in->ReadInt16();
speed = in->ReadInt16();
uint16_t anim_flags = in->ReadInt16(); // was repeat (0,1)
wait = in->ReadInt16();
if (cmp_ver < kGuiSvgVersion_36020) anim_flags &= 0x1; // restrict to repeat only
repeat = (anim_flags & 0x1) ? ANIM_REPEAT : ANIM_ONCE;
blocking = (anim_flags >> 1) & 0x1;
direction = (anim_flags >> 2) & 0x1;
if (cmp_ver >= kGuiSvgVersion_36025) {
volume = in->ReadInt8();
in->ReadInt8(); // reserved to fill int32
in->ReadInt8();
in->ReadInt8();
}
}
void AnimatingGUIButton::WriteToSavegame(Stream *out) {
uint16_t anim_flags =
(repeat & 0x1) | // either ANIM_ONCE or ANIM_REPEAT
(blocking & 0x1) << 1 |
(direction & 0x1) << 2;
out->WriteInt16(buttonid);
out->WriteInt16(ongui);
out->WriteInt16(onguibut);
out->WriteInt16(view);
out->WriteInt16(loop);
out->WriteInt16(frame);
out->WriteInt16(speed);
out->WriteInt16(anim_flags); // was repeat (0,1)
out->WriteInt16(wait);
out->WriteInt8(static_cast<uint8_t>(volume));
out->WriteInt8(0); // reserved to fill int32
out->WriteInt8(0);
out->WriteInt8(0);
}
} // namespace AGS3

View File

@@ -0,0 +1,56 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Description of a button animation; stored separately from the GUI button.
//
#ifndef AGS_ENGINE_GUI_ANIMATING_GUI_BUTTON_H
#define AGS_ENGINE_GUI_ANIMATING_GUI_BUTTON_H
#include "ags/shared/core/types.h"
#include "ags/engine/ac/runtime_defines.h"
namespace AGS3 {
// Forward declaration
namespace AGS {
namespace Shared {
class Stream;
}
}
using namespace AGS; // FIXME later
struct AnimatingGUIButton {
// index into guibuts array, GUI, button
short buttonid = -1, ongui = -1, onguibut = -1;
// current animation status
uint16_t view = 0, loop = 0, frame = 0;
short speed = 0, repeat = 0, blocking = 0, direction = 0, wait = 0;
// relative volume of the frame sounds
int volume = -1;
void ReadFromSavegame(Shared::Stream *in, int cmp_ver);
void WriteToSavegame(Shared::Stream *out);
};
} // namespace AGS3
#endif

View File

@@ -0,0 +1,285 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ags/engine/gui/csci_dialog.h"
#include "ags/shared/ac/common.h"
#include "ags/engine/ac/draw.h"
#include "ags/engine/ac/game_setup.h"
#include "ags/engine/ac/game_state.h"
#include "ags/engine/ac/gui.h"
#include "ags/shared/ac/keycode.h"
#include "ags/engine/ac/mouse.h"
#include "ags/engine/ac/sys_events.h"
#include "ags/engine/ac/runtime_defines.h"
#include "ags/shared/font/fonts.h"
#include "ags/engine/gui/csci_dialog.h"
#include "ags/engine/gui/gui_dialog.h"
#include "ags/shared/gui/gui_main.h"
#include "ags/engine/gui/my_controls.h"
#include "ags/engine/main/game_run.h"
#include "ags/engine/gfx/graphics_driver.h"
#include "ags/shared/gfx/bitmap.h"
#include "ags/engine/media/audio/audio_system.h"
#include "ags/engine/platform/base/ags_platform_driver.h"
#include "ags/engine/ac/timer.h"
#include "ags/ags.h"
#include "ags/globals.h"
namespace AGS3 {
using AGS::Shared::Bitmap;
namespace BitmapHelper = AGS::Shared::BitmapHelper;
//-----------------------------------------------------------------------------
void __my_wbutt(Bitmap *ds, int x1, int y1, int x2, int y2) {
color_t draw_color = ds->GetCompatibleColor(COL254); //wsetcolor(15);
ds->FillRect(Rect(x1, y1, x2, y2), draw_color);
draw_color = ds->GetCompatibleColor(0);
ds->DrawRect(Rect(x1, y1, x2, y2), draw_color);
}
//-----------------------------------------------------------------------------
OnScreenWindow::OnScreenWindow() {
x = y = 0;
handle = -1;
oldtop = -1;
}
int CSCIGetVersion() {
return 0x0100;
}
int CSCIDrawWindow(int xx, int yy, int wid, int hit) {
_G(ignore_bounds)++;
multiply_up(&xx, &yy, &wid, &hit);
int drawit = -1;
for (int aa = 0; aa < MAXSCREENWINDOWS; aa++) {
if (_G(oswi)[aa].handle < 0) {
drawit = aa;
break;
}
}
if (drawit < 0)
quit("Too many windows created.");
_G(windowcount)++;
xx -= 2;
yy -= 2;
wid += 4;
hit += 4;
Bitmap *ds = prepare_gui_screen(xx, yy, wid, hit, true);
_G(oswi)[drawit].x = xx;
_G(oswi)[drawit].y = yy;
__my_wbutt(ds, 0, 0, wid - 1, hit - 1); // wbutt goes outside its area
_G(oswi)[drawit].oldtop = _G(topwindowhandle);
_G(topwindowhandle) = drawit;
_G(oswi)[drawit].handle = _G(topwindowhandle);
_G(win_x) = xx;
_G(win_y) = yy;
_G(win_width) = wid;
_G(win_height) = hit;
return drawit;
}
void CSCIEraseWindow(int handl) {
_G(ignore_bounds)--;
_G(topwindowhandle) = _G(oswi)[handl].oldtop;
_G(oswi)[handl].handle = -1;
_G(windowcount)--;
clear_gui_screen();
}
int CSCIWaitMessage(CSCIMessage *cscim) {
for (int uu = 0; uu < MAXCONTROLS; uu++) {
if (_G(vobjs)[uu] != nullptr) {
_G(vobjs)[uu]->drawifneeded();
}
}
prepare_gui_screen(_G(win_x), _G(win_y), _G(win_width), _G(win_height), true);
while (!SHOULD_QUIT) {
sys_evt_process_pending();
update_audio_system_on_game_loop();
refresh_gui_screen();
cscim->id = -1;
cscim->code = 0;
_G(smcode) = 0;
// NOTE: CSCIWaitMessage is supposed to report only single message,
// therefore we cannot process all buffered key presses here
// (unless the whole dialog system is rewritten).
KeyInput ki;
if (run_service_key_controls(ki) && !_GP(play).IsIgnoringInput()) {
int keywas = ki.Key;
int uchar = ki.UChar;
if (keywas == eAGSKeyCodeReturn) {
cscim->id = finddefaultcontrol(CNF_DEFAULT);
cscim->code = CM_COMMAND;
} else if (keywas == eAGSKeyCodeEscape) {
cscim->id = finddefaultcontrol(CNF_CANCEL);
cscim->code = CM_COMMAND;
} else if ((uchar == 0) && (keywas < eAGSKeyCodeSpace) && (keywas != eAGSKeyCodeBackspace)) ;
else if ((keywas >= eAGSKeyCodeUpArrow) & (keywas <= eAGSKeyCodePageDown) & (finddefaultcontrol(CNT_LISTBOX) >= 0))
_G(vobjs)[finddefaultcontrol(CNT_LISTBOX)]->processmessage(CTB_KEYPRESS, keywas, 0);
else if (finddefaultcontrol(CNT_TEXTBOX) >= 0)
_G(vobjs)[finddefaultcontrol(CNT_TEXTBOX)]->processmessage(CTB_KEYPRESS, keywas, uchar);
if (cscim->id < 0) {
cscim->code = CM_KEYPRESS;
cscim->wParam = keywas;
}
}
eAGSMouseButton mbut;
int mwheelz;
if (run_service_mb_controls(mbut, mwheelz) && (mbut > kMouseNone) && !_GP(play).IsIgnoringInput()) {
if (checkcontrols()) {
cscim->id = _G(controlid);
cscim->code = CM_COMMAND;
}
}
if (_G(smcode)) {
cscim->code = _G(smcode);
cscim->id = _G(controlid);
}
if (cscim->code > 0)
break;
WaitForNextFrame();
}
return 0;
}
int CSCICreateControl(int typeandflags, int xx, int yy, int wii, int hii, const char *title) {
multiply_up(&xx, &yy, &wii, &hii);
int usec = -1;
for (int hh = 1; hh < MAXCONTROLS; hh++) {
if (_G(vobjs)[hh] == nullptr) {
usec = hh;
break;
}
}
if (usec < 0)
quit("Too many controls created");
int type = typeandflags & 0x00ff; // 256 control types
if (type == CNT_PUSHBUTTON) {
if (wii == -1)
wii = get_text_width(title, _G(cbuttfont)) + 20;
_G(vobjs)[usec] = new MyPushButton(xx, yy, wii, hii, title);
} else if (type == CNT_LISTBOX) {
_G(vobjs)[usec] = new MyListBox(xx, yy, wii, hii);
} else if (type == CNT_LABEL) {
_G(vobjs)[usec] = new MyLabel(xx, yy, wii, title);
} else if (type == CNT_TEXTBOX) {
_G(vobjs)[usec] = new MyTextBox(xx, yy, wii, title);
} else
quit("Unknown control type requested");
_G(vobjs)[usec]->typeandflags = typeandflags;
_G(vobjs)[usec]->wlevel = _G(topwindowhandle);
_G(vobjs)[usec]->draw(get_gui_screen());
return usec;
}
void CSCIDeleteControl(int haa) {
delete _G(vobjs)[haa];
_G(vobjs)[haa] = nullptr;
}
int CSCISendControlMessage(int haa, int mess, int wPar, NumberPtr lPar) {
if (_G(vobjs)[haa] == nullptr)
return -1;
return _G(vobjs)[haa]->processmessage(mess, wPar, lPar);
}
void multiply_up_to_game_res(int *x, int *y) {
x[0] = get_fixed_pixel_size(x[0]);
y[0] = get_fixed_pixel_size(y[0]);
}
// TODO: this is silly, make a uniform formula
void multiply_up(int *x1, int *y1, int *x2, int *y2) {
multiply_up_to_game_res(x1, y1);
multiply_up_to_game_res(x2, y2);
// adjust for 800x600
if ((GetBaseWidth() == 400) || (GetBaseWidth() == 800)) {
x1[0] = (x1[0] * 5) / 4;
x2[0] = (x2[0] * 5) / 4;
y1[0] = (y1[0] * 3) / 2;
y2[0] = (y2[0] * 3) / 2;
} else if (GetBaseWidth() == 1024) {
x1[0] = (x1[0] * 16) / 10;
x2[0] = (x2[0] * 16) / 10;
y1[0] = (y1[0] * 384) / 200;
y2[0] = (y2[0] * 384) / 200;
}
}
int checkcontrols() {
// NOTE: this is because old code was working with full game screen
const int mousex = _G(mousex) - _G(win_x);
const int mousey = _G(mousey) - _G(win_y);
_G(smcode) = 0;
for (int kk = 0; kk < MAXCONTROLS; kk++) {
if (_G(vobjs)[kk] != nullptr) {
if (_G(vobjs)[kk]->mouseisinarea(mousex, mousey)) {
_G(controlid) = kk;
return _G(vobjs)[kk]->pressedon(mousex, mousey);
}
}
}
return 0;
}
int finddefaultcontrol(int flagmask) {
for (int ff = 0; ff < MAXCONTROLS; ff++) {
if (_G(vobjs)[ff] == nullptr)
continue;
if (_G(vobjs)[ff]->wlevel != _G(topwindowhandle))
continue;
if (_G(vobjs)[ff]->typeandflags & flagmask)
return ff;
}
return -1;
}
int GetBaseWidth() {
return _GP(play).GetUIViewport().GetWidth();
}
} // namespace AGS3

View File

@@ -0,0 +1,54 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//=============================================================================
//
// Legacy built-in GUI dialogs and controls.
//
//=============================================================================
#ifndef AGS_ENGINE_GUI_CSCI_DIALOG_H
#define AGS_ENGINE_GUI_CSCI_DIALOG_H
#include "ags/shared/core/types.h"
#include "ags/engine/gui/gui_dialog_defines.h"
namespace AGS3 {
#define MAXCONTROLS 20
#define MAXSCREENWINDOWS 5
int CSCIGetVersion();
int CSCIDrawWindow(int xx, int yy, int wid, int hit);
void CSCIEraseWindow(int handl);
int CSCIWaitMessage(CSCIMessage *cscim);
int CSCICreateControl(int typeandflags, int xx, int yy, int wii, int hii, const char *title);
void CSCIDeleteControl(int haa);
int CSCISendControlMessage(int haa, int mess, int wPar, NumberPtr lPar);
void multiply_up_to_game_res(int *x, int *y);
void multiply_up(int *x1, int *y1, int *x2, int *y2);
int checkcontrols();
int finddefaultcontrol(int flagmask);
int GetBaseWidth();
} // namespace AGS3
#endif

View File

@@ -0,0 +1,461 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "common/std/algorithm.h"
#include "ags/lib/allegro.h" // find files
#include "ags/engine/gui/gui_dialog.h"
#include "ags/shared/ac/common.h"
#include "ags/engine/ac/draw.h"
#include "ags/engine/ac/game.h"
#include "ags/engine/ac/game_setup.h"
#include "ags/shared/ac/game_setup_struct.h"
#include "ags/engine/ac/global_game.h"
#include "ags/engine/gui/csci_dialog.h"
#include "ags/shared/gfx/bitmap.h"
#include "ags/engine/gfx/graphics_driver.h"
#include "ags/engine/main/game_run.h"
#include "ags/engine/debugging/debug_log.h"
#include "ags/shared/util/path.h"
#include "ags/ags.h"
#include "ags/globals.h"
namespace AGS3 {
using namespace AGS::Shared;
using namespace AGS::Engine;
#undef MAXSAVEGAMES
#define MAXSAVEGAMES 20
char *get_gui_dialog_buffer() {
return _G(buffer2);
}
//
// TODO: rewrite the whole thing to work inside the main game update and render loop!
//
Bitmap *prepare_gui_screen(int x, int y, int width, int height, bool opaque) {
_G(windowPosX) = x;
_G(windowPosY) = y;
_G(windowPosWidth) = width;
_G(windowPosHeight) = height;
if (_G(windowBuffer)) {
_G(windowBuffer) = recycle_bitmap(_G(windowBuffer), _G(windowBuffer)->GetColorDepth(), _G(windowPosWidth), _G(windowPosHeight), !opaque);
} else {
_G(windowBuffer) = CreateCompatBitmap(_G(windowPosWidth), _G(windowPosHeight));
}
_G(dialogDDB) = recycle_ddb_bitmap(_G(dialogDDB), _G(windowBuffer), false, opaque);
return _G(windowBuffer);
}
Bitmap *get_gui_screen() {
return _G(windowBuffer);
}
void clear_gui_screen() {
if (_G(dialogDDB))
_G(gfxDriver)->DestroyDDB(_G(dialogDDB));
_G(dialogDDB) = nullptr;
delete _G(windowBuffer);
_G(windowBuffer) = nullptr;
}
void refresh_gui_screen() {
_G(gfxDriver)->UpdateDDBFromBitmap(_G(dialogDDB), _G(windowBuffer), false);
UpdateCursorAndDrawables();
render_graphics(_G(dialogDDB), _G(windowPosX), _G(windowPosY));
}
int loadgamedialog() {
const int wnd_width = 200;
const int wnd_height = 120;
const int boxleft = _G(myscrnwid) / 2 - wnd_width / 2;
const int boxtop = _G(myscrnhit) / 2 - wnd_height / 2;
const int buttonhit = _GP(usetup).textheight + 5;
int handl = CSCIDrawWindow(boxleft, boxtop, wnd_width, wnd_height);
int ctrlok =
CSCICreateControl(CNT_PUSHBUTTON | CNF_DEFAULT, 135, 5, 60, 10, get_global_message(MSG_RESTORE));
int ctrlcancel =
CSCICreateControl(CNT_PUSHBUTTON | CNF_CANCEL, 135, 5 + buttonhit, 60, 10,
get_global_message(MSG_CANCEL));
int ctrllist = CSCICreateControl(CNT_LISTBOX, 10, 30, 120, 80, nullptr);
int ctrltex1 = CSCICreateControl(CNT_LABEL, 10, 5, 120, 0, get_global_message(MSG_SELECTLOAD));
CSCISendControlMessage(ctrllist, CLB_CLEAR, 0, 0);
preparesavegamelist(ctrllist);
CSCIMessage mes;
_G(lpTemp) = nullptr;
int toret = -1;
while (1) {
CSCIWaitMessage(&mes); //printf("mess: %d, id %d ",mes.code,mes.id);
if (mes.code == CM_COMMAND) {
if (mes.id == ctrlok) {
int cursel = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
if ((cursel >= _G(numsaves)) || (cursel < 0))
_G(lpTemp) = nullptr;
else {
toret = _G(filenumbers)[cursel];
String path = get_save_game_path(toret);
Common::strcpy_s(_G(bufTemp), path.GetCStr());
_G(lpTemp) = &_G(bufTemp)[0];
}
} else if (mes.id == ctrlcancel) {
_G(lpTemp) = nullptr;
}
break;
}
}
CSCIDeleteControl(ctrltex1);
CSCIDeleteControl(ctrllist);
CSCIDeleteControl(ctrlok);
CSCIDeleteControl(ctrlcancel);
CSCIEraseWindow(handl);
return toret;
}
int savegamedialog() {
char okbuttontext[50];
Common::strcpy_s(okbuttontext, get_global_message(MSG_SAVEBUTTON));
char labeltext[200];
Common::strcpy_s(labeltext, get_global_message(MSG_SAVEDIALOG));
const int wnd_width = 200;
const int wnd_height = 120;
const int boxleft = _G(myscrnwid) / 2 - wnd_width / 2;
const int boxtop = _G(myscrnhit) / 2 - wnd_height / 2;
const int buttonhit = _GP(usetup).textheight + 5;
int labeltop = 5;
int handl = CSCIDrawWindow(boxleft, boxtop, wnd_width, wnd_height);
int ctrlcancel =
CSCICreateControl(CNT_PUSHBUTTON | CNF_CANCEL, 135, 5 + buttonhit, 60, 10,
get_global_message(MSG_CANCEL));
int ctrllist = CSCICreateControl(CNT_LISTBOX, 10, 40, 120, 80, nullptr);
int ctrltbox = 0;
CSCISendControlMessage(ctrllist, CLB_CLEAR, 0, 0); // clear the list box
preparesavegamelist(ctrllist);
if (_G(toomanygames)) {
Common::strcpy_s(okbuttontext, get_global_message(MSG_REPLACE));
Common::strcpy_s(labeltext, get_global_message(MSG_MUSTREPLACE));
labeltop = 2;
} else
ctrltbox = CSCICreateControl(CNT_TEXTBOX, 10, 29, 120, 0, nullptr);
int ctrlok = CSCICreateControl(CNT_PUSHBUTTON | CNF_DEFAULT, 135, 5, 60, 10, okbuttontext);
int ctrltex1 = CSCICreateControl(CNT_LABEL, 10, labeltop, 120, 0, labeltext);
CSCIMessage mes;
_G(lpTemp) = nullptr;
if (_G(numsaves) > 0)
CSCISendControlMessage(ctrllist, CLB_GETTEXT, 0, &_G(buffer2)[0]);
else
_G(buffer2)[0] = 0;
CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
int toret = -1;
while (1) {
CSCIWaitMessage(&mes); //printf("mess: %d, id %d ",mes.code,mes.id);
if (mes.code == CM_COMMAND) {
if (mes.id == ctrlok) {
int cursell = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, &_G(buffer2)[0]);
if (_G(numsaves) > 0)
CSCISendControlMessage(ctrllist, CLB_GETTEXT, cursell, &_G(bufTemp)[0]);
else
Common::strcpy_s(_G(bufTemp), "_NOSAVEGAMENAME");
if (_G(toomanygames)) {
int nwhand = CSCIDrawWindow(boxleft + 5, boxtop + 20, 190, 65);
int lbl1 =
CSCICreateControl(CNT_LABEL, 15, 5, 160, 0, get_global_message(MSG_REPLACEWITH1));
int lbl2 = CSCICreateControl(CNT_LABEL, 25, 14, 160, 0, _G(bufTemp));
int lbl3 =
CSCICreateControl(CNT_LABEL, 15, 25, 160, 0, get_global_message(MSG_REPLACEWITH2));
int txt1 = CSCICreateControl(CNT_TEXTBOX, 15, 35, 160, 0, _G(bufTemp));
int btnOk =
CSCICreateControl(CNT_PUSHBUTTON | CNF_DEFAULT, 25, 50, 60, 10,
get_global_message(MSG_REPLACE));
int btnCancel =
CSCICreateControl(CNT_PUSHBUTTON | CNF_CANCEL, 95, 50, 60, 10,
get_global_message(MSG_CANCEL));
CSCIMessage cmes;
do {
CSCIWaitMessage(&cmes);
} while (cmes.code != CM_COMMAND);
CSCISendControlMessage(txt1, CTB_GETTEXT, 0, &_G(buffer2)[0]);
CSCIDeleteControl(btnCancel);
CSCIDeleteControl(btnOk);
CSCIDeleteControl(txt1);
CSCIDeleteControl(lbl3);
CSCIDeleteControl(lbl2);
CSCIDeleteControl(lbl1);
CSCIEraseWindow(nwhand);
_G(bufTemp)[0] = 0;
if (cmes.id == btnCancel) {
_G(lpTemp) = nullptr;
break;
} else
toret = _G(filenumbers)[cursell];
} else if (strcmp(_G(buffer2), _G(bufTemp)) != 0) { // create a new game (description different)
int highestnum = 0;
for (int pp = 0; pp < _G(numsaves); pp++) {
if (_G(filenumbers)[pp] > highestnum)
highestnum = _G(filenumbers)[pp];
}
if (highestnum > 90)
quit("Save game directory overflow");
toret = highestnum + 1;
String path = get_save_game_path(toret);
Common::strcpy_s(_G(bufTemp), path.GetCStr());
} else {
toret = _G(filenumbers)[cursell];
_G(bufTemp)[0] = 0;
}
if (_G(bufTemp)[0] == 0) {
String path = get_save_game_path(toret);
Common::strcpy_s(_G(bufTemp), path.GetCStr());
}
_G(lpTemp) = &_G(bufTemp)[0];
_G(lpTemp2) = &_G(buffer2)[0];
} else if (mes.id == ctrlcancel) {
_G(lpTemp) = nullptr;
}
break;
} else if (mes.code == CM_SELCHANGE) {
int cursel = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
if (cursel >= 0) {
CSCISendControlMessage(ctrllist, CLB_GETTEXT, cursel, &_G(buffer2)[0]);
CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
}
}
}
CSCIDeleteControl(ctrltbox);
CSCIDeleteControl(ctrltex1);
CSCIDeleteControl(ctrllist);
CSCIDeleteControl(ctrlok);
CSCIDeleteControl(ctrlcancel);
CSCIEraseWindow(handl);
return toret;
}
void preparesavegamelist(int ctrllist) {
// Get a list of savegames
SaveStateList saveList = ::AGS::g_vm->listSaves();
// The original AGS sorts the list from most recent to oldest.
// We don't have the modification date in ScummVM though. We could try to
// parse the date string, but for now, sort by decreasing slot number, which
// should work better than the default sort by increasing slot.
Common::sort(saveList.begin(), saveList.end(),
[](const SaveStateDescriptor & x, const SaveStateDescriptor & y) {
return x.getSaveSlot() > y.getSaveSlot();
});
// fill in the list box and global savegameindex[] array for backward compatibilty
for (_G(numsaves) = 0; _G(numsaves) < (int)saveList.size(); ++_G(numsaves)) {
CSCISendControlMessage(ctrllist, CLB_ADDITEM, 0,
saveList[_G(numsaves)].getDescription().encode().c_str());
_G(filenumbers)[_G(numsaves)] = saveList[_G(numsaves)].getSaveSlot();
_G(filedates)[_G(numsaves)] = 0;
//(long int)saveList[_G(numsaves)].FileTime;
}
_G(toomanygames) = (_G(numsaves) >= MAXSAVEGAMES) ? 1 : 0;
// Select the first item
CSCISendControlMessage(ctrllist, CLB_SETCURSEL, 0, 0);
}
void enterstringwindow(const char *prompttext, char *dst_buf, size_t dst_sz) {
const int wnd_width = 200;
const int wnd_height = 40;
const int boxleft = 60, boxtop = 80;
int wantCancel = 0;
if (prompttext[0] == '!') {
wantCancel = 1;
prompttext++;
}
int handl = CSCIDrawWindow(boxleft, boxtop, wnd_width, wnd_height);
int ctrlok = CSCICreateControl(CNT_PUSHBUTTON | CNF_DEFAULT, 135, 5, 60, 10, "OK");
int ctrlcancel = -1;
if (wantCancel)
ctrlcancel = CSCICreateControl(CNT_PUSHBUTTON | CNF_CANCEL, 135, 20, 60, 10, get_global_message(MSG_CANCEL));
int ctrltbox = CSCICreateControl(CNT_TEXTBOX, 10, 29, 120, 0, nullptr);
int ctrltex1 = CSCICreateControl(CNT_LABEL, 10, 5, 120, 0, prompttext);
CSCIMessage mes;
while (1) {
CSCIWaitMessage(&mes);
if (mes.code == CM_COMMAND) {
if (mes.id == ctrlcancel)
_G(buffer2)[0] = 0;
else
CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, &_G(buffer2)[0]);
break;
}
}
CSCIDeleteControl(ctrltex1);
CSCIDeleteControl(ctrltbox);
CSCIDeleteControl(ctrlok);
if (wantCancel)
CSCIDeleteControl(ctrlcancel);
CSCIEraseWindow(handl);
snprintf(dst_buf, dst_sz, "%s", _G(buffer2));
}
int enternumberwindow(char *prompttext) {
char ourbuf[200];
enterstringwindow(prompttext, ourbuf, sizeof(ourbuf));
if (ourbuf[0] == 0)
return -9999;
return atoi(ourbuf);
}
int roomSelectorWindow(int currentRoom, int numRooms,
const std::vector<int> &roomNumbers, const std::vector<String> &roomNames) {
char labeltext[200];
Common::strcpy_s(labeltext, get_global_message(MSG_SAVEDIALOG));
const int wnd_width = 240;
const int wnd_height = 160;
const int boxleft = _G(myscrnwid) / 2 - wnd_width / 2;
const int boxtop = _G(myscrnhit) / 2 - wnd_height / 2;
const int labeltop = 5;
int handl = CSCIDrawWindow(boxleft, boxtop, wnd_width, wnd_height);
int ctrllist = CSCICreateControl(CNT_LISTBOX, 10, 40, 220, 100, nullptr);
int ctrlcancel =
CSCICreateControl(CNT_PUSHBUTTON | CNF_CANCEL, 80, 145, 60, 10, "Cancel");
CSCISendControlMessage(ctrllist, CLB_CLEAR, 0, 0); // clear the list box
for (int aa = 0; aa < numRooms; aa++) {
snprintf(_G(buff), sizeof(_G(buff)), "%3d %s", roomNumbers[aa], roomNames[aa].GetCStr());
CSCISendControlMessage(ctrllist, CLB_ADDITEM, 0, &_G(buff)[0]);
if (roomNumbers[aa] == currentRoom) {
CSCISendControlMessage(ctrllist, CLB_SETCURSEL, aa, 0);
}
}
int ctrlok = CSCICreateControl(CNT_PUSHBUTTON | CNF_DEFAULT, 10, 145, 60, 10, "OK");
int ctrltex1 = CSCICreateControl(CNT_LABEL, 10, labeltop, 180, 0, "Choose which room to go to:");
CSCIMessage mes;
_G(lpTemp) = nullptr;
_G(buffer2)[0] = 0;
int ctrltbox = CSCICreateControl(CNT_TEXTBOX, 10, 29, 120, 0, nullptr);
CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
int toret = -1;
while (1) {
CSCIWaitMessage(&mes); //printf("mess: %d, id %d ",mes.code,mes.id);
if (mes.code == CM_COMMAND) {
if (mes.id == ctrlok) {
CSCISendControlMessage(ctrltbox, CTB_GETTEXT, 0, &_G(buffer2)[0]);
if (Common::isDigit(_G(buffer2)[0])) {
toret = atoi(_G(buffer2));
}
} else if (mes.id == ctrlcancel) {
}
break;
} else if (mes.code == CM_SELCHANGE) {
int cursel = CSCISendControlMessage(ctrllist, CLB_GETCURSEL, 0, 0);
if (cursel >= 0) {
snprintf(_G(buffer2), sizeof(_G(buffer2)), "%d", roomNumbers[cursel]);
CSCISendControlMessage(ctrltbox, CTB_SETTEXT, 0, &_G(buffer2)[0]);
}
}
}
CSCIDeleteControl(ctrltbox);
CSCIDeleteControl(ctrltex1);
CSCIDeleteControl(ctrllist);
CSCIDeleteControl(ctrlok);
CSCIDeleteControl(ctrlcancel);
CSCIEraseWindow(handl);
return toret;
}
int myscimessagebox(const char *lpprompt, char *btn1, char *btn2) {
const int wnd_width = 240 - 80;
const int wnd_height = 120 - 80;
const int boxleft = 80;
const int boxtop = 80;
int windl = CSCIDrawWindow(boxleft, boxtop, wnd_width, wnd_height);
int lbl1 = CSCICreateControl(CNT_LABEL, 10, 5, 150, 0, lpprompt);
int btflag = CNT_PUSHBUTTON;
if (btn2 == nullptr)
btflag |= CNF_DEFAULT | CNF_CANCEL;
else
btflag |= CNF_DEFAULT;
int btnQuit = CSCICreateControl(btflag, 10, 25, 60, 10, btn1);
int btnPlay = 0;
if (btn2 != nullptr)
btnPlay = CSCICreateControl(CNT_PUSHBUTTON | CNF_CANCEL, 85, 25, 60, 10, btn2);
_GP(smes).code = 0;
do {
if (SHOULD_QUIT)
return 1;
CSCIWaitMessage(&_GP(smes));
} while (_GP(smes).code != CM_COMMAND);
if (btnPlay)
CSCIDeleteControl(btnPlay);
CSCIDeleteControl(btnQuit);
CSCIDeleteControl(lbl1);
CSCIEraseWindow(windl);
if (_GP(smes).id == btnQuit)
return 1;
return 0;
}
int quitdialog() {
char quitbut[50], playbut[50];
Common::strcpy_s(quitbut, get_global_message(MSG_QUITBUTTON));
Common::strcpy_s(playbut, get_global_message(MSG_PLAYBUTTON));
return myscimessagebox(get_global_message(MSG_QUITDIALOG), quitbut, playbut);
}
} // namespace AGS3

View File

@@ -0,0 +1,60 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AGS_ENGINE_GUI_GUI_DIALOG_H
#define AGS_ENGINE_GUI_GUI_DIALOG_H
#include "common/std/vector.h"
#include "ags/shared/util/string.h"
namespace AGS3 {
namespace AGS {
namespace Shared {
class Bitmap;
} // namespace Shared
} // namespace AGS
// Functions for handling hard-coded GUIs
// Prepares GUI bitmaps which will be passed to the renderer's draw chain
AGS::Shared::Bitmap *prepare_gui_screen(int x, int y, int width, int height, bool opaque);
AGS::Shared::Bitmap *get_gui_screen();
// Deletes GUI bitmaps
void clear_gui_screen();
// Draws virtual screen contents on the GUI bitmaps and assignes them to
// the renderer's draw chain
void refresh_gui_screen();
int loadgamedialog();
int savegamedialog();
void preparesavegamelist(int ctrllist);
void enterstringwindow(const char *prompttext, char *dst_buf, size_t dst_sz);
int enternumberwindow(char *prompttext);
int roomSelectorWindow(int currentRoom, int numRooms,
const std::vector<int> &roomNumbers, const std::vector<AGS::Shared::String> &roomNames);
int myscimessagebox(const char *lpprompt, char *btn1, char *btn2);
int quitdialog();
// last string value in gui dialog.
char *get_gui_dialog_buffer();
} // namespace AGS3
#endif

View File

@@ -0,0 +1,131 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//=============================================================================
//
// Constants for built-in GUI dialogs.
//
//=============================================================================
#ifndef AGS_ENGINE_GUI_GUI_DIALOG_DEFINES_H
#define AGS_ENGINE_GUI_GUI_DIALOG_DEFINES_H
#include "ags/engine/ac/game_setup.h"
#include "ags/globals.h"
namespace AGS3 {
#define MSG_RESTORE 984
#define MSG_CANCEL 985 // "Cancel"
#define MSG_SELECTLOAD 986 // "Select game to restore"
#define MSG_SAVEBUTTON 987 // "Save"
#define MSG_SAVEDIALOG 988 // "Save game name:"
#define MSG_REPLACE 989 // "Replace"
#define MSG_MUSTREPLACE 990 // "The folder is full. you must replace"
#define MSG_REPLACEWITH1 991 // "Replace:"
#define MSG_REPLACEWITH2 992 // "With:"
#define MSG_QUITBUTTON 993 // "Quit"
#define MSG_PLAYBUTTON 994 // "Play"
#define MSG_QUITDIALOG 995 // "Do you want to quit?"
#define TEXT_HT _GP(usetup).textheight
/*#define COL251 26
#define COL252 28
#define COL253 29
#define COL254 27
#define COL255 24*/
#define COL253 15
#define COL254 7
#define COL255 8
// ========= DEFINES ========
// Control types
#define CNT_PUSHBUTTON 0x001
#define CNT_LISTBOX 0x002
#define CNT_LABEL 0x003
#define CNT_TEXTBOX 0x004
// Control properties
#define CNF_DEFAULT 0x100
#define CNF_CANCEL 0x200
// Dialog messages
#define CM_COMMAND 1
#define CM_KEYPRESS 2
#define CM_SELCHANGE 3
// System messages
#define SM_SAVEGAME 100
#define SM_LOADGAME 101
#define SM_QUIT 102
// System messages (to ADVEN)
#define SM_SETTRANSFERMEM 120
#define SM_GETINIVALUE 121
// System messages (to driver)
#define SM_QUERYQUIT 110
#define SM_KEYPRESS 111
#define SM_TIMER 112
// ListBox messages
#define CLB_ADDITEM 1
#define CLB_CLEAR 2
#define CLB_GETCURSEL 3
#define CLB_GETTEXT 4
#define CLB_SETTEXT 5
#define CLB_SETCURSEL 6
// TextBox messages
#define CTB_GETTEXT 1
#define CTB_SETTEXT 2
#define CTB_KEYPRESS 91
namespace AGS {
namespace Shared {
class Bitmap;
}
}
using namespace AGS; // FIXME later
// ========= STRUCTS ========
#ifdef OBSOLETE
struct DisplayProperties {
int width;
int height;
int colors;
int textheight;
};
#endif // OBSOLETE
struct CSCIMessage {
int code;
int id;
int wParam;
};
struct OnScreenWindow {
int x, y;
int handle;
int oldtop;
OnScreenWindow();
};
} // namespace AGS3
#endif

View File

@@ -0,0 +1,182 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//=============================================================================
//
// Implementation from acgui.h and acgui.cpp specific to Engine runtime
//
//=============================================================================
#include "ags/shared/ac/game_version.h"
#include "ags/engine/ac/system.h"
#include "ags/shared/font/fonts.h"
#include "ags/shared/gui/gui_main.h"
#include "ags/shared/gui/gui_button.h"
#include "ags/shared/gui/gui_inv.h"
#include "ags/shared/gui/gui_label.h"
#include "ags/shared/gui/gui_listbox.h"
#include "ags/shared/gui/gui_textbox.h"
#include "ags/shared/ac/game_setup_struct.h"
#include "ags/engine/ac/global_translation.h"
#include "ags/engine/ac/string.h"
#include "ags/shared/ac/sprite_cache.h"
#include "ags/shared/gfx/bitmap.h"
#include "ags/engine/gfx/blender.h"
#include "ags/globals.h"
namespace AGS3 {
extern void wouttext_outline(Shared::Bitmap *ds, int xxp, int yyp, int usingfont, color_t text_color, const char *texx);
using namespace AGS::Shared;
// For engine these are defined in ac.cpp
extern void replace_macro_tokens(const char *, String &);
bool GUIMain::HasAlphaChannel() const {
if (this->BgImage > 0) {
// alpha state depends on background image
return is_sprite_alpha(this->BgImage);
}
if (this->BgColor > 0) {
// not alpha transparent if there is a background color
return false;
}
// transparent background, enable alpha blending
return _GP(game).GetColorDepth() >= 24 &&
// transparent background have alpha channel only since 3.2.0;
// "classic" gui rendering mode historically had non-alpha transparent backgrounds
// (3.2.0 broke the compatibility, now we restore it)
_G(loaded_game_file_version) >= kGameVersion_320 && _GP(game).options[OPT_NEWGUIALPHA] != kGuiAlphaRender_Legacy;
}
//=============================================================================
// Engine-specific implementation split out of acgui.cpp
//=============================================================================
int get_adjusted_spritewidth(int spr) {
return _GP(game).SpriteInfos[spr].Width;
}
int get_adjusted_spriteheight(int spr) {
return _GP(game).SpriteInfos[spr].Height;
}
bool is_sprite_alpha(int spr) {
return ((_GP(game).SpriteInfos[spr].Flags & SPF_ALPHACHANNEL) != 0);
}
void set_eip_guiobj(int eip) {
_G(eip_guiobj) = eip;
}
int get_eip_guiobj() {
return _G(eip_guiobj);
}
namespace AGS {
namespace Shared {
String GUI::ApplyTextDirection(const String &text) {
if (_GP(game).options[OPT_RIGHTLEFTWRITE] == 0)
return text;
String res_text = text;
(get_uformat() == U_UTF8) ? res_text.ReverseUTF8() : res_text.Reverse();
return res_text;
}
String GUI::TransformTextForDrawing(const String &text, bool translate, bool apply_direction) {
String res_text = translate ? String(get_translation(text.GetCStr())) : text;
if (translate && apply_direction)
res_text = ApplyTextDirection(res_text);
return res_text;
}
size_t GUI::SplitLinesForDrawing(const char *text, bool is_translated, SplitLines &lines, int font, int width, size_t max_lines) {
// Use the engine's word wrap tool, to have RTL writing and other features
return break_up_text_into_lines(text, is_translated, lines, width, font);
}
void GUIObject::MarkChanged() {
_hasChanged = true;
_GP(guis)[ParentId].MarkControlChanged();
}
void GUIObject::MarkParentChanged() {
_GP(guis)[ParentId].MarkControlChanged();
}
void GUIObject::MarkPositionChanged(bool self_changed) {
_hasChanged |= self_changed;
_GP(guis)[ParentId].NotifyControlPosition();
}
void GUIObject::MarkStateChanged(bool self_changed, bool parent_changed) {
_hasChanged |= self_changed;
_GP(guis)[ParentId].NotifyControlState(Id, self_changed | parent_changed);
}
void GUIObject::ClearChanged() {
_hasChanged = false;
}
int GUILabel::PrepareTextToDraw() {
const bool is_translated = (Flags & kGUICtrl_Translated) != 0;
replace_macro_tokens(is_translated ? get_translation(Text.GetCStr()) : Text.GetCStr(), _textToDraw);
return GUI::SplitLinesForDrawing(_textToDraw.GetCStr(), is_translated, _GP(Lines), Font, _width);
}
void GUITextBox::DrawTextBoxContents(Bitmap *ds, int x, int y, color_t text_color) {
_textToDraw = Text;
bool reverse = false;
// Text boxes input is never "translated" in regular sense,
// but they use this flag to apply text direction
if ((_G(loaded_game_file_version) >= kGameVersion_361) && ((Flags & kGUICtrl_Translated) != 0)) {
_textToDraw = GUI::ApplyTextDirection(Text);
reverse = _GP(game).options[OPT_RIGHTLEFTWRITE] != 0;
}
Line tpos = GUI::CalcTextPositionHor(_textToDraw.GetCStr(), Font,
x + 1 + get_fixed_pixel_size(1), x + _width - 1, y + 1 + get_fixed_pixel_size(1),
reverse ? kAlignTopRight : kAlignTopLeft);
wouttext_outline(ds, tpos.X1, tpos.Y1, Font, text_color, _textToDraw.GetCStr());
if (IsGUIEnabled(this)) {
// draw a cursor
const int cursor_width = get_fixed_pixel_size(5);
int draw_at_x = reverse ? tpos.X1 - 3 - cursor_width : tpos.X2 + 3;
int draw_at_y = y + 1 + get_font_height(Font);
ds->DrawRect(Rect(draw_at_x, draw_at_y, draw_at_x + cursor_width, draw_at_y + (get_fixed_pixel_size(1) - 1)), text_color);
}
}
void GUIListBox::PrepareTextToDraw(const String &text) {
_textToDraw = GUI::TransformTextForDrawing(text, (Flags & kGUICtrl_Translated) != 0, (_G(loaded_game_file_version) >= kGameVersion_361));
}
void GUIButton::PrepareTextToDraw() {
_textToDraw = GUI::TransformTextForDrawing(_text, (Flags & kGUICtrl_Translated) != 0, (_G(loaded_game_file_version) >= kGameVersion_361));
}
} // namespace Shared
} // namespace AGS
} // namespace AGS3

View File

@@ -0,0 +1,36 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
//=============================================================================
//
// Legacy built-in GUI dialogs and controls.
//
//=============================================================================
#ifndef AGS_ENGINE_GUI_MY_CONTROLS_H
#define AGS_ENGINE_GUI_MY_CONTROLS_H
#include "ags/engine/gui/my_label.h"
#include "ags/engine/gui/my_listbox.h"
#include "ags/engine/gui/my_push_button.h"
#include "ags/engine/gui/my_textbox.h"
#endif

View File

@@ -0,0 +1,63 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ags/engine/gui/my_label.h"
#include "ags/engine/ac/display.h"
#include "ags/engine/ac/game_setup.h"
#include "ags/engine/ac/string.h"
#include "ags/shared/font/fonts.h"
#include "ags/engine/gui/gui_dialog_defines.h"
#include "ags/globals.h"
namespace AGS3 {
using namespace Shared;
MyLabel::MyLabel(int xx, int yy, int wii, const char *tee) {
snprintf(text, sizeof(text), "%s", tee);
x = xx;
y = yy;
wid = wii;
hit = TEXT_HT;
}
void MyLabel::draw(Bitmap *ds) {
int cyp = y;
char *teptr = &text[0];
color_t text_color = ds->GetCompatibleColor(0);
if (break_up_text_into_lines(teptr, _GP(Lines), wid, _G(acdialog_font)) == 0)
return;
for (size_t ee = 0; ee < _GP(Lines).Count(); ee++) {
wouttext_outline(ds, x, cyp, _G(acdialog_font), text_color, _GP(Lines)[ee].GetCStr());
cyp += TEXT_HT;
}
}
int MyLabel::pressedon(int mousex, int mousey) {
return 0;
}
int MyLabel::processmessage(int mcode, int wParam, NumberPtr lParam) {
return -1; // doesn't support messages
}
} // namespace AGS3

View File

@@ -0,0 +1,42 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AGS_ENGINE_GUI_MY_LABEL_H
#define AGS_ENGINE_GUI_MY_LABEL_H
#include "ags/engine/gui/new_control.h"
namespace AGS3 {
struct MyLabel : public NewControl {
char text[150];
MyLabel(int xx, int yy, int wii, const char *tee);
void draw(Shared::Bitmap *ds) override;
int pressedon(int mx, int my) override;
int processmessage(int mcode, int wParam, NumberPtr lParam) override;
};
} // namespace AGS3
#endif

View File

@@ -0,0 +1,192 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ags/engine/gui/my_listbox.h"
#include "ags/shared/ac/common.h"
#include "ags/engine/ac/game_setup.h"
#include "ags/shared/ac/keycode.h"
#include "ags/shared/font/fonts.h"
#include "ags/shared/gfx/bitmap.h"
#include "ags/engine/gui/gui_dialog.h"
#include "ags/engine/gui/gui_dialog_defines.h"
namespace AGS3 {
using namespace AGS::Shared;
MyListBox::MyListBox(int xx, int yy, int wii, int hii) {
x = xx;
y = yy;
wid = wii;
hit = hii;
hit -= (hit - 4) % TEXT_HT; // resize to multiple of text height
numonscreen = (hit - 4) / TEXT_HT;
items = 0;
topitem = 0;
selected = -1;
memset(itemnames, 0, sizeof(itemnames));
}
void MyListBox::clearlist() {
for (int kk = 0; kk < items; kk++)
free(itemnames[kk]);
items = 0;
}
MyListBox::~MyListBox() {
clearlist();
}
void MyListBox::draw(Bitmap *ds) {
color_t draw_color = ds->GetCompatibleColor(_G(windowbackgroundcolor));
ds->FillRect(Rect(x, y, x + wid, y + hit), draw_color);
draw_color = ds->GetCompatibleColor(0);
ds->DrawRect(Rect(x, y, x + wid, y + hit), draw_color);
int widwas = wid;
wid -= ARROWWIDTH;
ds->DrawLine(Line(x + wid, y, x + wid, y + hit), draw_color); // draw the up/down arrows
ds->DrawLine(Line(x + wid, y + hit / 2, x + widwas, y + hit / 2), draw_color);
int xmidd = x + wid + (widwas - wid) / 2;
if (topitem < 1)
draw_color = ds->GetCompatibleColor(7);
ds->DrawLine(Line(xmidd, y + 2, xmidd, y + 10), draw_color); // up arrow
ds->DrawLine(Line(xmidd - 1, y + 3, xmidd + 1, y + 3), draw_color);
ds->DrawLine(Line(xmidd - 2, y + 4, xmidd + 2, y + 4), draw_color);
draw_color = ds->GetCompatibleColor(0);
if (topitem + numonscreen >= items)
draw_color = ds->GetCompatibleColor(7);
ds->DrawLine(Line(xmidd, y + hit - 10, xmidd, y + hit - 3), draw_color); // down arrow
ds->DrawLine(Line(xmidd - 1, y + hit - 4, xmidd + 1, y + hit - 4), draw_color);
ds->DrawLine(Line(xmidd - 2, y + hit - 5, xmidd + 2, y + hit - 5), draw_color);
draw_color = ds->GetCompatibleColor(0);
for (int tt = 0; tt < numonscreen; tt++) {
int inum = tt + topitem;
if (inum >= items)
break;
int thisypos = y + 2 + tt * TEXT_HT;
color_t text_color;
if (inum == selected) {
draw_color = ds->GetCompatibleColor(0);
ds->FillRect(Rect(x, thisypos, x + wid, thisypos + TEXT_HT - 1), draw_color);
text_color = ds->GetCompatibleColor(7);
} else text_color = ds->GetCompatibleColor(0);
wouttextxy(ds, x + 2, thisypos, _G(cbuttfont), text_color, itemnames[inum]);
}
wid = widwas;
}
int MyListBox::pressedon(int mousex, int mousey) {
if (mousex > x + wid - ARROWWIDTH) {
if ((mousey - y < hit / 2) && (topitem > 0))
topitem--;
else if ((mousey - y > hit / 2) && (topitem + numonscreen < items))
topitem++;
} else {
selected = ((mousey - y) - 2) / TEXT_HT + topitem;
if (selected >= items)
selected = items - 1;
}
draw(get_gui_screen());
_G(smcode) = CM_SELCHANGE;
return 0;
}
void MyListBox::additem(char *texx) {
if (items >= MAXLISTITEM)
quit("!CSCIUSER16: Too many items added to listbox");
size_t ln = strlen(texx) + 1;
itemnames[items] = (char *)malloc(ln);
Common::strcpy_s(itemnames[items], ln, texx);
items++;
needredraw = 1;
}
int MyListBox::processmessage(int mcode, int wParam, NumberPtr lParam) {
if (mcode == CLB_ADDITEM) {
additem((char *)lParam.ptr());
} else if (mcode == CLB_CLEAR)
clearlist();
else if (mcode == CLB_GETCURSEL)
return selected;
else if (mcode == CLB_SETCURSEL) {
selected = wParam;
if ((selected < topitem) && (selected >= 0))
topitem = selected;
if (topitem + numonscreen <= selected)
topitem = (selected + 1) - numonscreen;
} else if (mcode == CLB_GETTEXT)
Common::strcpy_s((char *)lParam.ptr(), 260, itemnames[wParam]);
else if (mcode == CLB_SETTEXT) {
if (wParam < items)
free(itemnames[wParam]);
char *newstri = (char *)lParam.ptr();
size_t ln = strlen(newstri) + 2;
itemnames[wParam] = (char *)malloc(ln);
Common::strcpy_s(itemnames[wParam], ln, newstri);
} else if (mcode == CTB_KEYPRESS) {
if ((wParam == eAGSKeyCodeDownArrow) && (selected < items - 1))
selected++;
if ((wParam == eAGSKeyCodeUpArrow) && (selected > 0))
selected--;
if (wParam == eAGSKeyCodePageUp)
selected -= (numonscreen - 1);
if (wParam == eAGSKeyCodePageDown)
selected += (numonscreen - 1);
if ((selected < 0) && (items > 0))
selected = 0;
if (selected >= items)
selected = items - 1;
if ((selected < topitem) && (selected >= 0))
topitem = selected;
if (topitem + numonscreen <= selected)
topitem = (selected + 1) - numonscreen;
drawandmouse();
_G(smcode) = CM_SELCHANGE;
} else
return -1;
return 0;
}
} // namespace AGS3

View File

@@ -0,0 +1,47 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AGS_ENGINE_GUI_MY_LISTBOX_H
#define AGS_ENGINE_GUI_MY_LISTBOX_H
#include "ags/engine/gui/new_control.h"
namespace AGS3 {
#define MAXLISTITEM 300
#define ARROWWIDTH 8
struct MyListBox : public NewControl {
int items, topitem, numonscreen, selected;
char *itemnames[MAXLISTITEM];
MyListBox(int xx, int yy, int wii, int hii);
void clearlist();
~MyListBox() override;
void draw(Shared::Bitmap *ds) override;
int pressedon(int mx, int my) override;
void additem(char *texx);
int processmessage(int mcode, int wParam, NumberPtr lParam) override;
};
} // namespace AGS3
#endif

View File

@@ -0,0 +1,98 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ags/engine/gui/my_push_button.h"
#include "ags/shared/ac/common.h"
#include "ags/engine/ac/sys_events.h"
#include "ags/engine/ac/timer.h"
#include "ags/shared/font/fonts.h"
#include "ags/shared/gfx/bitmap.h"
#include "ags/engine/gui/gui_dialog.h"
#include "ags/engine/gui/gui_dialog_defines.h"
#include "ags/engine/main/game_run.h"
#include "ags/engine/platform/base/ags_platform_driver.h"
namespace AGS3 {
using AGS::Shared::Bitmap;
MyPushButton::MyPushButton(int xx, int yy, int wi, int hi, const char *tex) { //wlevel=2;
x = xx;
y = yy;
wid = wi;
hit = hi + 1; //hit=hi;
state = 0;
snprintf(text, sizeof(text), "%s", tex);
}
void MyPushButton::draw(Bitmap *ds) {
color_t text_color = ds->GetCompatibleColor(0);
color_t draw_color = ds->GetCompatibleColor(COL254);
ds->FillRect(Rect(x, y, x + wid, y + hit), draw_color);
if (state == 0)
draw_color = ds->GetCompatibleColor(_G(pushbuttondarkcolor));
else
draw_color = ds->GetCompatibleColor(_G(pushbuttonlightcolor));
ds->DrawRect(Rect(x, y, x + wid, y + hit), draw_color);
if (state == 0)
draw_color = ds->GetCompatibleColor(_G(pushbuttonlightcolor));
else
draw_color = ds->GetCompatibleColor(_G(pushbuttondarkcolor));
ds->DrawLine(Line(x, y, x + wid - 1, y), draw_color);
ds->DrawLine(Line(x, y, x, y + hit - 1), draw_color);
wouttextxy(ds, x + (wid / 2 - get_text_width(text, _G(cbuttfont)) / 2), y + 2, _G(cbuttfont), text_color, text);
if (typeandflags & CNF_DEFAULT)
draw_color = ds->GetCompatibleColor(0);
else
draw_color = ds->GetCompatibleColor(_G(windowbackgroundcolor));
ds->DrawRect(Rect(x - 1, y - 1, x + wid + 1, y + hit + 1), draw_color);
}
int MyPushButton::pressedon(int mx, int my) {
int wasstat;
while (!ags_misbuttondown(kMouseLeft) == 0) {
wasstat = state;
state = mouseisinarea(mx, my);
update_polled_stuff();
if (wasstat != state) {
draw(get_gui_screen());
}
refresh_gui_screen();
WaitForNextFrame();
}
wasstat = state;
state = 0;
draw(get_gui_screen());
return wasstat;
}
int MyPushButton::processmessage(int /*mcode*/, int /*wParam*/, NumberPtr /*lParam*/) {
return -1; // doesn't support messages
}
} // namespace AGS3

View File

@@ -0,0 +1,39 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AGS_ENGINE_GUI_MY_PUSH_BUTTON_H
#define AGS_ENGINE_GUI_MY_PUSH_BUTTON_H
#include "ags/engine/gui/new_control.h"
namespace AGS3 {
struct MyPushButton : public NewControl {
char text[50];
MyPushButton(int xx, int yy, int wi, int hi, const char *tex);
void draw(Shared::Bitmap *ds) override;
int pressedon(int mx, int my) override;
int processmessage(int mcode, int wParam, NumberPtr lParam) override;
};
} // namespace AGS3
#endif

View File

@@ -0,0 +1,100 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ags/engine/gui/my_textbox.h"
#include "ags/shared/ac/keycode.h"
#include "ags/shared/font/fonts.h"
#include "ags/shared/gfx/bitmap.h"
#include "ags/engine/gui/gui_dialog_defines.h"
#include "ags/globals.h"
namespace AGS3 {
using namespace AGS::Shared;
MyTextBox::MyTextBox(int xx, int yy, int wii, const char *tee) {
x = xx;
y = yy;
wid = wii;
if (tee != nullptr)
Common::strcpy_s(text, tee);
else
text[0] = 0;
hit = TEXT_HT + 1;
}
void MyTextBox::draw(Bitmap *ds) {
ds->SetClip(RectWH(x, y, wid + 1, hit + 1));
color_t draw_color = ds->GetCompatibleColor(_G(windowbackgroundcolor));
ds->FillRect(Rect(x, y, x + wid, y + hit), draw_color);
draw_color = ds->GetCompatibleColor(0);
ds->DrawRect(Rect(x, y, x + wid, y + hit), draw_color);
color_t text_color = ds->GetCompatibleColor(0);
wouttextxy(ds, x + 2, y + 1, _G(cbuttfont), text_color, text);
char tbu[2] = "_";
wouttextxy(ds, x + 2 + get_text_width(text, _G(cbuttfont)), y + 1, _G(cbuttfont), text_color, tbu);
ds->ResetClip();
}
int MyTextBox::pressedon(int /*mx*/, int /*my*/) {
return 0;
}
int MyTextBox::processmessage(int mcode, int wParam, NumberPtr lParam) {
if (mcode == CTB_SETTEXT) {
snprintf(text, sizeof(text), "%s", (const char *)lParam.ptr());
needredraw = 1;
} else if (mcode == CTB_GETTEXT)
Common::strcpy_s((char *)lParam.ptr(), 260, text); // FIXME! dangerous
else if (mcode == CTB_KEYPRESS) {
// NOTE: this deprecated control does not support UTF-8
int key = wParam;
int uchar = lParam;
size_t len = strlen(text);
if (key == eAGSKeyCodeBackspace) {
if (len > 0)
text[len - 1] = 0;
drawandmouse();
return 0;
}
if (len >= TEXTBOX_MAXLEN - 1)
return 0; // buffer full;
if (uchar == 0)
return 0; // not a textual event
if ((uchar >= 128) && (!font_supports_extended_characters(_G(cbuttfont))))
return 0; // unsupported letter
if (get_text_width(text, _G(cbuttfont)) >= wid - 5)
return 0; // not enough control space
text[len] = uchar;
text[len + 1] = 0;
drawandmouse();
} else
return -1;
return 0;
}
} // namespace AGS3

View File

@@ -0,0 +1,40 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AGS_ENGINE_GUI_MY_TEXTBOX_H
#define AGS_ENGINE_GUI_MY_TEXTBOX_H
#include "ags/engine/gui/new_control.h"
namespace AGS3 {
#define TEXTBOX_MAXLEN 49
struct MyTextBox : public NewControl {
char text[TEXTBOX_MAXLEN + 1];
MyTextBox(int xx, int yy, int wii, const char *tee);
void draw(Shared::Bitmap *ds) override;
int pressedon(int mx, int my) override;
int processmessage(int mcode, int wParam, NumberPtr lParam) override;
};
} // namespace AGS3
#endif

View File

@@ -0,0 +1,74 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ags/engine/gui/new_control.h"
#include "ags/engine/gui/gui_dialog.h"
#include "ags/engine/gui/gui_dialog_defines.h"
#include "ags/globals.h"
namespace AGS3 {
NewControl::NewControl(int xx, int yy, int wi, int hi) {
x = xx;
y = yy;
wid = wi;
hit = hi;
state = 0;
typeandflags = 0;
wlevel = 0;
visible = 1;
enabled = 1;
needredraw = 1;
}
NewControl::NewControl() {
x = y = wid = hit = 0;
state = 0;
typeandflags = 0;
wlevel = 0;
visible = 1;
enabled = 1;
needredraw = 1;
}
int NewControl::mouseisinarea(int mx, int my) {
if (_G(topwindowhandle) != wlevel)
return 0;
if ((mx > x) && (mx < x + wid) && (my > y) && (my < y + hit))
return 1;
return 0;
}
void NewControl::drawifneeded() {
if (_G(topwindowhandle) != wlevel)
return;
if (needredraw) {
needredraw = 0;
draw(get_gui_screen());
}
}
void NewControl::drawandmouse() {
draw(get_gui_screen());
}
} // namespace AGS3

View File

@@ -0,0 +1,49 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef AGS_ENGINE_GUI_NEW_CONTROL_H
#define AGS_ENGINE_GUI_NEW_CONTROL_H
#include "ags/shared/gfx/bitmap.h"
namespace AGS3 {
using namespace AGS; // FIXME later
struct NewControl {
int x, y, wid, hit, state, typeandflags, wlevel;
int8 visible, enabled; // not implemented
int8 needredraw;
virtual void draw(Shared::Bitmap *ds) = 0;
virtual int pressedon(int mx, int my) = 0;
virtual int processmessage(int, int, NumberPtr) = 0;
NewControl(int xx, int yy, int wi, int hi);
NewControl();
virtual ~NewControl() {}
int mouseisinarea(int mx, int my);
void drawifneeded();
void drawandmouse();
};
} // namespace AGS3
#endif