mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 09:49:14 +00:00
TEENAGENT: Add constant values for screen width and height.
It is unlikely these will be changed, but the symbols make the code more readable.
This commit is contained in:
parent
890b83e3d8
commit
be4be025b9
@ -37,8 +37,8 @@ Surface *Animation::firstFrame() {
|
||||
Surface *r = frames;
|
||||
uint16 pos = READ_LE_UINT16(data + 1);
|
||||
if (pos != 0) {
|
||||
r->x = pos % 320;
|
||||
r->y = pos / 320;
|
||||
r->x = pos % screenWidth;
|
||||
r->y = pos / screenWidth;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@ -71,8 +71,8 @@ Surface *Animation::currentFrame(int dt) {
|
||||
index %= (data_size / 3);
|
||||
|
||||
if (pos != 0) {
|
||||
x = r->x = pos % 320;
|
||||
y = r->y = pos / 320;
|
||||
x = r->x = pos % screenWidth;
|
||||
y = r->y = pos / screenWidth;
|
||||
}
|
||||
} else {
|
||||
debugC(2, kDebugAnimation, "index %u", index);
|
||||
|
@ -4246,7 +4246,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) {
|
||||
{
|
||||
Walkbox *w = scene->getWalkbox(0);
|
||||
w->rect.left = 0;
|
||||
w->rect.bottom = 199;
|
||||
w->rect.bottom = screenHeight-1;
|
||||
w->save();
|
||||
}
|
||||
setLan(1, 0xff);
|
||||
|
@ -58,7 +58,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color)
|
||||
byte *glyph = data + READ_LE_UINT16(data + idx * 2);
|
||||
|
||||
int h = glyph[0], w = glyph[1];
|
||||
if (surface == NULL || surface->pixels == NULL || y + h <= 0 || y >= 200 || x + w <= 0 || x >= 320)
|
||||
if (surface == NULL || surface->pixels == NULL || y + h <= 0 || y >= screenHeight || x + w <= 0 || x >= screenWidth)
|
||||
return w - width_pack;
|
||||
|
||||
int i0 = 0, j0 = 0;
|
||||
@ -119,7 +119,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, const Common::String
|
||||
for (uint k = 0; k < line.size(); ++k) {
|
||||
xp += render(surface, xp, y, line[k], color);
|
||||
}
|
||||
} else if (y >= 200)
|
||||
} else if (y >= screenHeight)
|
||||
break;
|
||||
|
||||
y += height;
|
||||
|
@ -202,7 +202,7 @@ bool Inventory::processEvent(const Common::Event &event) {
|
||||
return true;
|
||||
//activate(false);
|
||||
int w = _vm->res->font7.render(NULL, 0, 0, _hoveredObj->description, 0xd1);
|
||||
_vm->scene->displayMessage(_hoveredObj->description, 0xd1, Common::Point((320 - w) / 2, 162));
|
||||
_vm->scene->displayMessage(_hoveredObj->description, 0xd1, Common::Point((screenWidth - w) / 2, 162));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ void Inventory::Item::render(Inventory *inventory, uint item_id, Graphics::Surfa
|
||||
|
||||
if (_hovered && inventory->_vm->scene->getMessage().empty()) {
|
||||
int w = inventory->_vm->res->font7.render(NULL, 0, 0, name, 0xd1, true);
|
||||
inventory->_vm->res->font7.render(dst, (320 - w) / 2, 180, name, 0xd1, true);
|
||||
inventory->_vm->res->font7.render(dst, (screenWidth - w) / 2, 180, name, 0xd1, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ struct Rect {
|
||||
}
|
||||
|
||||
inline bool valid() const {
|
||||
return left >= 0 && left < 320 && right >= 0 && right < 320 && top >= 0 && top < 200 && bottom >= 0 && bottom < 200;
|
||||
return left >= 0 && left < screenWidth && right >= 0 && right < screenWidth && top >= 0 && top < screenHeight && bottom >= 0 && bottom < screenHeight;
|
||||
}
|
||||
|
||||
void render(Graphics::Surface *surface, uint8 color) const;
|
||||
|
@ -91,7 +91,7 @@ void Scene::warp(const Common::Point &_point, byte o) {
|
||||
|
||||
bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Point &dst) const {
|
||||
const Common::Array<Walkbox> &scene_walkboxes = walkboxes[_id - 1];
|
||||
if (dst.x < 0 || dst.x > 319 || dst.y < 0 || dst.y > 199)
|
||||
if (dst.x < 0 || dst.x >= screenWidth || dst.y < 0 || dst.y >= screenHeight)
|
||||
return false;
|
||||
|
||||
debugC(1, kDebugScene, "findPath %d,%d -> %d,%d", src.x, src.y, dst.x, dst.y);
|
||||
@ -373,7 +373,7 @@ void Scene::init(int id, const Common::Point &pos) {
|
||||
custom_animation[i].free();
|
||||
|
||||
if (background.pixels == NULL)
|
||||
background.create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
|
||||
background.create(screenWidth, screenHeight, Graphics::PixelFormat::createFormatCLUT8());
|
||||
|
||||
warp(pos);
|
||||
|
||||
@ -1201,12 +1201,12 @@ Common::Point Scene::messagePosition(const Common::String &str, Common::Point me
|
||||
message_position.x -= w / 2;
|
||||
message_position.y -= h;
|
||||
|
||||
if (message_position.x + w > 320)
|
||||
message_position.x = 320 - w;
|
||||
if (message_position.x + w > screenWidth)
|
||||
message_position.x = screenWidth - w;
|
||||
if (message_position.x < 0)
|
||||
message_position.x = 0;
|
||||
if (message_position.y + h > 320)
|
||||
message_position.y = 200 - h;
|
||||
if (message_position.y + h > screenWidth) // FIXME - Error? Should be screenHeight?
|
||||
message_position.y = screenHeight - h;
|
||||
if (message_position.y < 0)
|
||||
message_position.y = 0;
|
||||
|
||||
|
@ -46,8 +46,8 @@ void Surface::load(Common::SeekableReadStream &stream, Type type) {
|
||||
|
||||
if (type != kTypeLan) {
|
||||
uint16 pos = stream.readUint16LE();
|
||||
x = pos % 320;
|
||||
y = pos / 320;
|
||||
x = pos % screenWidth;
|
||||
y = pos / screenWidth;
|
||||
}
|
||||
|
||||
debugC(0, kDebugSurface, "declared info: %ux%u (%04xx%04x) -> %u,%u", w_, h_, w_, h_, x, y);
|
||||
|
@ -305,7 +305,7 @@ bool TeenAgentEngine::showCDLogo() {
|
||||
if (!cdlogo.exists("cdlogo.res") || !cdlogo.open("cdlogo.res"))
|
||||
return true;
|
||||
|
||||
const uint bgSize = 320 * 200;
|
||||
const uint bgSize = screenWidth * screenHeight;
|
||||
const uint paletteSize = 3 * 256;
|
||||
|
||||
byte *bg = (byte *)malloc(bgSize);
|
||||
@ -325,7 +325,7 @@ bool TeenAgentEngine::showCDLogo() {
|
||||
palette[c] *= 4;
|
||||
|
||||
_system->getPaletteManager()->setPalette(palette, 0, 256);
|
||||
_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
|
||||
_system->copyRectToScreen(bg, screenWidth, 0, 0, screenWidth, screenHeight);
|
||||
_system->updateScreen();
|
||||
|
||||
free(bg);
|
||||
@ -351,7 +351,7 @@ bool TeenAgentEngine::showLogo() {
|
||||
if (!frame)
|
||||
return true;
|
||||
|
||||
const uint bgSize = 320 * 200;
|
||||
const uint bgSize = screenWidth * screenHeight;
|
||||
const uint paletteSize = 3 * 256;
|
||||
|
||||
byte *bg = (byte *)malloc(bgSize);
|
||||
@ -384,7 +384,7 @@ bool TeenAgentEngine::showLogo() {
|
||||
return r > 0 ? true : false;
|
||||
}
|
||||
}
|
||||
_system->copyRectToScreen(bg, 320, 0, 0, 320, 200);
|
||||
_system->copyRectToScreen(bg, screenWidth, 0, 0, screenWidth, screenHeight);
|
||||
|
||||
frame.reset(logo.getStream(i));
|
||||
if (!frame) {
|
||||
@ -468,7 +468,7 @@ bool TeenAgentEngine::showMetropolis() {
|
||||
|
||||
Graphics::Surface *surface = _system->lockScreen();
|
||||
if (logo_y > 0) {
|
||||
surface->fillRect(Common::Rect(0, 0, 320, logo_y), 0);
|
||||
surface->fillRect(Common::Rect(0, 0, screenWidth, logo_y), 0);
|
||||
}
|
||||
|
||||
{
|
||||
@ -532,7 +532,7 @@ Common::Error TeenAgentEngine::run() {
|
||||
|
||||
Common::EventManager *_event = _system->getEventManager();
|
||||
|
||||
initGraphics(320, 200, false);
|
||||
initGraphics(screenWidth, screenHeight, false);
|
||||
console = new Console(this);
|
||||
|
||||
scene = new Scene(this);
|
||||
@ -673,7 +673,7 @@ Common::Error TeenAgentEngine::run() {
|
||||
name += current_object->name;
|
||||
|
||||
uint w = res->font7.render(NULL, 0, 0, name, 0xd1);
|
||||
res->font7.render(surface, (320 - w) / 2, 180, name, 0xd1, true);
|
||||
res->font7.render(surface, (screenWidth - w) / 2, 180, name, 0xd1, true);
|
||||
#if 0
|
||||
if (current_object) {
|
||||
current_object->rect.render(surface, 0x80);
|
||||
@ -792,7 +792,7 @@ void TeenAgentEngine::displayCredits(uint16 addr, uint16 timer) {
|
||||
event.message += "\n";
|
||||
}
|
||||
int w = res->font8.render(NULL, 0, 0, event.message, 0xd1);
|
||||
event.dst.x = (320 - w) / 2;
|
||||
event.dst.x = (screenWidth - w) / 2;
|
||||
event.timer = timer;
|
||||
scene->push(event);
|
||||
}
|
||||
@ -800,13 +800,13 @@ void TeenAgentEngine::displayCredits(uint16 addr, uint16 timer) {
|
||||
void TeenAgentEngine::displayCredits() {
|
||||
SceneEvent event(SceneEvent::kCredits);
|
||||
event.message = parseMessage(dsAddr_finalCredits7);
|
||||
event.dst.y = 200;
|
||||
event.dst.y = screenHeight;
|
||||
|
||||
int lines = 1;
|
||||
for (uint i = 0; i < event.message.size(); ++i)
|
||||
if (event.message[i] == '\n')
|
||||
++lines;
|
||||
event.dst.x = (320 - res->font7.render(NULL, 0, 0, event.message, 0xd1)) / 2;
|
||||
event.dst.x = (screenWidth - res->font7.render(NULL, 0, 0, event.message, 0xd1)) / 2;
|
||||
event.timer = 11 * lines - event.dst.y + 22;
|
||||
debug(2, "credits = %s", event.message.c_str());
|
||||
scene->push(event);
|
||||
|
@ -67,10 +67,11 @@ enum {
|
||||
kDebugSurface = (1 << 10)
|
||||
};
|
||||
|
||||
const uint16 screenWidth = 320;
|
||||
const uint16 screenHeight = 200;
|
||||
|
||||
class TeenAgentEngine : public Engine {
|
||||
public:
|
||||
enum Action { kActionNone, kActionExamine, kActionUse };
|
||||
|
||||
TeenAgentEngine(OSystem *system, const ADGameDescription *gd);
|
||||
~TeenAgentEngine();
|
||||
|
||||
@ -83,6 +84,8 @@ public:
|
||||
|
||||
void init();
|
||||
|
||||
enum Action { kActionNone, kActionExamine, kActionUse };
|
||||
|
||||
void examine(const Common::Point &point, Object *object);
|
||||
void use(Object *object);
|
||||
inline void cancel() { action = kActionNone; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user