[Scummvm-git-logs] scummvm master -> c9f59c8008094895619d52f146cda73253e0ce89
dreammaster
paulfgilbert at gmail.com
Sun Feb 16 05:42:43 UTC 2020
This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
962c7967b2 ULTIMA8: Field renaming for Gump classes
4f0cda070f ULTIMA8: More field renaming of gump classes
17c6ce4102 ULTIMA8: Renaming kernel class fields
53acfaa556 ULTIMA8: Renaming misc folder class fields
d37b0bed23 ULTIMA8: Renaming usecode folder class fields
ee1417a6d3 ULTIMA8: Renaming filesys folder class fields
c9f59c8008 ULTIMA8: Miscellaneous graphics and gumps field changes
Commit: 962c7967b23a6142bcac0db1c774fc9bb2f62836
https://github.com/scummvm/scummvm/commit/962c7967b23a6142bcac0db1c774fc9bb2f62836
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-15T21:39:28-08:00
Commit Message:
ULTIMA8: Field renaming for Gump classes
Changed paths:
engines/ultima/ultima8/games/game_data.cpp
engines/ultima/ultima8/graphics/frame_id.cpp
engines/ultima/ultima8/graphics/frame_id.h
engines/ultima/ultima8/gumps/ask_gump.cpp
engines/ultima/ultima8/gumps/ask_gump.h
engines/ultima/ultima8/gumps/bark_gump.cpp
engines/ultima/ultima8/gumps/bind_gump.cpp
engines/ultima/ultima8/gumps/book_gump.cpp
engines/ultima/ultima8/gumps/console_gump.cpp
engines/ultima/ultima8/gumps/container_gump.cpp
engines/ultima/ultima8/gumps/container_gump.h
engines/ultima/ultima8/gumps/controls_gump.cpp
engines/ultima/ultima8/gumps/credits_gump.cpp
engines/ultima/ultima8/gumps/credits_gump.h
engines/ultima/ultima8/gumps/desktop_gump.cpp
engines/ultima/ultima8/gumps/game_map_gump.cpp
engines/ultima/ultima8/gumps/game_map_gump.h
engines/ultima/ultima8/gumps/gump.cpp
engines/ultima/ultima8/gumps/gump.h
engines/ultima/ultima8/gumps/inverter_gump.cpp
engines/ultima/ultima8/gumps/item_relative_gump.cpp
engines/ultima/ultima8/gumps/item_relative_gump.h
engines/ultima/ultima8/gumps/menu_gump.cpp
engines/ultima/ultima8/gumps/message_box_gump.cpp
engines/ultima/ultima8/gumps/mini_stats_gump.cpp
engines/ultima/ultima8/gumps/mini_stats_gump.h
engines/ultima/ultima8/gumps/modal_gump.cpp
engines/ultima/ultima8/gumps/modal_gump.h
engines/ultima/ultima8/gumps/movie_gump.cpp
engines/ultima/ultima8/gumps/movie_gump.h
engines/ultima/ultima8/gumps/options_gump.cpp
engines/ultima/ultima8/gumps/paged_gump.cpp
engines/ultima/ultima8/gumps/paperdoll_gump.cpp
engines/ultima/ultima8/gumps/paperdoll_gump.h
engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
engines/ultima/ultima8/gumps/quit_gump.cpp
engines/ultima/ultima8/gumps/readable_gump.cpp
engines/ultima/ultima8/gumps/scaler_gump.cpp
engines/ultima/ultima8/gumps/scroll_gump.cpp
engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
engines/ultima/ultima8/gumps/shape_viewer_gump.h
engines/ultima/ultima8/gumps/slider_gump.cpp
engines/ultima/ultima8/gumps/target_gump.cpp
engines/ultima/ultima8/gumps/u8_save_gump.cpp
engines/ultima/ultima8/gumps/u8_save_gump.h
engines/ultima/ultima8/gumps/widgets/button_widget.cpp
engines/ultima/ultima8/gumps/widgets/button_widget.h
engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
engines/ultima/ultima8/gumps/widgets/game_widget.cpp
engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
engines/ultima/ultima8/gumps/widgets/sliding_widget.h
engines/ultima/ultima8/gumps/widgets/text_widget.cpp
diff --git a/engines/ultima/ultima8/games/game_data.cpp b/engines/ultima/ultima8/games/game_data.cpp
index 107e1c2..182a1bd 100644
--- a/engines/ultima/ultima8/games/game_data.cpp
+++ b/engines/ultima/ultima8/games/game_data.cpp
@@ -123,16 +123,16 @@ ShapeArchive *GameData::getShapeFlex(uint16 flexId) const {
}
Shape *GameData::getShape(FrameID f) const {
- ShapeArchive *sf = getShapeFlex(f.flexid);
+ ShapeArchive *sf = getShapeFlex(f._flexId);
if (!sf) return 0;
- Shape *shape = sf->getShape(f.shapenum);
+ Shape *shape = sf->getShape(f._shapeNum);
return shape;
}
ShapeFrame *GameData::getFrame(FrameID f) const {
Shape *shape = getShape(f);
if (!shape) return 0;
- ShapeFrame *frame = shape->getFrame(f.framenum);
+ ShapeFrame *frame = shape->getFrame(f._frameNum);
return frame;
}
@@ -192,7 +192,7 @@ FrameID GameData::translate(FrameID f) {
ConfigFileManager *config = ConfigFileManager::get_instance();
istring key = "language/";
- switch (f.flexid) {
+ switch (f._flexId) {
case GUMPS:
key += "gumps/";
break;
@@ -201,7 +201,7 @@ FrameID GameData::translate(FrameID f) {
}
char buf[100];
- sprintf(buf, "%d,%d", f.shapenum, f.framenum);
+ sprintf(buf, "%d,%d", f._shapeNum, f._frameNum);
key += buf;
if (!config->exists(key))
@@ -211,8 +211,8 @@ FrameID GameData::translate(FrameID f) {
config->get(key, trans);
FrameID t;
- t.flexid = f.flexid;
- int n = sscanf(trans.c_str(), "%u,%u", &t.shapenum, &t.framenum);
+ t._flexId = f._flexId;
+ int n = sscanf(trans.c_str(), "%u,%u", &t._shapeNum, &t._frameNum);
if (n != 2) {
perr << "Invalid shape translation: " << trans << Std::endl;
return f;
@@ -436,10 +436,10 @@ void GameData::setupTTFOverrides(const char *configkey, bool SJIS) {
}
}
-SpeechFlex *GameData::getSpeechFlex(uint32 shapenum) {
- if (shapenum >= speech.size()) return 0;
+SpeechFlex *GameData::getSpeechFlex(uint32 _shapeNum) {
+ if (_shapeNum >= speech.size()) return 0;
- SpeechFlex **s = speech[shapenum];
+ SpeechFlex **s = speech[_shapeNum];
if (s) return *s;
s = new SpeechFlex*;
@@ -449,7 +449,7 @@ SpeechFlex *GameData::getSpeechFlex(uint32 shapenum) {
Std::string u8_sound_ = "@game/sound/";
char num_flx [32];
- snprintf(num_flx , 32, "%i.flx", shapenum);
+ snprintf(num_flx , 32, "%i.flx", _shapeNum);
char langletter = gameinfo->getLanguageFileLetter();
if (!langletter) {
@@ -462,7 +462,7 @@ SpeechFlex *GameData::getSpeechFlex(uint32 shapenum) {
*s = new SpeechFlex(sflx);
}
- speech[shapenum] = s;
+ speech[_shapeNum] = s;
return *s;
}
diff --git a/engines/ultima/ultima8/graphics/frame_id.cpp b/engines/ultima/ultima8/graphics/frame_id.cpp
index 7b41d84..e5832ae 100644
--- a/engines/ultima/ultima8/graphics/frame_id.cpp
+++ b/engines/ultima/ultima8/graphics/frame_id.cpp
@@ -30,15 +30,15 @@ namespace Ultima {
namespace Ultima8 {
void FrameID::save(ODataSource *ods) {
- ods->write2(flexid);
- ods->write4(shapenum);
- ods->write4(framenum);
+ ods->write2(_flexId);
+ ods->write4(_shapeNum);
+ ods->write4(_frameNum);
}
bool FrameID::load(IDataSource *ids) {
- flexid = ids->read2();
- shapenum = ids->read4();
- framenum = ids->read4();
+ _flexId = ids->read2();
+ _shapeNum = ids->read4();
+ _frameNum = ids->read4();
return true;
}
diff --git a/engines/ultima/ultima8/graphics/frame_id.h b/engines/ultima/ultima8/graphics/frame_id.h
index c9d864b..1e6098d 100644
--- a/engines/ultima/ultima8/graphics/frame_id.h
+++ b/engines/ultima/ultima8/graphics/frame_id.h
@@ -32,13 +32,13 @@ class IDataSource;
class ODataSource;
struct FrameID {
- uint16 flexid;
- uint32 shapenum;
- uint32 framenum;
+ uint16 _flexId;
+ uint32 _shapeNum;
+ uint32 _frameNum;
FrameID() { }
FrameID(uint16 flex, uint32 shape, uint32 frame)
- : flexid(flex), shapenum(shape), framenum(frame) {
+ : _flexId(flex), _shapeNum(shape), _frameNum(frame) {
}
void save(ODataSource *ods);
diff --git a/engines/ultima/ultima8/gumps/ask_gump.cpp b/engines/ultima/ultima8/gumps/ask_gump.cpp
index 36451b6..44f1029 100644
--- a/engines/ultima/ultima8/gumps/ask_gump.cpp
+++ b/engines/ultima/ultima8/gumps/ask_gump.cpp
@@ -35,29 +35,28 @@ namespace Ultima8 {
// p_dynamic_class stuff
DEFINE_RUNTIME_CLASSTYPE_CODE(AskGump, ItemRelativeGump)
-AskGump::AskGump()
- : ItemRelativeGump(), answers(0) {
+AskGump::AskGump() : ItemRelativeGump(), _answers(0) {
}
-AskGump::AskGump(uint16 owner_, UCList *answers_) :
- ItemRelativeGump(0, 0, 0, 0, owner_, FLAG_KEEP_VISIBLE, LAYER_ABOVE_NORMAL),
- answers(new UCList(2)) {
- answers->copyStringList(*answers_);
+AskGump::AskGump(uint16 owner, UCList *answers) :
+ ItemRelativeGump(0, 0, 0, 0, owner, FLAG_KEEP_VISIBLE, LAYER_ABOVE_NORMAL),
+ _answers(new UCList(2)) {
+ _answers->copyStringList(*answers);
}
AskGump::~AskGump() {
- answers->freeStrings();
- delete answers;
+ _answers->freeStrings();
+ delete _answers;
}
// Init the gump, call after construction
void AskGump::InitGump(Gump *newparent, bool take_focus) {
// OK, this is a bit of a hack, but it's how it has to be
int fontnum;
- if (owner == 1) fontnum = 6;
- else if (owner > 256) fontnum = 8;
- else switch (owner % 3) {
+ if (_owner == 1) fontnum = 6;
+ else if (_owner > 256) fontnum = 8;
+ else switch (_owner % 3) {
case 1:
fontnum = 5;
break;
@@ -76,9 +75,9 @@ void AskGump::InitGump(Gump *newparent, bool take_focus) {
// This is a hack. We init the gump twice...
ItemRelativeGump::InitGump(newparent, take_focus);
- for (unsigned int i = 0; i < answers->getSize(); ++i) {
+ for (unsigned int i = 0; i < _answers->getSize(); ++i) {
Std::string str_answer = "@ ";
- str_answer += UCMachine::get_instance()->getString(answers->getStringIndex(i));
+ str_answer += UCMachine::get_instance()->getString(_answers->getStringIndex(i));
ButtonWidget *child = new ButtonWidget(px, py, str_answer,
true, fontnum);
@@ -87,17 +86,17 @@ void AskGump::InitGump(Gump *newparent, bool take_focus) {
Rect cd;
child->GetDims(cd);
- if (i + 1 < answers->getSize())
+ if (i + 1 < _answers->getSize())
cd.h += child->getVlead();
if (px + cd.w > 160 && px != 0) {
- py = dims.h;
+ py = _dims.h;
px = 0;
child->Move(px, py);
}
- if (cd.w + px > dims.w) dims.w = cd.w + px;
- if (cd.h + py > dims.h) dims.h = cd.h + py;
+ if (cd.w + px > _dims.w) _dims.w = cd.w + px;
+ if (cd.h + py > _dims.h) _dims.h = cd.h + py;
px += cd.w + 4;
}
@@ -108,12 +107,12 @@ void AskGump::InitGump(Gump *newparent, bool take_focus) {
void AskGump::ChildNotify(Gump *child, uint32 message) {
if (message == ButtonWidget::BUTTON_CLICK) {
- uint16 s = answers->getStringIndex(child->GetIndex());
- process_result = s;
+ uint16 s = _answers->getStringIndex(child->GetIndex());
+ _processResult = s;
- // answers' strings are going to be deleted, so make sure
+ // _answers' strings are going to be deleted, so make sure
// the response string won't be deleted
- answers->removeString(s, true); //!! assuming that answers doesn't
+ _answers->removeString(s, true); //!! assuming that answers doesn't
//!! contain two identical strings
Close();
}
@@ -122,28 +121,28 @@ void AskGump::ChildNotify(Gump *child, uint32 message) {
void AskGump::saveData(ODataSource *ods) {
ItemRelativeGump::saveData(ods);
- answers->save(ods);
+ _answers->save(ods);
}
bool AskGump::loadData(IDataSource *ids, uint32 version) {
if (!ItemRelativeGump::loadData(ids, version)) return false;
- answers = new UCList(2);
- answers->load(ids, version);
+ _answers = new UCList(2);
+ _answers->load(ids, version);
// HACK ALERT
int px = 0, py = 0;
- dims.w = 0;
- dims.h = 0;
+ _dims.w = 0;
+ _dims.h = 0;
- for (unsigned int i = 0; i < answers->getSize(); ++i) {
+ for (unsigned int i = 0; i < _answers->getSize(); ++i) {
ButtonWidget *child = 0;
Std::list<Gump *>::iterator it;
- for (it = children.begin(); it != children.end(); ++it) {
+ for (it = _children.begin(); it != _children.end(); ++it) {
if ((*it)->GetIndex() != (int)i) continue;
child = p_dynamic_cast<ButtonWidget *>(*it);
if (!child) continue;
@@ -155,13 +154,13 @@ bool AskGump::loadData(IDataSource *ids, uint32 version) {
child->GetDims(cd);
if (px + cd.w > 160 && px != 0) {
- py = dims.h;
+ py = _dims.h;
px = 0;
}
child->Move(px, py);
- if (cd.w + px > dims.w) dims.w = cd.w + px;
- if (cd.h + py > dims.h) dims.h = cd.h + py;
+ if (cd.w + px > _dims.w) _dims.w = cd.w + px;
+ if (cd.h + py > _dims.h) _dims.h = cd.h + py;
px += cd.w + 4;
}
diff --git a/engines/ultima/ultima8/gumps/ask_gump.h b/engines/ultima/ultima8/gumps/ask_gump.h
index d1f95b0..0398444 100644
--- a/engines/ultima/ultima8/gumps/ask_gump.h
+++ b/engines/ultima/ultima8/gumps/ask_gump.h
@@ -32,13 +32,13 @@ namespace Ultima8 {
class UCList;
class AskGump : public ItemRelativeGump {
- UCList *answers;
+ UCList *_answers;
public:
// p_dynamic_class stuff
ENABLE_RUNTIME_CLASSTYPE()
AskGump();
- AskGump(uint16 owner_, UCList *answers_);
+ AskGump(uint16 owner, UCList *answers);
~AskGump() override;
// Init the gump, call after construction
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index 52e2239..ab8df3d 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -57,9 +57,9 @@ BarkGump::~BarkGump(void) {
void BarkGump::InitGump(Gump *newparent, bool take_focus) {
// OK, this is a bit of a hack, but it's how it has to be
int fontnum;
- if (owner == 1) fontnum = 6;
- else if (owner > 256) fontnum = 8;
- else switch (owner % 3) {
+ if (_owner == 1) fontnum = 6;
+ else if (_owner > 256) fontnum = 8;
+ else switch (_owner % 3) {
case 1:
fontnum = 5;
break;
@@ -86,7 +86,7 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
AudioProcess *ap = AudioProcess::get_instance();
speechlength = 0;
if (speechshapenum && ap) {
- if (ap->playSpeech(barked, speechshapenum, owner)) {
+ if (ap->playSpeech(barked, speechshapenum, _owner)) {
speechlength = ap->getSpeechLength(barked, speechshapenum) / 33;
if (speechlength == 0) speechlength = 1;
@@ -111,8 +111,8 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
} else {
counter = d.h * textdelay;
}
- dims.h = d.h;
- dims.w = d.w;
+ _dims.h = d.h;
+ _dims.w = d.w;
// Wait with ItemRelativeGump initialization until we calculated our size.
ItemRelativeGump::InitGump(newparent, take_focus);
@@ -130,8 +130,8 @@ bool BarkGump::NextText() {
} else {
counter = d.h * textdelay;
}
- dims.h = d.h;
- dims.w = d.w;
+ _dims.h = d.h;
+ _dims.w = d.w;
return true;
}
@@ -174,7 +174,7 @@ Gump *BarkGump::OnMouseDown(int button, int32 mx, int32 my) {
if (!NextText()) {
if (speechlength) {
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->stopSpeech(barked, speechshapenum, owner);
+ if (ap) ap->stopSpeech(barked, speechshapenum, _owner);
}
Close();
}
@@ -222,8 +222,8 @@ bool BarkGump::loadData(IDataSource *ids, uint32 version) {
Rect d;
widget->GetDims(d);
counter = d.h * textdelay;
- dims.h = d.h;
- dims.w = d.w;
+ _dims.h = d.h;
+ _dims.w = d.w;
return true;
}
diff --git a/engines/ultima/ultima8/gumps/bind_gump.cpp b/engines/ultima/ultima8/gumps/bind_gump.cpp
index 5dd28e3..df92dba 100644
--- a/engines/ultima/ultima8/gumps/bind_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bind_gump.cpp
@@ -58,7 +58,7 @@ void BindGump::InitGump(Gump *newparent, bool take_focus) {
void BindGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
uint32 rgb = 0x000000;
- surf->Fill32(rgb, 0, 0, dims.w, dims.h);
+ surf->Fill32(rgb, 0, 0, _dims.w, _dims.h);
Gump::PaintThis(surf, lerp_factor, scaled);
}
diff --git a/engines/ultima/ultima8/gumps/book_gump.cpp b/engines/ultima/ultima8/gumps/book_gump.cpp
index 093b120..843a169 100644
--- a/engines/ultima/ultima8/gumps/book_gump.cpp
+++ b/engines/ultima/ultima8/gumps/book_gump.cpp
@@ -57,7 +57,7 @@ BookGump::~BookGump(void) {
void BookGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- // Create the TextWidgets (NOTE: they _must_ have exactly the same dims)
+ // Create the TextWidgets (NOTE: they _must_ have exactly the same _dims)
TextWidget *widget = new TextWidget(9, 5, text, true, 9, 123, 129); //!! constants
widget->InitGump(this);
textwidgetL = widget->getObjId();
@@ -77,8 +77,8 @@ void BookGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = shapeP->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
}
void BookGump::NextText() {
diff --git a/engines/ultima/ultima8/gumps/console_gump.cpp b/engines/ultima/ultima8/gumps/console_gump.cpp
index 5180fbe..3d9f9a1 100644
--- a/engines/ultima/ultima8/gumps/console_gump.cpp
+++ b/engines/ultima/ultima8/gumps/console_gump.cpp
@@ -59,16 +59,16 @@ ConsoleGump::~ConsoleGump() {
void ConsoleGump::RenderSurfaceChanged() {
// Resize the desktop gump to match the RenderSurface
Rect new_dims;
- parent->GetDims(new_dims);
+ _parent->GetDims(new_dims);
con->CheckResize(new_dims.w);
- dims.w = new_dims.w;
- dims.h = new_dims.h;
+ _dims.w = new_dims.w;
+ _dims.h = new_dims.h;
Gump::RenderSurfaceChanged();
}
void ConsoleGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
- int h = dims.h;
+ int h = _dims.h;
uint32 next_frame = scroll_frame + 1;
Gump::PaintThis(surf, lerp_factor, scaled);
@@ -99,18 +99,18 @@ void ConsoleGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
h = (h * ((scroll_frame * (256 - lerp_factor))
+ (next_frame * lerp_factor))) >> 11;
- if (h > dims.h)
- h = dims.h;
+ if (h > _dims.h)
+ h = _dims.h;
else if (h < 0)
h = 0;
default:
break;
}
- //surf->FillBlended(0x60000000,0,0,dims.w,h);
+ //surf->FillBlended(0x60000000,0,0,_dims.w,h);
// This line shows some draw lag when uncommented
- //surf->Fill32(0x00FFFFFF,0,h-1,dims.w,h);
+ //surf->Fill32(0x00FFFFFF,0,h-1,_dims.w,h);
con->DrawConsole(surf, h);
}
diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index 4266df2..82fc029 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -54,12 +54,12 @@ ContainerGump::ContainerGump()
}
-ContainerGump::ContainerGump(Shape *shape_, uint32 framenum_, uint16 owner_,
- uint32 Flags_, int32 layer_)
- : ItemRelativeGump(0, 0, 5, 5, owner_, Flags_, layer_),
+ContainerGump::ContainerGump(Shape *shape, uint32 frameNum, uint16 owner,
+ uint32 flags, int32 layer)
+ : ItemRelativeGump(0, 0, 5, 5, owner, flags, layer),
display_dragging(false) {
- shape = shape_;
- framenum = framenum_;
+ _shape = shape;
+ _frameNum = frameNum;
}
ContainerGump::~ContainerGump() {
@@ -67,17 +67,17 @@ ContainerGump::~ContainerGump() {
}
void ContainerGump::InitGump(Gump *newparent, bool take_focus) {
- ShapeFrame *sf = shape->getFrame(framenum);
+ ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
// Wait with ItemRelativeGump initialization until we calculated our size.
ItemRelativeGump::InitGump(newparent, take_focus);
// make every item enter the fast area
- Container *c = getContainer(owner);
+ Container *c = getContainer(_owner);
if (!c) return; // Container gone!?
@@ -114,7 +114,7 @@ void ContainerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
// paint self
ItemRelativeGump::PaintThis(surf, lerp_factor, scaled);
- Container *c = getContainer(owner);
+ Container *c = getContainer(_owner);
if (!c) {
// Container gone!?
@@ -164,7 +164,7 @@ uint16 ContainerGump::TraceObjId(int32 mx, int32 my) {
ParentToGump(mx, my);
- Container *c = getContainer(owner);
+ Container *c = getContainer(_owner);
if (!c) return 0; // Container gone!?
@@ -201,7 +201,7 @@ bool ContainerGump::GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy,
Item *item = getItem(itemid);
Item *parent_ = item->getParentAsContainer();
if (!parent_) return false;
- if (parent_->getObjId() != owner) return false;
+ if (parent_->getObjId() != _owner) return false;
//!!! need to use lerp_factor
@@ -217,7 +217,7 @@ bool ContainerGump::GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy,
// we don't want our position to depend on Gump of parent container
// so change the default ItemRelativeGump behaviour
void ContainerGump::GetItemLocation(int32 lerp_factor) {
- Item *it = getItem(owner);
+ Item *it = getItem(_owner);
if (!it) {
// This shouldn't ever happen, the GumpNotifyProcess should
@@ -248,17 +248,17 @@ void ContainerGump::GetItemLocation(int32 lerp_factor) {
gump->GumpToScreenSpace(gx, gy);
// Convert the screenspace coords into the coords of us
- if (parent) parent->ScreenSpaceToGump(gx, gy);
+ if (_parent) _parent->ScreenSpaceToGump(gx, gy);
// Set x and y, and center us over it
- ix = gx - dims.w / 2;
- iy = gy - dims.h;
+ ix = gx - _dims.w / 2;
+ iy = gy - _dims.h;
}
void ContainerGump::Close(bool no_del) {
// close any gumps belonging to contents
// and make every item leave the fast area
- Container *c = getContainer(owner);
+ Container *c = getContainer(_owner);
if (!c) return; // Container gone!?
Std::list<Item *> &contents = c->contents;
@@ -273,7 +273,7 @@ void ContainerGump::Close(bool no_del) {
item->leaveFastArea(); // Can destroy the item
}
- Item *o = getItem(owner);
+ Item *o = getItem(_owner);
if (o)
o->clearGump(); //!! is this the appropriate place?
@@ -298,7 +298,7 @@ Container *ContainerGump::getTargetContainer(Item *item, int mx, int my) {
}
if (!targetcontainer)
- targetcontainer = getContainer(owner);
+ targetcontainer = getContainer(_owner);
return targetcontainer;
}
@@ -344,7 +344,7 @@ void ContainerGump::OnMouseDouble(int button, int32 mx, int32 my) {
uint16 objID = TraceObjId(mx, my);
if (objID == getObjId()) {
- objID = owner; // use container when double click on self
+ objID = _owner; // use container when double click on self
}
Item *item = getItem(objID);
@@ -352,7 +352,7 @@ void ContainerGump::OnMouseDouble(int button, int32 mx, int32 my) {
item->dumpInfo();
MainActor *avatar = getMainActor();
- if (objID == owner || avatar->canReach(item, 128)) { // CONSTANT!
+ if (objID == _owner || avatar->canReach(item, 128)) { // CONSTANT!
// call the 'use' event
item->use();
} else {
@@ -367,7 +367,7 @@ bool ContainerGump::StartDraggingItem(Item *item, int mx, int my) {
// probably don't need to check if item can be moved, since it shouldn't
// be in a container otherwise
- Container *c = getContainer(owner);
+ Container *c = getContainer(_owner);
assert(c);
// check if the container the item is in is in range
@@ -383,7 +383,7 @@ bool ContainerGump::StartDraggingItem(Item *item, int mx, int my) {
}
bool ContainerGump::DraggingItem(Item *item, int mx, int my) {
- Container *c = getContainer(owner);
+ Container *c = getContainer(_owner);
assert(c);
// check if the container the item is in is in range
@@ -478,7 +478,7 @@ void ContainerGump::DropItem(Item *item, int mx, int my) {
splittarget->moveToContainer(targetcontainer);
splittarget->randomGumpLocation();
} else {
- splittarget->moveToContainer(getContainer(owner));
+ splittarget->moveToContainer(getContainer(_owner));
splittarget->setGumpLocation(dragging_x, dragging_y);
}
}
@@ -513,7 +513,7 @@ void ContainerGump::DropItem(Item *item, int mx, int my) {
targetcontainer = getTargetContainer(item, mx, my);
assert(targetcontainer);
- if (targetcontainer->getObjId() != owner) {
+ if (targetcontainer->getObjId() != _owner) {
if (item->getParent() == targetcontainer->getObjId()) {
// already in this container, so move item to let it be drawn
// on top of all other items
@@ -525,7 +525,7 @@ void ContainerGump::DropItem(Item *item, int mx, int my) {
} else {
// add item to self
- if (item->getParent() == owner) {
+ if (item->getParent() == _owner) {
targetcontainer->moveItemToEnd(item);
} else {
item->moveToContainer(targetcontainer);
diff --git a/engines/ultima/ultima8/gumps/container_gump.h b/engines/ultima/ultima8/gumps/container_gump.h
index 34c1548..0578c56 100644
--- a/engines/ultima/ultima8/gumps/container_gump.h
+++ b/engines/ultima/ultima8/gumps/container_gump.h
@@ -37,8 +37,8 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
ContainerGump();
- ContainerGump(Shape *shape, uint32 framenum, uint16 owner,
- uint32 _Flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
+ ContainerGump(Shape *shape, uint32 frameNum, uint16 owner,
+ uint32 flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
~ContainerGump(void) override;
void setItemArea(Rect *itemarea_) {
diff --git a/engines/ultima/ultima8/gumps/controls_gump.cpp b/engines/ultima/ultima8/gumps/controls_gump.cpp
index 0aab537..d9ddbb3 100644
--- a/engines/ultima/ultima8/gumps/controls_gump.cpp
+++ b/engines/ultima/ultima8/gumps/controls_gump.cpp
@@ -72,7 +72,7 @@ void ControlEntryGump::InitGump(Gump *newparent, bool take_focus) {
void ControlEntryGump::init() {
// close all children so we can simply use this method to re init
Std::list<Gump *>::iterator it;
- for (it = children.begin(); it != children.end(); ++it) {
+ for (it = _children.begin(); it != _children.end(); ++it) {
Gump *g = *it;
if (! g->IsClosing())
g->Close();
@@ -85,7 +85,7 @@ void ControlEntryGump::init() {
button->InitGump(this);
button->GetDims(rect);
- dims.h = rect.h;
+ _dims.h = rect.h;
//HIDManager * hidmanager = HIDManager::get_instance();
//hidmanager->getBindings(bindingName, controls);
@@ -106,12 +106,12 @@ void ControlEntryGump::ChildNotify(Gump *child, uint32 message) {
ObjId cid = child->getObjId();
if (message == ButtonWidget::BUTTON_CLICK) {
if (cid == button->getObjId()) {
- ModalGump *gump = new BindGump(&bindingName, parent);
+ ModalGump *gump = new BindGump(&bindingName, _parent);
gump->InitGump(0);
gump->setRelativePosition(CENTER);
}
} else if (message == BindGump::UPDATE) {
- parent->ChildNotify(child, message);
+ _parent->ChildNotify(child, message);
}
}
@@ -126,8 +126,8 @@ ControlsGump::~ControlsGump() {
void ControlsGump::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
- dims.w = 220;
- dims.h = 120;
+ _dims.w = 220;
+ _dims.h = 120;
Gump *widget = new TextWidget(0, 0, "Controls", true, font);
widget->InitGump(this, false);
@@ -137,7 +137,7 @@ void ControlsGump::InitGump(Gump *newparent, bool take_focus) {
void ControlsGump::addEntry(const char *binding, const char *name, int &x_, int &y_) {
Rect rect;
- Gump *widget = new ControlEntryGump(x_, y_, dims.w - x_, binding, name);
+ Gump *widget = new ControlEntryGump(x_, y_, _dims.w - x_, binding, name);
widget->InitGump(this);
widget->GetDims(rect);
y_ += rect.h;
@@ -146,7 +146,7 @@ void ControlsGump::addEntry(const char *binding, const char *name, int &x_, int
void ControlsGump::ChildNotify(Gump *child, uint32 message) {
if (message == BindGump::UPDATE) {
Std::list<Gump *>::iterator it;
- for (it = children.begin(); it != children.end(); ++it) {
+ for (it = _children.begin(); it != _children.end(); ++it) {
ControlEntryGump *g = p_dynamic_cast<ControlEntryGump *>(*it);
if (g)
g->init();
diff --git a/engines/ultima/ultima8/gumps/credits_gump.cpp b/engines/ultima/ultima8/gumps/credits_gump.cpp
index 7b6766f..9586a70 100644
--- a/engines/ultima/ultima8/gumps/credits_gump.cpp
+++ b/engines/ultima/ultima8/gumps/credits_gump.cpp
@@ -42,46 +42,46 @@ CreditsGump::CreditsGump()
}
-CreditsGump::CreditsGump(const Std::string &text_, int parskip_,
- uint32 _Flags, int32 layer_)
- : ModalGump(0, 0, 320, 200, 0, _Flags, layer_) {
- text = text_;
- parskip = parskip_;
-
- timer = 0;
- title = 0;
- nexttitle = 0;
- state = CS_PLAYING;
+CreditsGump::CreditsGump(const Std::string &text, int parskip,
+ uint32 flags, int32 layer)
+ : ModalGump(0, 0, 320, 200, 0, flags, layer) {
+ _text = text;
+ _parSkip = parskip;
+
+ _timer = 0;
+ _title = 0;
+ _nextTitle = 0;
+ _state = CS_PLAYING;
}
CreditsGump::~CreditsGump() {
- delete scroll[0];
- delete scroll[1];
- delete scroll[2];
- delete scroll[3];
+ delete _scroll[0];
+ delete _scroll[1];
+ delete _scroll[2];
+ delete _scroll[3];
- delete title;
- delete nexttitle;
+ delete _title;
+ delete _nextTitle;
}
void CreditsGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- scroll[0] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
- scroll[1] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
- scroll[2] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
- scroll[3] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
- scroll[0]->Fill32(0xFF000000, 0, 0, 256, 200); // black background
- scroll[1]->Fill32(0xFF000000, 0, 0, 256, 200);
- scroll[2]->Fill32(0xFF000000, 0, 0, 256, 200);
- scroll[3]->Fill32(0xFF000000, 0, 0, 256, 200);
- scrollheight[0] = 156;
- scrollheight[1] = 0;
- scrollheight[2] = 0;
- scrollheight[3] = 0;
-
- currentsurface = 0;
- currenty = 0;
+ _scroll[0] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
+ _scroll[1] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
+ _scroll[2] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
+ _scroll[3] = RenderSurface::CreateSecondaryRenderSurface(256, 200);
+ _scroll[0]->Fill32(0xFF000000, 0, 0, 256, 200); // black background
+ _scroll[1]->Fill32(0xFF000000, 0, 0, 256, 200);
+ _scroll[2]->Fill32(0xFF000000, 0, 0, 256, 200);
+ _scroll[3]->Fill32(0xFF000000, 0, 0, 256, 200);
+ _scrollHeight[0] = 156;
+ _scrollHeight[1] = 0;
+ _scrollHeight[2] = 0;
+ _scrollHeight[3] = 0;
+
+ _currentSurface = 0;
+ _currentY = 0;
Mouse::get_instance()->pushMouseCursor();
Mouse::get_instance()->setMouseCursor(Mouse::MOUSE_NONE);
@@ -131,48 +131,48 @@ void CreditsGump::extractLine(Std::string &text_,
void CreditsGump::run() {
ModalGump::run();
- if (timer) {
- timer--;
+ if (_timer) {
+ _timer--;
return;
}
- if (state == CS_CLOSING) {
+ if (_state == CS_CLOSING) {
// pout << "CreditsGump: closing" << Std::endl;
Close();
return;
}
- timer = 1;
+ _timer = 1;
- int available = scrollheight[currentsurface] - currenty;
+ int available = _scrollHeight[_currentSurface] - _currentY;
int nextblock = -1;
for (int i = 1; i < 4; i++) {
- available += scrollheight[(currentsurface + i) % 4];
- if (nextblock == -1 && scrollheight[(currentsurface + i) % 4] == 0)
- nextblock = (currentsurface + i) % 4;
+ available += _scrollHeight[(_currentSurface + i) % 4];
+ if (nextblock == -1 && _scrollHeight[(_currentSurface + i) % 4] == 0)
+ nextblock = (_currentSurface + i) % 4;
}
if (available == 0) nextblock = 0;
- if (state == CS_FINISHING && available <= 156) {
+ if (_state == CS_FINISHING && available <= 156) {
// pout << "CreditsGump: waiting before closing" << Std::endl;
- timer = 120;
- state = CS_CLOSING;
+ _timer = 120;
+ _state = CS_CLOSING;
- if (!configkey.empty()) {
+ if (!_configKey.empty()) {
SettingManager *settingman = SettingManager::get_instance();
- settingman->set(configkey, true);
+ settingman->set(_configKey, true);
settingman->write();
}
return;
}
- if (state == CS_PLAYING && available <= 160) {
+ if (_state == CS_PLAYING && available <= 160) {
// time to render next block
- scroll[nextblock]->Fill32(0xFF000000, 0, 0, 256, 200);
- // scroll[nextblock]->Fill32(0xFFFFFFFF,0,0,256,5); // block marker
- scrollheight[nextblock] = 0;
+ _scroll[nextblock]->Fill32(0xFF000000, 0, 0, 256, 200);
+ // _scroll[nextblock]->Fill32(0xFFFFFFFF,0,0,256,5); // block marker
+ _scrollHeight[nextblock] = 0;
Font *redfont, *yellowfont;
@@ -181,22 +181,22 @@ void CreditsGump::run() {
bool done = false;
bool firstline = true;
- while (!text.empty() && !done) {
- Std::string::size_type endline = text.find('\n');
- Std::string line = text.substr(0, endline);
+ while (!_text.empty() && !done) {
+ Std::string::size_type endline = _text.find('\n');
+ Std::string line = _text.substr(0, endline);
if (line.empty()) {
- text.erase(0, 1);
+ _text.erase(0, 1);
continue;
}
// pout << "Rendering paragraph: " << line << Std::endl;
if (line[0] == '+') {
- // set title
+ // set _title
if (!firstline) {
// if this isn't the first line of the block,
- // postpone setting title until next block
+ // postpone setting _title until next block
done = true;
continue;
}
@@ -207,15 +207,15 @@ void CreditsGump::run() {
extractLine(line, modifier, titletext);
unsigned int remaining;
- nexttitle = redfont->renderText(titletext, remaining, 192, 0,
+ _nextTitle = redfont->renderText(titletext, remaining, 192, 0,
Font::TEXT_CENTER);
- if (!title) {
- title = nexttitle;
- nexttitle = 0;
+ if (!_title) {
+ _title = _nextTitle;
+ _nextTitle = 0;
} else {
- nexttitlesurf = nextblock;
- scrollheight[nextblock] = 160; // skip some space
+ _nextTitleSurf = nextblock;
+ _scrollHeight[nextblock] = 160; // skip some space
}
} else {
@@ -250,7 +250,7 @@ void CreditsGump::run() {
break;
case '@':
// pout << "CreditsGump: done, finishing" << Std::endl;
- state = CS_FINISHING;
+ _state = CS_FINISHING;
break;
default:
break;
@@ -264,7 +264,7 @@ void CreditsGump::run() {
if (outline.hasPrefix("&")) {
// horizontal line
- if (scrollheight[nextblock] + height + 7 > 200) {
+ if (_scrollHeight[nextblock] + height + 7 > 200) {
done = true;
break;
}
@@ -272,9 +272,9 @@ void CreditsGump::run() {
int linewidth = outline.size() * 8;
if (linewidth > 192) linewidth = 192;
- scroll[nextblock]->
+ _scroll[nextblock]->
Fill32(0xFFD43030, 128 - (linewidth / 2),
- scrollheight[nextblock] + height + 3,
+ _scrollHeight[nextblock] + height + 3,
linewidth, 1);
height += 7;
continue;
@@ -286,14 +286,14 @@ void CreditsGump::run() {
int xd, yd;
rt->getSize(xd, yd);
- if (scrollheight[nextblock] + height + yd > 200) {
+ if (_scrollHeight[nextblock] + height + yd > 200) {
delete rt;
done = true;
break;
}
- rt->draw(scroll[nextblock], indent,
- scrollheight[nextblock] + height +
+ rt->draw(_scroll[nextblock], indent,
+ _scrollHeight[nextblock] + height +
font->getBaseline());
height += yd + rt->getVlead();
@@ -301,12 +301,12 @@ void CreditsGump::run() {
delete rt;
}
- if (state == CS_PLAYING)
- height += parskip;
+ if (_state == CS_PLAYING)
+ height += _parSkip;
- if (scrollheight[nextblock] + height > 200) {
+ if (_scrollHeight[nextblock] + height > 200) {
if (firstline) {
- height = 200 - scrollheight[nextblock];
+ height = 200 - _scrollHeight[nextblock];
assert(height >= 0);
} else {
done = true;
@@ -315,53 +315,53 @@ void CreditsGump::run() {
if (done) break; // no room
- scrollheight[nextblock] += height;
+ _scrollHeight[nextblock] += height;
}
if (endline != Std::string::npos) endline++;
- text.erase(0, endline);
+ _text.erase(0, endline);
firstline = false;
}
}
- currenty++;
+ _currentY++;
- if (currenty >= scrollheight[currentsurface]) {
+ if (_currentY >= _scrollHeight[_currentSurface]) {
// next surface
- currenty -= scrollheight[currentsurface];
- scrollheight[currentsurface] = 0;
- currentsurface = (currentsurface + 1) % 4;
-
- if (nexttitle && currentsurface == nexttitlesurf) {
- delete title;
- title = nexttitle;
- nexttitle = 0;
+ _currentY -= _scrollHeight[_currentSurface];
+ _scrollHeight[_currentSurface] = 0;
+ _currentSurface = (_currentSurface + 1) % 4;
+
+ if (_nextTitle && _currentSurface == _nextTitleSurf) {
+ delete _title;
+ _title = _nextTitle;
+ _nextTitle = 0;
}
}
}
void CreditsGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
surf->Fill32(0xFF000000, 0, 0, 320, 200); // black background
- surf->Fill32(0xFFD43030, 64, 41, 192, 1); // line between title and scroller
+ surf->Fill32(0xFFD43030, 64, 41, 192, 1); // line between _title and scroller
- if (title)
- title->draw(surf, 64, 34);
+ if (_title)
+ _title->draw(surf, 64, 34);
- Texture *tex = scroll[currentsurface]->GetSurfaceAsTexture();
- int h = scrollheight[currentsurface] - currenty;
+ Texture *tex = _scroll[_currentSurface]->GetSurfaceAsTexture();
+ int h = _scrollHeight[_currentSurface] - _currentY;
if (h > 156) h = 156;
if (h > 0)
- surf->Blit(tex, 0, currenty, 256, h, 32, 44);
+ surf->Blit(tex, 0, _currentY, 256, h, 32, 44);
int y_ = h;
for (int i = 1; i < 4; i++) {
if (h == 156) break;
- int s = (currentsurface + i) % 4;
- tex = scroll[s]->GetSurfaceAsTexture();
- h = scrollheight[s];
+ int s = (_currentSurface + i) % 4;
+ tex = _scroll[s]->GetSurfaceAsTexture();
+ h = _scrollHeight[s];
if (h > 156 - y_) h = 156 - y_;
if (h > 0)
surf->Blit(tex, 0, 0, 256, h, 32, 44 + y_);
diff --git a/engines/ultima/ultima8/gumps/credits_gump.h b/engines/ultima/ultima8/gumps/credits_gump.h
index b702836..5efb0cc 100644
--- a/engines/ultima/ultima8/gumps/credits_gump.h
+++ b/engines/ultima/ultima8/gumps/credits_gump.h
@@ -37,15 +37,15 @@ public:
CreditsGump();
CreditsGump(const Std::string &text, int parskip = 24,
- uint32 _Flags = 0, int32 layer_ = LAYER_MODAL);
+ uint32 flags = 0, int32 layer = LAYER_MODAL);
~CreditsGump(void) override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
// Set a configuration option to true when user watches entire sequence
- void SetFlagWhenFinished(Std::string configkey_) {
- configkey = configkey_;
+ void SetFlagWhenFinished(Std::string configKey) {
+ _configKey = configKey;
}
void Close(bool no_del = false) override;
@@ -61,27 +61,27 @@ protected:
void extractLine(Std::string &text_, char &modifier, Std::string &line);
- Std::string text;
- int parskip;
+ Std::string _text;
+ int _parSkip;
enum CreditsState {
CS_PLAYING,
CS_FINISHING,
CS_CLOSING
- } state;
+ } _state;
- int timer;
+ int _timer;
- RenderedText *title;
- RenderedText *nexttitle;
- int nexttitlesurf;
+ RenderedText *_title;
+ RenderedText *_nextTitle;
+ int _nextTitleSurf;
- RenderSurface *scroll[4];
- int scrollheight[4];
- int currentsurface;
- int currenty;
+ RenderSurface *_scroll[4];
+ int _scrollHeight[4];
+ int _currentSurface;
+ int _currentY;
- Std::string configkey;
+ Std::string _configKey;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.cpp b/engines/ultima/ultima8/gumps/desktop_gump.cpp
index ed907c4..463a77c 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.cpp
+++ b/engines/ultima/ultima8/gumps/desktop_gump.cpp
@@ -41,8 +41,8 @@ DesktopGump::DesktopGump()
: Gump() {
}
-DesktopGump::DesktopGump(int32 _x, int32 _y, int32 _width, int32 _height) :
- Gump(_x, _y, _width, _height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP,
+DesktopGump::DesktopGump(int32 x, int32 y, int32 width, int32 height) :
+ Gump(x, y, width, height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP,
LAYER_DESKTOP) {
}
@@ -54,16 +54,16 @@ void DesktopGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
#ifndef DEBUG
ConsoleGump *console = Ultima8Engine::get_instance()->getConsoleGump();
- if (console->ConsoleIsVisible() || (children.size() && children.front()->IsOfType<ConsoleGump>()))
+ if (console->ConsoleIsVisible() || (_children.size() && _children.front()->IsOfType<ConsoleGump>()))
#endif
- surf->Fill32(0x000000, 0, 0, dims.w, dims.h);
- //surf->Fill32(0x3f3f3f, 0, 0, dims.w, dims.h);
+ surf->Fill32(0x000000, 0, 0, _dims.w, _dims.h);
+ //surf->Fill32(0x3f3f3f, 0, 0, _dims.w, _dims.h);
}
void DesktopGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) {
// Iterate all children
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
while (it != end) {
Gump *g = *it;
@@ -74,7 +74,7 @@ void DesktopGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sca
// Background is partially transparent
if (faded_modal && g->IsOfType<ModalGump>() &&
!g->IsOfType<TargetGump>() && !g->IsHidden())
- surf->FillBlended(0x7F000000, 0, 0, dims.w, dims.h);
+ surf->FillBlended(0x7F000000, 0, 0, _dims.w, _dims.h);
g->Paint(surf, lerp_factor, scaled);
}
@@ -104,8 +104,8 @@ void DesktopGump::RenderSurfaceChanged(RenderSurface *surf) {
// Resize the desktop gump to match the RenderSurface
Rect new_dims;
surf->GetSurfaceDims(new_dims);
- dims.w = new_dims.w;
- dims.h = new_dims.h;
+ _dims.w = new_dims.w;
+ _dims.h = new_dims.h;
Gump::RenderSurfaceChanged();
}
@@ -113,9 +113,9 @@ void DesktopGump::RenderSurfaceChanged(RenderSurface *surf) {
void DesktopGump::RenderSurfaceChanged() {
// Resize the desktop gump to match the parent
Rect new_dims;
- parent->GetDims(new_dims);
- dims.w = new_dims.w;
- dims.h = new_dims.h;
+ _parent->GetDims(new_dims);
+ _dims.w = new_dims.w;
+ _dims.h = new_dims.h;
Gump::RenderSurfaceChanged();
}
diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp
index 9d13d09..801e5ff 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.cpp
+++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp
@@ -69,8 +69,8 @@ GameMapGump::GameMapGump(int X, int Y, int Width, int Height) :
Gump(X, Y, Width, Height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP, LAYER_GAMEMAP),
display_list(0), display_dragging(false) {
// Offset the gump. We want 0,0 to be the centre
- dims.x -= dims.w / 2;
- dims.y -= dims.h / 2;
+ _dims.x -= _dims.w / 2;
+ _dims.y -= _dims.h / 2;
pout << "Create display_list ItemSorter object" << Std::endl;
display_list = new ItemSorter();
@@ -732,17 +732,17 @@ void GameMapGump::ConCmd_decrementSortOrder(const Console::ArgvType &argv) {
}
void GameMapGump::RenderSurfaceChanged() {
- dims.x += dims.w / 2;
- dims.y += dims.h / 2;
+ _dims.x += _dims.w / 2;
+ _dims.y += _dims.h / 2;
// Resize the desktop gump to match the parent
Rect new_dims;
- parent->GetDims(new_dims);
- dims.w = new_dims.w;
- dims.h = new_dims.h;
+ _parent->GetDims(new_dims);
+ _dims.w = new_dims.w;
+ _dims.h = new_dims.h;
- dims.x -= dims.w / 2;
- dims.y -= dims.h / 2;
+ _dims.x -= _dims.w / 2;
+ _dims.y -= _dims.h / 2;
Gump::RenderSurfaceChanged();
}
diff --git a/engines/ultima/ultima8/gumps/game_map_gump.h b/engines/ultima/ultima8/gumps/game_map_gump.h
index 11f05f3..a2eae3f 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.h
+++ b/engines/ultima/ultima8/gumps/game_map_gump.h
@@ -49,7 +49,7 @@ public:
void GetCameraLocation(int32 &x, int32 &y, int32 &z,
int lerp_factor = 256);
- // Trace a click, and return ObjId (parent coord space)
+ // Trace a click, and return ObjId (_parent coord space)
uint16 TraceObjId(int32 mx, int32 my) override;
// Trace a click, return ObjId, and the coordinates of the mouse click (gump coord space)
diff --git a/engines/ultima/ultima8/gumps/gump.cpp b/engines/ultima/ultima8/gumps/gump.cpp
index 841c727..b2d5d2d 100644
--- a/engines/ultima/ultima8/gumps/gump.cpp
+++ b/engines/ultima/ultima8/gumps/gump.cpp
@@ -40,31 +40,30 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(Gump, Object)
-Gump::Gump()
- : Object(), parent(0), children() {
+Gump::Gump() : Object(), _parent(0), _children() {
}
Gump::Gump(int inX, int inY, int Width, int Height, uint16 inOwner,
uint32 inFlags, int32 inLayer) :
- Object(), owner(inOwner), parent(0), x(inX), y(inY),
- dims(0, 0, Width, Height), flags(inFlags), layer(inLayer), index(-1),
- shape(0), framenum(0), children(), focus_child(0), notifier(0),
- process_result(0) {
+ Object(), _owner(inOwner), _parent(0), _x(inX), _y(inY),
+ _dims(0, 0, Width, Height), _flags(inFlags), _layer(inLayer), _index(-1),
+ _shape(0), _frameNum(0), _children(), _focusChild(0), _notifier(0),
+ _processResult(0) {
assignObjId(); // gumps always get an objid
}
Gump::~Gump() {
// Get rid of focus
- if (focus_child) focus_child->OnFocus(false);
- focus_child = 0;
+ if (_focusChild) _focusChild->OnFocus(false);
+ _focusChild = 0;
// Delete all children
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
while (it != end) {
Gump *g = *it;
- it = children.erase(it);
+ it = _children.erase(it);
delete g;
}
}
@@ -75,61 +74,61 @@ void Gump::InitGump(Gump *newparent, bool take_focus) {
else
Ultima8Engine::get_instance()->addGump(this);
- if (owner && !notifier) CreateNotifier();
+ if (_owner && !_notifier) CreateNotifier();
}
void Gump::SetShape(FrameID frame, bool adjustsize) {
- shape = GameData::get_instance()->getShape(frame);
- framenum = frame.framenum;
+ _shape = GameData::get_instance()->getShape(frame);
+ _frameNum = frame._frameNum;
- if (adjustsize && shape) {
- ShapeFrame *sf = shape->getFrame(framenum);
- dims.w = sf->width;
- dims.h = sf->height;
+ if (adjustsize && _shape) {
+ ShapeFrame *sf = _shape->getFrame(_frameNum);
+ _dims.w = sf->width;
+ _dims.h = sf->height;
}
}
void Gump::CreateNotifier() {
- assert(notifier == 0);
+ assert(_notifier == 0);
// Create us a GumpNotifyProcess
- GumpNotifyProcess *p = new GumpNotifyProcess(owner);
+ GumpNotifyProcess *p = new GumpNotifyProcess(_owner);
p->setGump(this);
- notifier = Kernel::get_instance()->addProcess(p);
+ _notifier = Kernel::get_instance()->addProcess(p);
}
void Gump::SetNotifyProcess(GumpNotifyProcess *proc) {
- assert(notifier == 0);
- notifier = proc->getPid();
+ assert(_notifier == 0);
+ _notifier = proc->getPid();
}
GumpNotifyProcess *Gump::GetNotifyProcess() {
return p_dynamic_cast<GumpNotifyProcess *>(Kernel::get_instance()->
- getProcess(notifier));
+ getProcess(_notifier));
}
void Gump::Close(bool no_del) {
GumpNotifyProcess *p = GetNotifyProcess();
if (p) {
- p->notifyClosing(process_result);
+ p->notifyClosing(_processResult);
}
- notifier = 0;
+ _notifier = 0;
- if (!parent) {
- flags |= FLAG_CLOSING;
+ if (!_parent) {
+ _flags |= FLAG_CLOSING;
if (!no_del) delete this;
} else {
- flags |= FLAG_CLOSING;
- if (!no_del) flags |= FLAG_CLOSE_AND_DEL;
+ _flags |= FLAG_CLOSING;
+ if (!no_del) _flags |= FLAG_CLOSE_AND_DEL;
}
}
void Gump::RenderSurfaceChanged() {
// Iterate all children
- Std::list<Gump *>::reverse_iterator it = children.rbegin();
- Std::list<Gump *>::reverse_iterator end = children.rend();
+ Std::list<Gump *>::reverse_iterator it = _children.rbegin();
+ Std::list<Gump *>::reverse_iterator end = _children.rend();
while (it != end) {
(*it)->RenderSurfaceChanged();
@@ -139,21 +138,21 @@ void Gump::RenderSurfaceChanged() {
void Gump::run() {
// Iterate all children
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
while (it != end) {
Gump *g = *it;
// Run the child if it's not closing
- if (!(g->flags & FLAG_CLOSING))
+ if (!(g->_flags & FLAG_CLOSING))
g->run();
// If closing, we can kill it
- if (g->flags & FLAG_CLOSING) {
- it = children.erase(it);
+ if (g->_flags & FLAG_CLOSING) {
+ it = _children.erase(it);
FindNewFocusChild();
- if (g->flags & FLAG_CLOSE_AND_DEL) delete g;
+ if (g->_flags & FLAG_CLOSE_AND_DEL) delete g;
} else {
++it;
}
@@ -162,26 +161,26 @@ void Gump::run() {
void Gump::CloseItemDependents() {
// Close it, and return
- if (flags & FLAG_ITEM_DEPENDENT) {
+ if (_flags & FLAG_ITEM_DEPENDENT) {
Close();
return;
}
// Pass the MapChanged message to all the children
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
while (it != end) {
Gump *g = *it;
// Pass to child if it's not closing
- if (!(g->flags & FLAG_CLOSING)) g->CloseItemDependents();
+ if (!(g->_flags & FLAG_CLOSING)) g->CloseItemDependents();
// If closing, we can kill it
- if (g->flags & FLAG_CLOSING) {
- it = children.erase(it);
+ if (g->_flags & FLAG_CLOSING) {
+ it = _children.erase(it);
FindNewFocusChild();
- if (g->flags & FLAG_CLOSE_AND_DEL) delete g;
+ if (g->_flags & FLAG_CLOSE_AND_DEL) delete g;
} else {
++it;
}
@@ -195,12 +194,12 @@ bool Gump::GetMouseCursor(int32 mx, int32 my, Shape &shape_, int32 &frame) {
// This reverse iterates the children
Std::list<Gump *>::reverse_iterator it;
- for (it = children.rbegin(); it != children.rend(); ++it)
+ for (it = _children.rbegin(); it != _children.rend(); ++it)
{
Gump *g = *it;
// Not if closing
- if (g->flags & FLAG_CLOSING) continue;
+ if (g->_flags & FLAG_CLOSING) continue;
// It's got the point
if (g->PointOnGump(mx, my))
@@ -230,7 +229,7 @@ void Gump::Paint(RenderSurface *surf, int32 lerp_factor, bool scaled) {
surf->GetClippingRect(old_rect);
// Set new clipping rect
- Rect new_rect = dims;
+ Rect new_rect = _dims;
new_rect.Intersect(old_rect);
surf->SetClippingRect(new_rect);
@@ -248,10 +247,10 @@ void Gump::Paint(RenderSurface *surf, int32 lerp_factor, bool scaled) {
}
void Gump::PaintThis(RenderSurface *surf, int32 /*lerp_factor*/, bool /*scaled*/) {
- if (shape) {
+ if (_shape) {
#if 0
Rect sr;
- ShapeFrame *f = shape->getFrame(framenum);
+ ShapeFrame *f = shape->getFrame(_frameNum);
sr.h = f->height;
sr.w = f->height;
sr.x = -f->xoff;
@@ -259,23 +258,23 @@ void Gump::PaintThis(RenderSurface *surf, int32 /*lerp_factor*/, bool /*scaled*/
if (surf->CheckClipped(sr))
#endif
- surf->Paint(shape, framenum, 0, 0);
+ surf->Paint(_shape, _frameNum, 0, 0);
#if 0
else
- surf->PaintNoClip(shape, framenum, 0, 0);
+ surf->PaintNoClip(shape, _frameNum, 0, 0);
#endif
}
}
void Gump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) {
// Iterate all children
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
while (it != end) {
Gump *g = *it;
// Paint if not closing
- if (!(g->flags & FLAG_CLOSING))
+ if (!(g->_flags & FLAG_CLOSING))
g->Paint(surf, lerp_factor, scaled);
++it;
@@ -301,15 +300,15 @@ void Gump::PaintCompositing(RenderSurface *surf, int32 lerp_factor,
surf->GetClippingRect(old_rect);
// Set new clipping rect
- int32 cx = dims.x, cy = dims.y, cw = dims.w, ch = dims.h;
+ int32 cx = _dims.x, cy = _dims.y, cw = _dims.w, ch = _dims.h;
GumpRectToScreenSpace(cx, cy, cw, ch, ROUND_OUTSIDE);
Rect new_rect(cx, cy, cw, ch);
new_rect.Intersect(old_rect);
surf->SetClippingRect(new_rect);
// Iterate all children
- Std::list<Gump *>::reverse_iterator it = children.rbegin();
- Std::list<Gump *>::reverse_iterator end = children.rend();
+ Std::list<Gump *>::reverse_iterator it = _children.rbegin();
+ Std::list<Gump *>::reverse_iterator end = _children.rend();
while (it != end) {
Gump *g = *it;
@@ -339,8 +338,8 @@ Gump *Gump::FindGump(int mx, int my) {
Gump *gump = 0;
// Iterate all children
- Std::list<Gump *>::reverse_iterator it = children.rbegin();
- Std::list<Gump *>::reverse_iterator end = children.rend();
+ Std::list<Gump *>::reverse_iterator it = _children.rbegin();
+ Std::list<Gump *>::reverse_iterator end = _children.rend();
while (it != end && !gump) {
Gump *g = *it;
@@ -358,32 +357,32 @@ Gump *Gump::FindGump(int mx, int my) {
}
void Gump::setRelativePosition(Gump::Position pos, int xoffset, int yoffset) {
- if (parent) {
+ if (_parent) {
Rect rect;
- parent->GetDims(rect);
+ _parent->GetDims(rect);
switch (pos) {
case CENTER:
- Move(rect.w / 2 - dims.w / 2 + xoffset,
- rect.h / 2 - dims.h / 2 + yoffset);
+ Move(rect.w / 2 - _dims.w / 2 + xoffset,
+ rect.h / 2 - _dims.h / 2 + yoffset);
break;
case TOP_LEFT:
Move(xoffset, yoffset);
break;
case TOP_RIGHT:
- Move(rect.w - dims.w + xoffset, yoffset);
+ Move(rect.w - _dims.w + xoffset, yoffset);
break;
case BOTTOM_LEFT:
- Move(xoffset, rect.h - dims.h + yoffset);
+ Move(xoffset, rect.h - _dims.h + yoffset);
break;
case BOTTOM_RIGHT:
- Move(rect.w - dims.w + xoffset, rect.h - dims.h + yoffset);
+ Move(rect.w - _dims.w + xoffset, rect.h - _dims.h + yoffset);
break;
case TOP_CENTER:
- Move(rect.w / 2 - dims.w / 2 + xoffset, yoffset);
+ Move(rect.w / 2 - _dims.w / 2 + xoffset, yoffset);
break;
case BOTTOM_CENTER:
- Move(rect.w / 2 - dims.w / 2 + xoffset, rect.h - dims.h + yoffset);
+ Move(rect.w / 2 - _dims.w / 2 + xoffset, rect.h - _dims.h + yoffset);
break;
default:
break;
@@ -396,16 +395,16 @@ bool Gump::PointOnGump(int mx, int my) {
ParentToGump(gx, gy);
// First check again rectangle
- if (!dims.InRect(gx, gy)) {
+ if (!_dims.InRect(gx, gy)) {
return false;
}
- if (!shape) {
+ if (!_shape) {
// no shape? Then if it's in the rectangle it's on the gump.
return true;
}
- ShapeFrame *sf = shape->getFrame(framenum);
+ ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
if (sf->hasPoint(gx, gy)) {
return true;
@@ -413,7 +412,7 @@ bool Gump::PointOnGump(int mx, int my) {
// reverse-iterate children
Std::list<Gump *>::reverse_iterator it;
- for (it = children.rbegin(); it != children.rend(); ++it) {
+ for (it = _children.rbegin(); it != _children.rend(); ++it) {
Gump *g = *it;
// It's got the point
@@ -428,7 +427,7 @@ void Gump::ScreenSpaceToGump(int32 &sx, int32 &sy, PointRoundDir r) {
// This is a recursive operation. We get each
// parent to convert the point into their local
// coords.
- if (parent) parent->ScreenSpaceToGump(sx, sy, r);
+ if (_parent) _parent->ScreenSpaceToGump(sx, sy, r);
ParentToGump(sx, sy, r);
}
@@ -440,23 +439,23 @@ void Gump::GumpToScreenSpace(int32 &gx, int32 &gy, PointRoundDir r) {
GumpToParent(gx, gy, r);
- if (parent) parent->GumpToScreenSpace(gx, gy, r);
+ if (_parent) _parent->GumpToScreenSpace(gx, gy, r);
}
// Convert a parent relative point to a gump point
void Gump::ParentToGump(int32 &px, int32 &py, PointRoundDir) {
- px -= x;
- px += dims.x;
- py -= y;
- py += dims.y;
+ px -= _x;
+ px += _dims.x;
+ py -= _y;
+ py += _dims.y;
}
// Convert a gump point to parent relative point
void Gump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir) {
- gx -= dims.x;
- gx += x;
- gy -= dims.y;
- gy += y;
+ gx -= _dims.x;
+ gx += _x;
+ gy -= _dims.y;
+ gy += _y;
}
// Transform a rectangle to screenspace from gumpspace
@@ -500,11 +499,11 @@ uint16 Gump::TraceObjId(int32 mx, int32 my) {
// reverse-iterate children
Std::list<Gump *>::reverse_iterator it;
- for (it = children.rbegin(); it != children.rend(); ++it) {
+ for (it = _children.rbegin(); it != _children.rend(); ++it) {
Gump *g = *it;
// Not if closing
- if (g->flags & FLAG_CLOSING) continue;
+ if (g->_flags & FLAG_CLOSING) continue;
// It's got the point
if (g->PointOnGump(gx, gy)) objId_ = g->TraceObjId(gx, gy);
@@ -534,14 +533,14 @@ Gump *Gump::FindGump(const RunTimeClassType &t, bool recursive,
else if (!no_inheritance && IsOfType(t)) return this;
// Iterate all children
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
for (; it != end; ++it) {
Gump *g = *it;
// Not if closing
- if (g->flags & FLAG_CLOSING) continue;
+ if (g->_flags & FLAG_CLOSING) continue;
if (g->GetClassType() == t) return g;
else if (!no_inheritance && g->IsOfType(t)) return g;
@@ -550,14 +549,14 @@ Gump *Gump::FindGump(const RunTimeClassType &t, bool recursive,
if (!recursive) return 0;
// Recursive Iterate all children
- it = children.begin();
- end = children.end();
+ it = _children.begin();
+ end = _children.end();
for (; it != end; ++it) {
Gump *g = (*it);
// Not if closing
- if (g->flags & FLAG_CLOSING) continue;
+ if (g->_flags & FLAG_CLOSING) continue;
g = g->FindGump(t, recursive, no_inheritance);
@@ -570,21 +569,21 @@ Gump *Gump::FindGump(const RunTimeClassType &t, bool recursive,
// Makes this gump the focus
void Gump::MakeFocus() {
// By default we WONT do anything
- if (parent) {
- if (parent->focus_child) parent->focus_child->OnFocus(false);
- parent->focus_child = this;
+ if (_parent) {
+ if (_parent->_focusChild) _parent->_focusChild->OnFocus(false);
+ _parent->_focusChild = this;
}
OnFocus(true);
}
void Gump::FindNewFocusChild() {
- if (focus_child) focus_child->OnFocus(false);
- focus_child = 0;
+ if (_focusChild) _focusChild->OnFocus(false);
+ _focusChild = 0;
// Now add the gump to use as the new focus
- Std::list<Gump *>::reverse_iterator it = children.rbegin();
+ Std::list<Gump *>::reverse_iterator it = _children.rbegin();
- if (it != children.rend()) {
+ if (it != _children.rend()) {
(*it)->MakeFocus();
}
}
@@ -599,8 +598,8 @@ void Gump::AddChild(Gump *gump, bool take_focus) {
if (old_parent) old_parent->RemoveChild(gump);
// Now add the gump in the correct spot
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
for (; it != end; ++it) {
Gump *other = *it;
@@ -610,22 +609,22 @@ void Gump::AddChild(Gump *gump, bool take_focus) {
// If we are same layer as focus and we wont take it, we will not be
// placed in front of it
- if (!take_focus && other == focus_child && other->layer == gump->layer)
+ if (!take_focus && other == _focusChild && other->_layer == gump->_layer)
break;
// Lower layers get placed before higher layers
- if (other->layer > gump->layer) break;
+ if (other->_layer > gump->_layer) break;
}
// Now add it
- children.insert(it, gump);
- gump->parent = this;
+ _children.insert(it, gump);
+ gump->_parent = this;
// Make the gump the focus if needed
- if (take_focus || !focus_child) {
- if (focus_child) focus_child->OnFocus(false);
+ if (take_focus || !_focusChild) {
+ if (_focusChild) _focusChild->OnFocus(false);
gump->OnFocus(true);
- focus_child = gump;
+ _focusChild = gump;
}
}
@@ -634,11 +633,11 @@ void Gump::RemoveChild(Gump *gump) {
if (!gump) return;
// Remove it
- children.remove(gump);
- gump->parent = 0;
+ _children.remove(gump);
+ gump->_parent = 0;
// Remove focus, the give upper most gump the focus
- if (gump == focus_child) {
+ if (gump == _focusChild) {
FindNewFocusChild();
}
}
@@ -646,24 +645,24 @@ void Gump::RemoveChild(Gump *gump) {
void Gump::MoveChildToFront(Gump *gump) {
if (!gump) return;
- children.remove(gump);
+ _children.remove(gump);
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
for (; it != end; ++it) {
Gump *other = *it;
// Lower layers get placed before higher layers
- if (other->layer > gump->layer) break;
+ if (other->_layer > gump->_layer) break;
}
- children.insert(it, gump);
+ _children.insert(it, gump);
}
Gump *Gump::GetRootGump() {
- if (!parent) return this;
- return parent->GetRootGump();
+ if (!_parent) return this;
+ return _parent->GetRootGump();
}
@@ -691,11 +690,11 @@ Gump *Gump::OnMouseDown(int button, int32 mx, int32 my) {
// Iterate children backwards
Std::list<Gump *>::reverse_iterator it;
- for (it = children.rbegin(); it != children.rend(); ++it) {
+ for (it = _children.rbegin(); it != _children.rend(); ++it) {
Gump *g = *it;
// Not if closing
- if (g->flags & FLAG_CLOSING || g->IsHidden()) continue;
+ if (g->_flags & FLAG_CLOSING || g->IsHidden()) continue;
// It's got the point
if (g->PointOnGump(mx, my)) handled = g->OnMouseDown(button, mx, my);
@@ -714,11 +713,11 @@ Gump *Gump::OnMouseMotion(int32 mx, int32 my) {
// Iterate children backwards
Std::list<Gump *>::reverse_iterator it;
- for (it = children.rbegin(); it != children.rend(); ++it) {
+ for (it = _children.rbegin(); it != _children.rend(); ++it) {
Gump *g = *it;
// Not if closing
- if (g->flags & FLAG_CLOSING || g->IsHidden()) continue;
+ if (g->_flags & FLAG_CLOSING || g->IsHidden()) continue;
// It's got the point
if (g->PointOnGump(mx, my)) handled = g->OnMouseMotion(mx, my);
@@ -737,30 +736,30 @@ Gump *Gump::OnMouseMotion(int32 mx, int32 my) {
//
bool Gump::OnKeyDown(int key, int mod) {
bool handled = false;
- if (focus_child) handled = focus_child->OnKeyDown(key, mod);
+ if (_focusChild) handled = _focusChild->OnKeyDown(key, mod);
return handled;
}
bool Gump::OnKeyUp(int key) {
bool handled = false;
- if (focus_child) handled = focus_child->OnKeyUp(key);
+ if (_focusChild) handled = _focusChild->OnKeyUp(key);
return handled;
}
bool Gump::OnTextInput(int unicode) {
bool handled = false;
- if (focus_child) handled = focus_child->OnTextInput(unicode);
+ if (_focusChild) handled = _focusChild->OnTextInput(unicode);
return handled;
}
bool Gump::mustSave(bool toplevel) {
// DONT_SAVE flag
- if (flags & FLAG_DONT_SAVE)
+ if (_flags & FLAG_DONT_SAVE)
return false;
if (toplevel) {
// don't save gumps with parents, unless parent is a core gump
- if (parent && !(parent->flags & FLAG_CORE_GUMP))
+ if (_parent && !(_parent->_flags & FLAG_CORE_GUMP))
return false;
}
@@ -770,43 +769,43 @@ bool Gump::mustSave(bool toplevel) {
void Gump::saveData(ODataSource *ods) {
Object::saveData(ods);
- ods->write2(owner);
- ods->write4(static_cast<uint32>(x));
- ods->write4(static_cast<uint32>(y));
- ods->write4(static_cast<uint32>(dims.x));
- ods->write4(static_cast<uint32>(dims.y));
- ods->write4(static_cast<uint32>(dims.w));
- ods->write4(static_cast<uint32>(dims.h));
- ods->write4(flags);
- ods->write4(static_cast<uint32>(layer));
- ods->write4(static_cast<uint32>(index));
+ ods->write2(_owner);
+ ods->write4(static_cast<uint32>(_x));
+ ods->write4(static_cast<uint32>(_y));
+ ods->write4(static_cast<uint32>(_dims.x));
+ ods->write4(static_cast<uint32>(_dims.y));
+ ods->write4(static_cast<uint32>(_dims.w));
+ ods->write4(static_cast<uint32>(_dims.h));
+ ods->write4(_flags);
+ ods->write4(static_cast<uint32>(_layer));
+ ods->write4(static_cast<uint32>(_index));
uint16 flex = 0;
uint32 shapenum = 0;
- if (shape) {
- shape->getShapeId(flex, shapenum);
+ if (_shape) {
+ _shape->getShapeId(flex, shapenum);
}
ods->write2(flex);
ods->write4(shapenum);
- ods->write4(framenum);
- if (focus_child)
- ods->write2(focus_child->getObjId());
+ ods->write4(_frameNum);
+ if (_focusChild)
+ ods->write2(_focusChild->getObjId());
else
ods->write2(0);
- ods->write2(notifier);
- ods->write4(process_result);
+ ods->write2(_notifier);
+ ods->write4(_processResult);
unsigned int childcount = 0;
Std::list<Gump *>::iterator it;
- for (it = children.begin(); it != children.end(); ++it) {
+ for (it = _children.begin(); it != _children.end(); ++it) {
if (!(*it)->mustSave(false)) continue;
childcount++;
}
// write children:
ods->write4(childcount);
- for (it = children.begin(); it != children.end(); ++it) {
+ for (it = _children.begin(); it != _children.end(); ++it) {
if (!(*it)->mustSave(false)) continue;
(*it)->save(ods);
@@ -816,32 +815,32 @@ void Gump::saveData(ODataSource *ods) {
bool Gump::loadData(IDataSource *ids, uint32 version) {
if (!Object::loadData(ids, version)) return false;
- owner = ids->read2();
- x = static_cast<int32>(ids->read4());
- y = static_cast<int32>(ids->read4());
+ _owner = ids->read2();
+ _x = static_cast<int32>(ids->read4());
+ _y = static_cast<int32>(ids->read4());
int dx = static_cast<int32>(ids->read4());
int dy = static_cast<int32>(ids->read4());
int dw = static_cast<int32>(ids->read4());
int dh = static_cast<int32>(ids->read4());
- dims.Set(dx, dy, dw, dh);
+ _dims.Set(dx, dy, dw, dh);
- flags = ids->read4();
- layer = static_cast<int32>(ids->read4());
- index = static_cast<int32>(ids->read4());
+ _flags = ids->read4();
+ _layer = static_cast<int32>(ids->read4());
+ _index = static_cast<int32>(ids->read4());
- shape = 0;
+ _shape = 0;
ShapeArchive *flex = GameData::get_instance()->getShapeFlex(ids->read2());
uint32 shapenum = ids->read4();
if (flex) {
- shape = flex->getShape(shapenum);
+ _shape = flex->getShape(shapenum);
}
- framenum = ids->read4();
+ _frameNum = ids->read4();
uint16 focusid = ids->read2();
- focus_child = 0;
- notifier = ids->read2();
- process_result = ids->read4();
+ _focusChild = 0;
+ _notifier = ids->read2();
+ _processResult = ids->read4();
// read children
uint32 childcount = ids->read4();
@@ -853,7 +852,7 @@ bool Gump::loadData(IDataSource *ids, uint32 version) {
AddChild(child, false);
if (child->getObjId() == focusid)
- focus_child = child;
+ _focusChild = child;
}
diff --git a/engines/ultima/ultima8/gumps/gump.h b/engines/ultima/ultima8/gumps/gump.h
index bd7888f..43eab95 100644
--- a/engines/ultima/ultima8/gumps/gump.h
+++ b/engines/ultima/ultima8/gumps/gump.h
@@ -44,37 +44,35 @@ class GumpNotifyProcess;
//
class Gump : public Object {
-protected:
-
friend class GumpList;
-
- uint16 owner; // Owner item
- Gump *parent; // Parent gump
- int32 x, y; // Gump's position in parent.
+protected:
+ uint16 _owner; // Owner item
+ Gump *_parent; // Parent gump
+ int32 _x, _y; // Gump's position in parent.
// Always the upper left corner!
- Rect dims; // The dimensions/coord space of the gump
- uint32 flags; // Gump flags
- int32 layer; // gump ordering layer
+ Rect _dims; // The dimensions/coord space of the gump
+ uint32 _flags; // Gump flags
+ int32 _layer; // gump ordering layer
- int32 index; // 'Index'
+ int32 _index; // 'Index'
- Shape *shape; // The gumps shape (always painted at 0,0)
- uint32 framenum;
+ Shape *_shape; // The gumps shape (always painted at 0,0)
+ uint32 _frameNum;
//! The Gump list for this gump. This will contain all child gumps,
//! as well as all gump widgets.
- Std::list<Gump *> children; // List of all gumps
- Gump *focus_child; // The child that has focus
+ Std::list<Gump *> _children; // List of all gumps
+ Gump *_focusChild; // The child that has focus
- uint16 notifier; // Process to notify when we're closing
- uint32 process_result; // Result for the notifier process
+ uint16 _notifier; // Process to notify when we're closing
+ uint32 _processResult; // Result for the notifier process
public:
ENABLE_RUNTIME_CLASSTYPE()
Gump();
Gump(int x, int y, int width, int height, uint16 owner = 0,
- uint32 _Flags = 0, int32 layer = LAYER_NORMAL);
+ uint32 flags = 0, int32 layer = LAYER_NORMAL);
~Gump() override;
public:
@@ -83,29 +81,29 @@ public:
void SetNotifyProcess(GumpNotifyProcess *proc);
GumpNotifyProcess *GetNotifyProcess();
inline uint32 GetResult() {
- return process_result;
+ return _processResult;
}
void SetResult(uint32 res) {
- process_result = res;
+ _processResult = res;
}
//! Set the Gump's shape/frame
- inline void SetShape(Shape *_shape, uint32 _framenum) {
- shape = _shape;
- framenum = _framenum;
+ inline void SetShape(Shape *shape, uint32 frameNum) {
+ _shape = shape;
+ _frameNum = _frameNum;
}
void SetShape(FrameID frame, bool adjustsize = false);
//! Set the Gump's frame
- inline void SetFramenum(uint32 _framenum) {
- framenum = _framenum;
+ inline void Set_frameNum(uint32 frameNum) {
+ _frameNum = _frameNum;
}
//! Init the gump and add it to parent; call after construction
//! When newparent is 0, this will call Ultima8Engine::addGump().
//! \param newparent The Gump's new parent or 0.
- //! \param takefocus If true, set parent's focus_child to this
+ //! \param takefocus If true, set parent's _focusChild to this
virtual void InitGump(Gump *newparent, bool take_focus = true);
//! Find a gump of the specified type (this or child)
@@ -199,19 +197,19 @@ public:
//! Check to see if a Gump is Closing
bool IsClosing() {
- return (flags & FLAG_CLOSING) != 0;
+ return (_flags & FLAG_CLOSING) != 0;
}
//! Move this gump
- virtual void Move(int32 x_, int32 y_) {
- x = x_;
- y = y_;
+ virtual void Move(int32 x, int32 y) {
+ _x = x;
+ _y = y;
}
//! Move this gump relative to its current position
- virtual void MoveRelative(int x_, int y_) {
- x += x_;
- y += y_;
+ virtual void MoveRelative(int x, int y) {
+ _x += x;
+ _y += y;
}
enum Position {
@@ -234,18 +232,18 @@ public:
// Points and Coords
//
- //! Get the dims
- virtual void GetDims(Rect &d) {
- d = dims;
+ //! Get the _dims
+ virtual void GetDims(Rect &d) {
+ d = _dims;
}
- //! Set the dims
- virtual void SetDims(const Rect &d) {
- dims = d;
+ //! Set the _dims
+ virtual void SetDims(const Rect &d) {
+ _dims = d;
}
//! Detect if a point is on the gump
- virtual bool PointOnGump(int mx, int my);
+ virtual bool PointOnGump(int mx, int my);
enum PointRoundDir {
ROUND_TOPLEFT = 0,
@@ -336,12 +334,12 @@ public:
// Is this gump the focus?
inline bool IsFocus() {
- return parent ? parent->focus_child == this : false;
+ return _parent ? _parent->_focusChild == this : false;
}
// Get the child in focus
inline Gump *GetFocusChild() {
- return focus_child;
+ return _focusChild;
}
// Find a new Child to be the focus
@@ -353,67 +351,67 @@ public:
//
//! Add a gump to the child list.
- virtual void AddChild(Gump *, bool take_focus = true);
+ virtual void AddChild(Gump *, bool take_focus = true);
//! Remove a gump from the child list
- virtual void RemoveChild(Gump *);
+ virtual void RemoveChild(Gump *);
//! Move child to front (within its layer)
- virtual void MoveChildToFront(Gump *);
+ virtual void MoveChildToFront(Gump *);
//! Get the parent
- inline Gump *GetParent() {
- return parent;
+ inline Gump *GetParent() {
+ return _parent;
}
//! Get the root gump (or self)
- Gump *GetRootGump();
+ Gump *GetRootGump();
//! This function is used by our children to notifty us of 'something'
//! Think of it as a generic call back function
- virtual void ChildNotify(Gump *child, uint32 message) { }
- void SetIndex(int32 i) {
- index = i;
+ virtual void ChildNotify(Gump *child, uint32 message) { }
+ void SetIndex(int32 i) {
+ _index = i;
}
- int32 GetIndex() {
- return index;
+ int32 GetIndex() {
+ return _index;
}
// Dragging
//! Called when a child gump starts to be dragged.
//! \return false if the child isn't allowed to be dragged.
- virtual bool StartDraggingChild(Gump *gump, int32 mx, int32 my);
- virtual void DraggingChild(Gump *gump, int mx, int my);
- virtual void StopDraggingChild(Gump *gump);
+ virtual bool StartDraggingChild(Gump *gump, int32 mx, int32 my);
+ virtual void DraggingChild(Gump *gump, int mx, int my);
+ virtual void StopDraggingChild(Gump *gump);
//! This will be called when an item in this gump starts to be dragged.
//! \return false if the item isn't allowed to be dragged.
- virtual bool StartDraggingItem(Item *item, int mx, int my) {
+ virtual bool StartDraggingItem(Item *item, int mx, int my) {
return false;
}
//! Called when an item is being dragged over the gump.
//! Note: this may be called on a different gump than StartDraggingItem.
//! \return false if the item can't be dragged to this location.
- virtual bool DraggingItem(Item *item, int mx, int my) {
+ virtual bool DraggingItem(Item *item, int mx, int my) {
return false;
}
//! Called when an item that was being dragged over the gump left the gump
- virtual void DraggingItemLeftGump(Item *item) { }
+ virtual void DraggingItemLeftGump(Item *item) { }
//! Called when a drag operation finished.
//! This is called on the same gump that received StartDraggingItem
//! \param moved If true, the item was actually dragged somewhere else.
//! If false, the drag was cancelled.
- virtual void StopDraggingItem(Item *item, bool moved) { }
+ virtual void StopDraggingItem(Item *item, bool moved) { }
//! Called when an item has been dropped on a gump.
//! This is called after StopDraggingItem has been called, but possibly
//! on a different gump.
//! It's guaranteed that a gump will only receive a DropItem at a location
//! if a DraggingItem there returned true.
- virtual void DropItem(Item *item, int mx, int my) { }
+ virtual void DropItem(Item *item, int mx, int my) { }
public:
@@ -433,17 +431,17 @@ public:
// (only for ItemRelativeGumps)
};
- inline bool IsHidden() {
- return (flags & FLAG_HIDDEN) || (parent && parent->IsHidden());
+ inline bool IsHidden() {
+ return (_flags & FLAG_HIDDEN) || (_parent && _parent->IsHidden());
}
- bool IsDraggable() {
- return flags & FLAG_DRAGGABLE;
+ bool IsDraggable() {
+ return _flags & FLAG_DRAGGABLE;
}
- virtual void HideGump() {
- flags |= FLAG_HIDDEN;
+ virtual void HideGump() {
+ _flags |= FLAG_HIDDEN;
}
- virtual void UnhideGump() {
- flags &= ~FLAG_HIDDEN;
+ virtual void UnhideGump() {
+ _flags &= ~FLAG_HIDDEN;
}
bool mustSave(bool toplevel);
diff --git a/engines/ultima/ultima8/gumps/inverter_gump.cpp b/engines/ultima/ultima8/gumps/inverter_gump.cpp
index 780f0bd..c7f0c3b 100644
--- a/engines/ultima/ultima8/gumps/inverter_gump.cpp
+++ b/engines/ultima/ultima8/gumps/inverter_gump.cpp
@@ -32,8 +32,8 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(InverterGump, DesktopGump)
-InverterGump::InverterGump(int32 _x, int32 _y, int32 _width, int32 _height)
- : DesktopGump(_x, _y, _width, _height) {
+InverterGump::InverterGump(int32 x, int32 y, int32 width, int32 height)
+ : DesktopGump(x, y, width, height) {
buffer = 0;
}
@@ -90,7 +90,7 @@ void InverterGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sc
return;
}
- int width = dims.w, height = dims.h;
+ int width = _dims.w, height = _dims.h;
// need a backbuffer
@@ -114,20 +114,20 @@ void InverterGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sc
// Convert a parent relative point to a gump point
void InverterGump::ParentToGump(int32 &px, int32 &py, PointRoundDir) {
- px -= x;
- px += dims.x;
- py -= y;
- if (Ultima8Engine::get_instance()->isInverted()) py = dims.h - py - 1;
- py += dims.y;
+ px -= _x;
+ px += _dims.x;
+ py -= _y;
+ if (Ultima8Engine::get_instance()->isInverted()) py = _dims.h - py - 1;
+ py += _dims.y;
}
// Convert a gump point to parent relative point
void InverterGump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir) {
- gx -= dims.x;
- gx += x;
- gy -= dims.y;
- if (Ultima8Engine::get_instance()->isInverted()) gy = dims.h - gy - 1;
- gy += y;
+ gx -= _dims.x;
+ gx += _x;
+ gy -= _dims.y;
+ if (Ultima8Engine::get_instance()->isInverted()) gy = _dims.h - gy - 1;
+ gy += _y;
}
void InverterGump::RenderSurfaceChanged() {
diff --git a/engines/ultima/ultima8/gumps/item_relative_gump.cpp b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
index 072ec3d..4f6d20e 100644
--- a/engines/ultima/ultima8/gumps/item_relative_gump.cpp
+++ b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
@@ -39,9 +39,9 @@ ItemRelativeGump::ItemRelativeGump()
: Gump(), ix(0), iy(0) {
}
-ItemRelativeGump::ItemRelativeGump(int32 x_, int32 y_, int32 width, int32 height,
- uint16 owner_, uint32 _Flags, int32 _Layer)
- : Gump(x_, y_, width, height, owner_, _Flags, _Layer), ix(0), iy(0) {
+ItemRelativeGump::ItemRelativeGump(int32 x, int32 y, int32 width, int32 height,
+ uint16 owner, uint32 flags, int32 layer)
+ : Gump(x, y, width, height, owner, flags, layer), ix(0), iy(0) {
}
ItemRelativeGump::~ItemRelativeGump(void) {
@@ -52,25 +52,25 @@ void ItemRelativeGump::InitGump(Gump *newparent, bool take_focus) {
GetItemLocation(0);
- if (!newparent && parent)
+ if (!newparent && _parent)
MoveOnScreen();
}
void ItemRelativeGump::MoveOnScreen() {
- assert(parent);
+ assert(_parent);
Rect sd, gd;
- parent->GetDims(sd);
+ _parent->GetDims(sd);
// first move back to our desired location
- x = 0;
- y = 0;
+ _x = 0;
+ _y = 0;
// get rectangle that gump occupies in scalerGump's coordinate space
int32 left, right, top, bottom;
- left = -dims.x;
- right = left + dims.w;
- top = -dims.y;
- bottom = top + dims.h;
+ left = -_dims.x;
+ right = left + _dims.w;
+ top = -_dims.y;
+ bottom = top + _dims.h;
GumpToParent(left, top);
GumpToParent(right, bottom);
@@ -117,7 +117,7 @@ void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
Item *prev = 0;
Gump *gump = 0;
- it = getItem(owner);
+ it = getItem(_owner);
if (!it) {
// This shouldn't ever happen, the GumpNotifyProcess should
@@ -144,7 +144,7 @@ void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
return;
}
- gump->GetLocationOfItem(owner, gx, gy, lerp_factor);
+ gump->GetLocationOfItem(_owner, gx, gy, lerp_factor);
} else {
gump->GetLocationOfItem(prev->getObjId(), gx, gy, lerp_factor);
}
@@ -155,22 +155,22 @@ void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
gump->GumpToScreenSpace(gx, gy);
// Convert the screenspace coords into the coords of us
- if (parent) parent->ScreenSpaceToGump(gx, gy);
+ if (_parent) _parent->ScreenSpaceToGump(gx, gy);
// Set x and y, and center us over it
- ix = gx - dims.w / 2;
-// iy = gy-dims.h-it->getShapeInfo()->z*8-16;
- iy = gy - dims.h;
+ ix = gx - _dims.w / 2;
+// iy = gy-_dims.h-it->getShapeInfo()->z*8-16;
+ iy = gy - _dims.h;
- if (flags & FLAG_KEEP_VISIBLE)
+ if (_flags & FLAG_KEEP_VISIBLE)
MoveOnScreen();
}
-void ItemRelativeGump::Move(int32 x_, int32 y_) {
- ParentToGump(x_, y_);
- x += x_;
- y += y_;
+void ItemRelativeGump::Move(int32 x, int32 y) {
+ ParentToGump(x, y);
+ _x += x;
+ _y += y;
}
void ItemRelativeGump::saveData(ODataSource *ods) {
diff --git a/engines/ultima/ultima8/gumps/item_relative_gump.h b/engines/ultima/ultima8/gumps/item_relative_gump.h
index cf4e677..c7ad9d1 100644
--- a/engines/ultima/ultima8/gumps/item_relative_gump.h
+++ b/engines/ultima/ultima8/gumps/item_relative_gump.h
@@ -37,7 +37,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
ItemRelativeGump();
- ItemRelativeGump(int32 x, int32 y, int32 width, int32 height, uint16 owner, uint32 _Flags = 0, int32 layer = LAYER_NORMAL);
+ ItemRelativeGump(int32 x, int32 y, int32 width, int32 height, uint16 owner, uint32 flags = 0, int32 layer = LAYER_NORMAL);
~ItemRelativeGump(void) override;
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/menu_gump.cpp b/engines/ultima/ultima8/gumps/menu_gump.cpp
index fd37cbc..862f533 100644
--- a/engines/ultima/ultima8/gumps/menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/menu_gump.cpp
@@ -92,12 +92,12 @@ static const int menuEntryShape = 37;
void MenuGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
- ShapeFrame *sf = shape->getFrame(0);
+ _shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
+ ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
Shape *logoShape;
logoShape = GameData::get_instance()->getGumps()->getShape(paganShape);
@@ -114,7 +114,7 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
settingman->get("endgame", endgame);
settingman->get("quotes", quotes);
- int x_ = dims.w / 2 + 14;
+ int x_ = _dims.w / 2 + 14;
int y_ = 18;
Gump *widget;
for (int i = 0; i < 8; ++i) {
@@ -141,20 +141,20 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
widget = new TextWidget(0, 0, name, true, 6);
widget->InitGump(this, false);
widget->GetDims(rect);
- widget->Move(90 - rect.w / 2, dims.h - 40);
+ widget->Move(90 - rect.w / 2, _dims.h - 40);
}
} else {
Gump *widget;
widget = new TextWidget(0, 0, _TL_("Give thy name:"), true, 6); // CONSTANT!
widget->InitGump(this, false);
- widget->Move(dims.w / 2 + 6, 10);
+ widget->Move(_dims.w / 2 + 6, 10);
Rect textdims;
widget->GetDims(textdims);
widget = new EditWidget(0, 0, "", true, 6, 110, 40, 15); // CONSTANTS!
widget->InitGump(this, true);
- widget->Move(dims.w / 2 + 6, 10 + textdims.h);
+ widget->Move(_dims.w / 2 + 6, 10 + textdims.h);
widget->MakeFocus();
}
}
diff --git a/engines/ultima/ultima8/gumps/message_box_gump.cpp b/engines/ultima/ultima8/gumps/message_box_gump.cpp
index 608e223..18df713 100644
--- a/engines/ultima/ultima8/gumps/message_box_gump.cpp
+++ b/engines/ultima/ultima8/gumps/message_box_gump.cpp
@@ -93,11 +93,11 @@ void MessageBoxGump::InitGump(Gump *newparent, bool take_focus) {
// Message size
font->getTextSize(message, width, height, rem);
- dims.w = MBG_PADDING + width + MBG_PADDING;
- if (dims.w < MBG_PADDING + title_w + MBG_PADDING) dims.w = MBG_PADDING + title_w + MBG_PADDING;
- if (dims.w < buttons_w) dims.w = buttons_w;
+ _dims.w = MBG_PADDING + width + MBG_PADDING;
+ if (_dims.w < MBG_PADDING + title_w + MBG_PADDING) _dims.w = MBG_PADDING + title_w + MBG_PADDING;
+ if (_dims.w < buttons_w) _dims.w = buttons_w;
- dims.h = 23 + MBG_PADDING + height + MBG_PADDING + 28;
+ _dims.h = 23 + MBG_PADDING + height + MBG_PADDING + 28;
// Title
Gump *w = new TextWidget(MBG_PADDING, 2, title, false, 0);
@@ -108,9 +108,9 @@ void MessageBoxGump::InitGump(Gump *newparent, bool take_focus) {
w->InitGump(this, false);
// Buttons (right aligned)
- int off = dims.w - buttons_w;
+ int off = _dims.w - buttons_w;
for (size_t i = 0; i < buttons.size(); i++) {
- w = new ButtonWidget(off, dims.h - 23, buttons[i], false, 1, 0x80D000D0);
+ w = new ButtonWidget(off, _dims.h - 23, buttons[i], false, 1, 0x80D000D0);
w->SetIndex(static_cast<int32>(i));
w->InitGump(this, false);
width = height = 0;
@@ -132,31 +132,31 @@ void MessageBoxGump::Close(bool no_del) {
void MessageBoxGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled*/) {
// Background is partially transparent
- surf->FillBlended(0x80000000, 0, 0, dims.w, dims.h);
+ surf->FillBlended(0x80000000, 0, 0, _dims.w, _dims.h);
uint32 line_colour = 0xFFFFFFFF;
if (!IsFocus()) line_colour = 0xFF7F7F7F;
// outer border
- surf->Fill32(line_colour, 0, 0, dims.w, 1);
- surf->Fill32(line_colour, 0, 0, 1, dims.h);
- surf->Fill32(line_colour, 0, dims.h - 1, dims.w, 1);
- surf->Fill32(line_colour, dims.w - 1, 0, 1, dims.h);
+ surf->Fill32(line_colour, 0, 0, _dims.w, 1);
+ surf->Fill32(line_colour, 0, 0, 1, _dims.h);
+ surf->Fill32(line_colour, 0, _dims.h - 1, _dims.w, 1);
+ surf->Fill32(line_colour, _dims.w - 1, 0, 1, _dims.h);
// line above buttons
- surf->Fill32(line_colour, 0, dims.h - 28, dims.w, 1);
+ surf->Fill32(line_colour, 0, _dims.h - 28, _dims.w, 1);
// line below title
- surf->Fill32(line_colour, 0, 23, dims.w, 1);
+ surf->Fill32(line_colour, 0, 23, _dims.w, 1);
// Highlight behind message..
- if (IsFocus()) surf->Fill32(title_colour, 1, 1, dims.w - 2, 22);
- else surf->Fill32(0xFF000000, 1, 1, dims.w - 2, 22);
+ if (IsFocus()) surf->Fill32(title_colour, 1, 1, _dims.w - 2, 22);
+ else surf->Fill32(0xFF000000, 1, 1, _dims.w - 2, 22);
}
void MessageBoxGump::ChildNotify(Gump *child, uint32 msg) {
if (child->IsOfType<ButtonWidget>() && msg == ButtonWidget::BUTTON_CLICK) {
- process_result = child->GetIndex();
+ _processResult = child->GetIndex();
Close();
}
}
diff --git a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
index 23552ca..2405505 100644
--- a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
+++ b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
@@ -55,8 +55,8 @@ MiniStatsGump::MiniStatsGump() : Gump() {
}
-MiniStatsGump::MiniStatsGump(int x_, int y_, uint32 _Flags, int32 layer_)
- : Gump(x_, y_, 5, 5, 0, _Flags, layer_) {
+MiniStatsGump::MiniStatsGump(int x, int y, uint32 flags, int32 layer)
+ : Gump(x, y, 5, 5, 0, flags, layer) {
}
@@ -67,12 +67,12 @@ MiniStatsGump::~MiniStatsGump() {
void MiniStatsGump::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
- shape = GameData::get_instance()->getGumps()->getShape(gumpshape);
- ShapeFrame *sf = shape->getFrame(0);
+ _shape = GameData::get_instance()->getGumps()->getShape(gumpshape);
+ ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
}
void MiniStatsGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
diff --git a/engines/ultima/ultima8/gumps/mini_stats_gump.h b/engines/ultima/ultima8/gumps/mini_stats_gump.h
index 53a3f87..fe7eb83 100644
--- a/engines/ultima/ultima8/gumps/mini_stats_gump.h
+++ b/engines/ultima/ultima8/gumps/mini_stats_gump.h
@@ -34,7 +34,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
MiniStatsGump();
- MiniStatsGump(int x, int y, uint32 _Flags = FLAG_DRAGGABLE,
+ MiniStatsGump(int x, int y, uint32 flags = FLAG_DRAGGABLE,
int32 layer = LAYER_NORMAL);
~MiniStatsGump(void) override;
diff --git a/engines/ultima/ultima8/gumps/modal_gump.cpp b/engines/ultima/ultima8/gumps/modal_gump.cpp
index 966f83c..917082e 100644
--- a/engines/ultima/ultima8/gumps/modal_gump.cpp
+++ b/engines/ultima/ultima8/gumps/modal_gump.cpp
@@ -40,9 +40,9 @@ ModalGump::ModalGump() : Gump() {
}
-ModalGump::ModalGump(int x_, int y_, int width, int height, uint16 owner_,
- uint32 _Flags, int32 layer_)
- : Gump(x_, y_, width, height, owner_, _Flags, layer_) {
+ModalGump::ModalGump(int x, int y, int width, int height, uint16 owner,
+ uint32 flags, int32 layer)
+ : Gump(x, y, width, height, owner, flags, layer) {
}
diff --git a/engines/ultima/ultima8/gumps/modal_gump.h b/engines/ultima/ultima8/gumps/modal_gump.h
index e15dba6..329ba70 100644
--- a/engines/ultima/ultima8/gumps/modal_gump.h
+++ b/engines/ultima/ultima8/gumps/modal_gump.h
@@ -35,7 +35,7 @@ public:
ModalGump();
ModalGump(int x, int y, int width, int height, uint16 owner = 0,
- uint32 _Flags = 0, int32 layer = LAYER_MODAL);
+ uint32 flags = 0, int32 layer = LAYER_MODAL);
~ModalGump() override;
diff --git a/engines/ultima/ultima8/gumps/movie_gump.cpp b/engines/ultima/ultima8/gumps/movie_gump.cpp
index 740e38e..7ce9f5a 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.cpp
+++ b/engines/ultima/ultima8/gumps/movie_gump.cpp
@@ -44,8 +44,8 @@ MovieGump::MovieGump() : ModalGump(), player(0) {
}
MovieGump::MovieGump(int width, int height, RawArchive *movie,
- bool introMusicHack, uint32 _Flags, int32 layer_)
- : ModalGump(50, 50, width, height, 0, _Flags, layer_) {
+ bool introMusicHack, uint32 flags, int32 layer)
+ : ModalGump(50, 50, width, height, 0, flags, layer) {
player = new SKFPlayer(movie, width, height, introMusicHack);
}
diff --git a/engines/ultima/ultima8/gumps/movie_gump.h b/engines/ultima/ultima8/gumps/movie_gump.h
index 8c16135..92336c8 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.h
+++ b/engines/ultima/ultima8/gumps/movie_gump.h
@@ -38,7 +38,7 @@ public:
MovieGump();
MovieGump(int width, int height, RawArchive *skf, bool introMusicHack = false,
- uint32 _Flags = 0, int32 layer = LAYER_MODAL);
+ uint32 flags = 0, int32 layer = LAYER_MODAL);
~MovieGump(void) override;
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/options_gump.cpp b/engines/ultima/ultima8/gumps/options_gump.cpp
index 72545d6..5ec3d93 100644
--- a/engines/ultima/ultima8/gumps/options_gump.cpp
+++ b/engines/ultima/ultima8/gumps/options_gump.cpp
@@ -50,10 +50,10 @@ OptionsGump::~OptionsGump() {
void OptionsGump::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
- dims.w = 220;
- dims.h = 120;
+ _dims.w = 220;
+ _dims.h = 120;
- int x_ = dims.w / 2 + 14;
+ int x_ = _dims.w / 2 + 14;
int y_ = 4;
Gump *widget;
@@ -98,7 +98,7 @@ static const int gumpShape = 35;
bool OptionsGump::OnKeyDown(int key, int mod) {
if (key == Common::KEYCODE_ESCAPE) {
- parent->Close();
+ _parent->Close();
} else if (key >= Common::KEYCODE_1 && key <= Common::KEYCODE_9) {
// Minor hack.
selectEntry(key - Common::KEYCODE_1 + 1);
diff --git a/engines/ultima/ultima8/gumps/paged_gump.cpp b/engines/ultima/ultima8/gumps/paged_gump.cpp
index d7e3caf..8dfae5e 100644
--- a/engines/ultima/ultima8/gumps/paged_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paged_gump.cpp
@@ -60,12 +60,12 @@ static const int pageOverShape = 34;
void PagedGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
- ShapeFrame *sf = shape->getFrame(0);
+ _shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
+ ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
FrameID buttonleft(GameData::GUMPS, pageOverShape, 0);
FrameID buttonright(GameData::GUMPS, pageOverShape, 1);
@@ -151,7 +151,7 @@ void PagedGump::addPage(Gump *g) {
current = gumps.begin();
(*current)->UnhideGump();
- if (focus_child != *current)
+ if (_focusChild != *current)
(*current)->MakeFocus();
if (current + 1 == gumps.end())
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
index 94aaa73..57f9b2e 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
@@ -91,9 +91,9 @@ PaperdollGump::PaperdollGump() : ContainerGump(), statbuttongid(0),
Common::fill(cached_val, cached_val + 7, 0);
}
-PaperdollGump::PaperdollGump(Shape *shape_, uint32 framenum_, uint16 owner_,
- uint32 Flags_, int32 layer_)
- : ContainerGump(shape_, framenum_, owner_, Flags_, layer_),
+PaperdollGump::PaperdollGump(Shape *shape_, uint32 frameNum, uint16 owner,
+ uint32 Flags, int32 layer)
+ : ContainerGump(shape_, frameNum, owner, Flags, layer),
statbuttongid(0), backpack_rect(49, 25, 10, 25) {
statbuttongid = 0;
@@ -125,7 +125,7 @@ void PaperdollGump::Close(bool no_del) {
// because we do not want to close the Gumps of our contents.
// Make every item leave the fast area
- Container *c = getContainer(owner);
+ Container *c = getContainer(_owner);
if (!c) return; // Container gone!?
Std::list<Item *> &contents = c->contents;
@@ -136,7 +136,7 @@ void PaperdollGump::Close(bool no_del) {
item->leaveFastArea(); // Can destroy the item
}
- Item *o = getItem(owner);
+ Item *o = getItem(_owner);
if (o)
o->clearGump(); //!! is this the appropriate place?
@@ -172,7 +172,7 @@ void PaperdollGump::PaintStat(RenderSurface *surf, unsigned int n,
}
void PaperdollGump::PaintStats(RenderSurface *surf, int32 lerp_factor) {
- Actor *a = getActor(owner);
+ Actor *a = getActor(_owner);
assert(a);
PaintStat(surf, 0, _TL_("STR"), a->getStr());
@@ -188,7 +188,7 @@ void PaperdollGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
// paint self
ItemRelativeGump::PaintThis(surf, lerp_factor, scaled);
- Actor *a = getActor(owner);
+ Actor *a = getActor(_owner);
if (!a) {
// Actor gone!?
@@ -232,7 +232,7 @@ uint16 PaperdollGump::TraceObjId(int32 mx, int32 my) {
ParentToGump(mx, my);
- Actor *a = getActor(owner);
+ Actor *a = getActor(_owner);
if (!a) return 0; // Container gone!?
@@ -272,7 +272,7 @@ bool PaperdollGump::GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy,
Item *item = getItem(itemid);
Item *parent_ = item->getParentAsContainer();
if (!parent_) return false;
- if (parent_->getObjId() != owner) return false;
+ if (parent_->getObjId() != _owner) return false;
//!!! need to use lerp_factor
@@ -318,7 +318,7 @@ bool PaperdollGump::DraggingItem(Item *item, int mx, int my) {
return false;
}
- Actor *a = getActor(owner);
+ Actor *a = getActor(_owner);
assert(a);
bool over_backpack = false;
@@ -364,7 +364,7 @@ bool PaperdollGump::DraggingItem(Item *item, int mx, int my) {
void PaperdollGump::DropItem(Item *item, int mx, int my) {
display_dragging = false;
- Actor *a = getActor(owner);
+ Actor *a = getActor(_owner);
assert(a);
bool over_backpack = false;
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.h b/engines/ultima/ultima8/gumps/paperdoll_gump.h
index 8ae7877..335cac1 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.h
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.h
@@ -36,8 +36,8 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
PaperdollGump();
- PaperdollGump(Shape *shape, uint32 framenum, uint16 owner,
- uint32 _Flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
+ PaperdollGump(Shape *shape, uint32 frameNum, uint16 owner,
+ uint32 flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
~PaperdollGump(void) override;
// Init the gump, call after construction
diff --git a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp b/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
index 624b1dd..d9a2ad6 100644
--- a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
@@ -99,7 +99,7 @@ void PentagramMenuGump::InitGump(Gump *newparent, bool take_focus) {
}
void PentagramMenuGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled*/) {
- int w = dims.w, h = dims.h;
+ int w = _dims.w, h = _dims.h;
#if 1
// CHECKME: fast enough?
for (int i = 0; i < h; i += 4) {
@@ -121,10 +121,10 @@ void PentagramMenuGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /
void PentagramMenuGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) {
// Iterate all children
- Std::list<Gump *>::iterator it = children.begin();
- Std::list<Gump *>::iterator end = children.end();
+ Std::list<Gump *>::iterator it = _children.begin();
+ Std::list<Gump *>::iterator end = _children.end();
- Rect game_clip_rect(0, 45, SCREEN_WIDTH, dims.h - 58);
+ Rect game_clip_rect(0, 45, SCREEN_WIDTH, _dims.h - 58);
Rect cur_clip_rect;
surf->GetClippingRect(cur_clip_rect);
diff --git a/engines/ultima/ultima8/gumps/quit_gump.cpp b/engines/ultima/ultima8/gumps/quit_gump.cpp
index 6f8c2d9..e5a27e1 100644
--- a/engines/ultima/ultima8/gumps/quit_gump.cpp
+++ b/engines/ultima/ultima8/gumps/quit_gump.cpp
@@ -58,22 +58,22 @@ static const int noShapeId = 50;
void QuitGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
- ShapeFrame *sf = shape->getFrame(0);
+ _shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
+ ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
FrameID askshape(GameData::GUMPS, askShapeId, 0);
askshape = _TL_SHP_(askshape);
Shape *askShape = GameData::get_instance()->getShape(askshape);
- sf = askShape->getFrame(askshape.framenum);
+ sf = askShape->getFrame(askshape._frameNum);
assert(sf);
Gump *ask = new Gump(0, 0, sf->width, sf->height);
- ask->SetShape(askShape, askshape.framenum);
+ ask->SetShape(askShape, askshape._frameNum);
ask->InitGump(this);
ask->setRelativePosition(TOP_CENTER, 0, 5);
diff --git a/engines/ultima/ultima8/gumps/readable_gump.cpp b/engines/ultima/ultima8/gumps/readable_gump.cpp
index ad11117..b8fff4f 100644
--- a/engines/ultima/ultima8/gumps/readable_gump.cpp
+++ b/engines/ultima/ultima8/gumps/readable_gump.cpp
@@ -68,8 +68,8 @@ void ReadableGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = shape_->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
if (CoreApp::get_instance()->getGameInfo()->language ==
GameInfo::GAMELANG_JAPANESE) {
@@ -86,7 +86,7 @@ void ReadableGump::InitGump(Gump *newparent, bool take_focus) {
}
}
- Gump *widget = new TextWidget(0, 0, text, true, fontnum, dims.w - 16, 0, Font::TEXT_CENTER);
+ Gump *widget = new TextWidget(0, 0, text, true, fontnum, _dims.w - 16, 0, Font::TEXT_CENTER);
widget->InitGump(this);
widget->setRelativePosition(CENTER);
}
diff --git a/engines/ultima/ultima8/gumps/scaler_gump.cpp b/engines/ultima/ultima8/gumps/scaler_gump.cpp
index ae96893..08773b2 100644
--- a/engines/ultima/ultima8/gumps/scaler_gump.cpp
+++ b/engines/ultima/ultima8/gumps/scaler_gump.cpp
@@ -34,11 +34,11 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(ScalerGump, DesktopGump)
-ScalerGump::ScalerGump(int32 _x, int32 _y, int32 _width, int32 _height) :
- DesktopGump(_x, _y, _width, _height),
- swidth1(_width), sheight1(_height), scaler1(0), buffer1(0),
- swidth2(_width), sheight2(_height), scaler2(0), buffer2(0),
- width(_width), height(_height) {
+ScalerGump::ScalerGump(int32 x, int32 y, int32 width, int32 height) :
+ DesktopGump(x, y, width, height),
+ swidth1(width), sheight1(height), scaler1(0), buffer1(0),
+ swidth2(width), sheight2(height), scaler2(0), buffer2(0),
+ width(width), height(height) {
setupScaling();
}
@@ -82,8 +82,8 @@ void ScalerGump::Paint(RenderSurface *surf, int32 lerp_factor, bool scaled) {
int32 scaley = (height << 16) / sheight1;
// Iterate all children
- Std::list<Gump *>::reverse_iterator it = children.rbegin();
- Std::list<Gump *>::reverse_iterator end = children.rend();
+ Std::list<Gump *>::reverse_iterator it = _children.rbegin();
+ Std::list<Gump *>::reverse_iterator end = _children.rend();
while (it != end) {
Gump *g = *it;
@@ -131,14 +131,14 @@ void ScalerGump::DoScalerBlit(Texture *src, int swidth, int sheight, RenderSurfa
// Convert a parent relative point to a gump point
void ScalerGump::ParentToGump(int32 &px, int32 &py, PointRoundDir r) {
- px -= x;
- px *= dims.w;
+ px -= _x;
+ px *= _dims.w;
if (px < 0 && r == ROUND_TOPLEFT) px -= (width - 1);
if (px > 0 && r == ROUND_BOTTOMRIGHT) px += (width - 1);
px /= width;
- py -= y;
- py *= dims.h;
+ py -= _y;
+ py *= _dims.h;
if (py < 0 && r == ROUND_TOPLEFT) py -= (height - 1);
if (py > 0 && r == ROUND_BOTTOMRIGHT) py += (height - 1);
py /= height;
@@ -147,22 +147,22 @@ void ScalerGump::ParentToGump(int32 &px, int32 &py, PointRoundDir r) {
// Convert a gump point to parent relative point
void ScalerGump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir r) {
gx *= width;
- if (gx < 0 && r == ROUND_TOPLEFT) gx -= (dims.w - 1);
- if (gx > 0 && r == ROUND_BOTTOMRIGHT) gx += (dims.w - 1);
- gx /= dims.w;
- gx += x;
+ if (gx < 0 && r == ROUND_TOPLEFT) gx -= (_dims.w - 1);
+ if (gx > 0 && r == ROUND_BOTTOMRIGHT) gx += (_dims.w - 1);
+ gx /= _dims.w;
+ gx += _x;
gy *= height;
- if (gy < 0 && r == ROUND_TOPLEFT) gy -= (dims.h - 1);
- if (gy > 0 && r == ROUND_BOTTOMRIGHT) gy += (dims.h - 1);
- gy /= dims.h;
- gy += y;
+ if (gy < 0 && r == ROUND_TOPLEFT) gy -= (_dims.h - 1);
+ if (gy > 0 && r == ROUND_BOTTOMRIGHT) gy += (_dims.h - 1);
+ gy /= _dims.h;
+ gy += _y;
}
void ScalerGump::RenderSurfaceChanged() {
// Resize the gump to match the RenderSurface
Rect new_dims;
- parent->GetDims(new_dims);
+ _parent->GetDims(new_dims);
width = new_dims.w;
height = new_dims.h;
@@ -197,8 +197,8 @@ void ScalerGump::setupScaling() {
if (sheight2 < 0) sheight2 = -sheight2;
else if (sheight2 != 0 && sheight2 < 100) sheight2 = height / sheight2;
- dims.w = swidth1;
- dims.h = sheight1;
+ _dims.w = swidth1;
+ _dims.h = sheight1;
// We don't care, we are not going to support filters, at least not at the moment
if (swidth1 == width && sheight1 == height) return;
diff --git a/engines/ultima/ultima8/gumps/scroll_gump.cpp b/engines/ultima/ultima8/gumps/scroll_gump.cpp
index 60d9b0f..2ae0654 100644
--- a/engines/ultima/ultima8/gumps/scroll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/scroll_gump.cpp
@@ -71,8 +71,8 @@ void ScrollGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = shape_->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
}
void ScrollGump::NextText() {
diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
index 67ee7be..434745e 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
@@ -53,19 +53,19 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(ShapeViewerGump, ModalGump)
ShapeViewerGump::ShapeViewerGump()
- : ModalGump(), curflex(0), flex(0), curshape(0), curframe(0), background(0) {
+ : ModalGump(), _curFlex(0), _flex(0), _curShape(0), _curFrame(0), _background(0) {
}
ShapeViewerGump::ShapeViewerGump(int width, int height,
- Std::vector<Std::pair<Std::string, ShapeArchive *> > &flexes_,
- uint32 _Flags, int32 layer_)
- : ModalGump(50, 50, width, height, 0, _Flags, layer_),
- flexes(flexes_), curflex(0), curshape(0), curframe(0), background(0) {
- if (flexes.size())
- flex = flexes[0].second;
+ Std::vector<Std::pair<Std::string, ShapeArchive *> > &flexes,
+ uint32 flags, int32 layer)
+ : ModalGump(50, 50, width, height, 0, flags, layer),
+ _flexes(flexes), _curFlex(0), _curShape(0), _curFrame(0), _background(0) {
+ if (_flexes.size())
+ _flex = _flexes[0].second;
else
- flex = 0;
+ _flex = 0;
}
ShapeViewerGump::~ShapeViewerGump() {
@@ -73,19 +73,19 @@ ShapeViewerGump::~ShapeViewerGump() {
}
void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled*/) {
- if (flexes.empty()) {
+ if (_flexes.empty()) {
Close();
return;
}
- surf->Fill32(background, 0, 0, dims.w, dims.h);
+ surf->Fill32(_background, 0, 0, _dims.w, _dims.h);
- int32 posx = (dims.w - shapew) / 2 + shapex;
- int32 posy = (dims.h - shapeh) / 2 + shapey;
+ int32 posx = (_dims.w - _shapeW) / 2 + _shapeX;
+ int32 posy = (_dims.h - _shapeH) / 2 + _shapeY;
- Shape *shape_ = flex->getShape(curshape);
- if (shape_ && curframe < shape_->frameCount())
- surf->Paint(shape_, curframe, posx, posy);
+ Shape *shape_ = _flex->getShape(_curShape);
+ if (shape_ && _curFrame < shape_->frameCount())
+ surf->Paint(shape_, _curFrame, posx, posy);
RenderedText *rendtext;
Font *font = FontManager::get_instance()->getGameFont(0, true);
@@ -96,22 +96,22 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
if (!shape_) {
sprintf(buf1, "NULL");
} else {
- sprintf(buf1, "Frame %d of %d", curframe, shape_->frameCount());
+ sprintf(buf1, "Frame %d of %d", _curFrame, shape_->frameCount());
}
- sprintf(buf2, "%s\nShape %d, %s", flexes[curflex].first.c_str(),
- curshape, buf1);
+ sprintf(buf2, "%s\nShape %d, %s", _flexes[_curFlex].first.c_str(),
+ _curShape, buf1);
rendtext = font->renderText(buf2, remaining);
rendtext->draw(surf, 20, 20);
delete rendtext;
- MainShapeArchive *mainshapes = p_dynamic_cast<MainShapeArchive *>(flex);
+ MainShapeArchive *mainshapes = p_dynamic_cast<MainShapeArchive *>(_flex);
if (!mainshapes || !shape_) return;
char buf3[128];
char buf4[128];
char buf5[128];
char buf6[512];
- ShapeInfo *info = mainshapes->getShapeInfo(curshape);
+ ShapeInfo *info = mainshapes->getShapeInfo(_curShape);
if (info) {
sprintf(buf3, "x = %d, y = %d, z = %d\n flags = 0x%04X, family = %d",
info->x, info->y, info->z, info->flags, info->family);
@@ -120,7 +120,7 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
sprintf(buf5, "volume = %d\n animtype = %d, animdata = %d",
info->animtype, info->animdata, info->volume);
sprintf(buf6, "ShapeInfo:\n %s\n %s, %s\nUsecode: %s",
- buf3, buf4, buf5, GameData::get_instance()->getMainUsecode()->get_class_name(curshape));
+ buf3, buf4, buf5, GameData::get_instance()->getMainUsecode()->get_class_name(_curShape));
rendtext = font->renderText(buf6, remaining);
rendtext->draw(surf, 300, 20);
delete rendtext;
@@ -134,67 +134,67 @@ bool ShapeViewerGump::OnKeyDown(int key, int mod) {
switch (key) {
case Common::KEYCODE_UP:
- if (delta >= flex->getCount()) delta = 1;
- if (curshape < delta)
- curshape = flex->getCount() + curshape - delta;
+ if (delta >= _flex->getCount()) delta = 1;
+ if (_curShape < delta)
+ _curShape = _flex->getCount() + _curShape - delta;
else
- curshape -= delta;
+ _curShape -= delta;
shapechanged = true;
- curframe = 0;
+ _curFrame = 0;
break;
case Common::KEYCODE_DOWN:
- if (delta >= flex->getCount()) delta = 1;
- if (curshape + delta >= flex->getCount())
- curshape = curshape + delta - flex->getCount();
+ if (delta >= _flex->getCount()) delta = 1;
+ if (_curShape + delta >= _flex->getCount())
+ _curShape = _curShape + delta - _flex->getCount();
else
- curshape += delta;
- curframe = 0;
+ _curShape += delta;
+ _curFrame = 0;
shapechanged = true;
break;
case Common::KEYCODE_LEFT: {
- Shape *shape_ = flex->getShape(curshape);
+ Shape *shape_ = _flex->getShape(_curShape);
if (shape_ && shape_->frameCount()) {
if (delta >= shape_->frameCount()) delta = 1;
- if (curframe < delta)
- curframe = shape_->frameCount() + curframe - delta;
+ if (_curFrame < delta)
+ _curFrame = shape_->frameCount() + _curFrame - delta;
else
- curframe -= delta;
+ _curFrame -= delta;
}
}
break;
case Common::KEYCODE_RIGHT: {
- Shape *shape_ = flex->getShape(curshape);
+ Shape *shape_ = _flex->getShape(_curShape);
if (shape_ && shape_->frameCount()) {
if (delta >= shape_->frameCount()) delta = 1;
- if (curframe + delta >= shape_->frameCount())
- curframe = curframe + delta - shape_->frameCount();
+ if (_curFrame + delta >= shape_->frameCount())
+ _curFrame = _curFrame + delta - shape_->frameCount();
else
- curframe += delta;
+ _curFrame += delta;
}
}
break;
case Common::KEYCODE_PAGEUP: {
- if (curflex == 0)
- curflex = flexes.size() - 1;
+ if (_curFlex == 0)
+ _curFlex = _flexes.size() - 1;
else
- curflex--;
+ _curFlex--;
- flex = flexes[curflex].second;
+ _flex = _flexes[_curFlex].second;
shapechanged = true;
- curshape = 0;
- curframe = 0;
+ _curShape = 0;
+ _curFrame = 0;
}
break;
case Common::KEYCODE_PAGEDOWN: {
- if (curflex + 1 == flexes.size())
- curflex = 0;
+ if (_curFlex + 1 == _flexes.size())
+ _curFlex = 0;
else
- curflex++;
+ _curFlex++;
- flex = flexes[curflex].second;
+ _flex = _flexes[_curFlex].second;
shapechanged = true;
- curshape = 0;
- curframe = 0;
+ _curShape = 0;
+ _curFrame = 0;
}
break;
case Common::KEYCODE_ESCAPE: {
@@ -206,9 +206,9 @@ bool ShapeViewerGump::OnKeyDown(int key, int mod) {
}
if (shapechanged) {
- Shape *shape_ = flex->getShape(curshape);
+ Shape *shape_ = _flex->getShape(_curShape);
if (shape_)
- shape_->getTotalDimensions(shapew, shapeh, shapex, shapey);
+ shape_->getTotalDimensions(_shapeW, _shapeH, _shapeX, _shapeY);
}
return true;
@@ -217,8 +217,8 @@ bool ShapeViewerGump::OnKeyDown(int key, int mod) {
bool ShapeViewerGump::OnTextInput(int unicode) {
switch (unicode) {
case 'b':
- background += 0x808080;
- background &= 0xF0F0F0;
+ _background += 0x808080;
+ _background &= 0xF0F0F0;
break;
default:
break;
@@ -232,26 +232,26 @@ bool ShapeViewerGump::OnTextInput(int unicode) {
void ShapeViewerGump::U8ShapeViewer() {
GameData *gamedata = GameData::get_instance();
- Std::vector<Std::pair<Std::string, ShapeArchive *> > flexes;
- Std::pair<Std::string, ShapeArchive *> flex;
- flex.first = "u8shapes";
- flex.second = gamedata->getMainShapes();
- flexes.push_back(flex);
- flex.first = "u8gumps";
- flex.second = gamedata->getGumps();
- flexes.push_back(flex);
- flex.first = "u8fonts";
- flex.second = gamedata->getFonts();
- flexes.push_back(flex);
+ Std::vector<Std::pair<Std::string, ShapeArchive *> > _flexes;
+ Std::pair<Std::string, ShapeArchive *> _flex;
+ _flex.first = "u8shapes";
+ _flex.second = gamedata->getMainShapes();
+ _flexes.push_back(_flex);
+ _flex.first = "u8gumps";
+ _flex.second = gamedata->getGumps();
+ _flexes.push_back(_flex);
+ _flex.first = "u8fonts";
+ _flex.second = gamedata->getFonts();
+ _flexes.push_back(_flex);
FileSystem *filesys = FileSystem::get_instance();
IDataSource *eintro = filesys->ReadFile("@game/static/eintro.skf");
if (eintro) {
ShapeArchive *eintroshapes = new ShapeArchive(eintro, GameData::OTHER,
PaletteManager::get_instance()->getPalette(PaletteManager::Pal_Game),
&U8SKFShapeFormat);
- flex.first = "eintro";
- flex.second = eintroshapes;
- flexes.push_back(flex);
+ _flex.first = "eintro";
+ _flex.second = eintroshapes;
+ _flexes.push_back(_flex);
// !! memory leak
}
@@ -260,9 +260,9 @@ void ShapeViewerGump::U8ShapeViewer() {
ShapeArchive *endgameshapes = new ShapeArchive(endgame, GameData::OTHER,
PaletteManager::get_instance()->getPalette(PaletteManager::Pal_Game),
&U8SKFShapeFormat);
- flex.first = "endgame";
- flex.second = endgameshapes;
- flexes.push_back(flex);
+ _flex.first = "endgame";
+ _flex.second = endgameshapes;
+ _flexes.push_back(_flex);
// !! memory leak
}
@@ -270,7 +270,7 @@ void ShapeViewerGump::U8ShapeViewer() {
Rect res;
desktopGump->GetDims(res);
- ModalGump *gump = new ShapeViewerGump((res.w * 3) / 4, (res.h * 3) / 4, flexes);
+ ModalGump *gump = new ShapeViewerGump((res.w * 3) / 4, (res.h * 3) / 4, _flexes);
gump->InitGump(0);
}
diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.h b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
index a3f402d..409ae4e 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.h
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
@@ -41,7 +41,7 @@ public:
ShapeViewerGump();
ShapeViewerGump(int width, int height,
Std::vector<Std::pair<Std::string, ShapeArchive *> > &flexes,
- uint32 _Flags = 0, int32 layer = LAYER_MODAL);
+ uint32 flags = 0, int32 layer = LAYER_MODAL);
~ShapeViewerGump(void) override;
void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
@@ -56,15 +56,15 @@ public:
protected:
void saveData(ODataSource *ods) override;
- Std::vector<Std::pair<Std::string, ShapeArchive *> > flexes;
- unsigned int curflex;
- ShapeArchive *flex;
- uint32 curshape;
- uint32 curframe;
+ Std::vector<Std::pair<Std::string, ShapeArchive *> > _flexes;
+ unsigned int _curFlex;
+ ShapeArchive *_flex;
+ uint32 _curShape;
+ uint32 _curFrame;
- uint32 background;
+ uint32 _background;
- int32 shapew, shapeh, shapex, shapey;
+ int32 _shapeW, _shapeH, _shapeX, _shapeY;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/slider_gump.cpp b/engines/ultima/ultima8/gumps/slider_gump.cpp
index 684c13a..b8bcf00 100644
--- a/engines/ultima/ultima8/gumps/slider_gump.cpp
+++ b/engines/ultima/ultima8/gumps/slider_gump.cpp
@@ -129,12 +129,12 @@ void SliderGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
void SliderGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- shape = GameData::get_instance()->getGumps()->getShape(gumpshape);
- ShapeFrame *sf = shape->getFrame(0);
+ _shape = GameData::get_instance()->getGumps()->getShape(gumpshape);
+ ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
Shape *childshape = GameData::get_instance()->
getGumps()->getShape(slidershape);
@@ -190,7 +190,7 @@ void SliderGump::ChildNotify(Gump *child, uint32 message) {
void SliderGump::Close(bool no_del) {
- process_result = value;
+ _processResult = value;
if (usecodeNotifyPID) {
UCProcess *ucp = p_dynamic_cast<UCProcess *>(Kernel::get_instance()->getProcess(usecodeNotifyPID));
diff --git a/engines/ultima/ultima8/gumps/target_gump.cpp b/engines/ultima/ultima8/gumps/target_gump.cpp
index d32c3ce..027a19d 100644
--- a/engines/ultima/ultima8/gumps/target_gump.cpp
+++ b/engines/ultima/ultima8/gumps/target_gump.cpp
@@ -83,9 +83,9 @@ bool TargetGump::PointOnGump(int mx, int my) {
void TargetGump::OnMouseUp(int button, int32 mx, int32 my) {
target_tracing = true;
- parent->GumpToScreenSpace(mx, my);
+ _parent->GumpToScreenSpace(mx, my);
- Gump *desktopgump = parent;
+ Gump *desktopgump = _parent;
ObjId objId_ = desktopgump->TraceObjId(mx, my);
Item *item = getItem(objId_);
@@ -94,7 +94,7 @@ void TargetGump::OnMouseUp(int button, int32 mx, int32 my) {
pout << "Target result: ";
item->dumpInfo();
- process_result = objId_;
+ _processResult = objId_;
Close();
}
diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
index 708755d..4cf6ac2 100644
--- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp
+++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
@@ -47,8 +47,8 @@ static const int entryfont = 4;
DEFINE_RUNTIME_CLASSTYPE_CODE(U8SaveGump, Gump)
-U8SaveGump::U8SaveGump(bool save_, int page_)
- : Gump(0, 0, 5, 5), save(save_), page(page_) {
+U8SaveGump::U8SaveGump(bool save, int page)
+ : Gump(0, 0, 5, 5), _save(save), _page(page) {
}
@@ -63,31 +63,31 @@ U8SaveGump::~U8SaveGump() {
void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
- dims.w = 220;
- dims.h = 170;
+ _dims.w = 220;
+ _dims.h = 170;
FrameID entry_id(GameData::GUMPS, 46, 0);
entry_id = _TL_SHP_(entry_id);
Shape *entryShape;
entryShape = GameData::get_instance()->getShape(entry_id);
- ShapeFrame *sf = entryShape->getFrame(entry_id.framenum);
+ ShapeFrame *sf = entryShape->getFrame(entry_id._frameNum);
int entrywidth = sf->width;
int entryheight = sf->height;
- if (save)
- editwidgets.resize(6); // constant!
+ if (_save)
+ _editWidgets.resize(6); // constant!
loadDescriptions();
for (int i = 0; i < 6; ++i) {
- int index_ = page * 6 + i;
+ int index_ = _page * 6 + i;
int xbase = 3;
int yi = i;
if (i >= 3) {
- xbase += dims.w / 2 + 9;
+ xbase += _dims.w / 2 + 9;
yi -= 3;
}
@@ -101,7 +101,7 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
FrameID entrynum1_id(GameData::GUMPS, 36, (index_ + 1) / 10 - 1);
entrynum1_id = _TL_SHP_(entrynum1_id);
entryShape = GameData::get_instance()->getShape(entrynum1_id);
- sf = entryShape->getFrame(entrynum1_id.framenum);
+ sf = entryShape->getFrame(entrynum1_id._frameNum);
x_ += 1 + sf->width;
gump = new Gump(xbase + 2 + entrywidth, 3 + 40 * yi, 1, 1);
@@ -126,7 +126,7 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
gump->InitGump(this, false);
if (index_ == 0) {
- // special case for 'The Beginning...' save
+ // special case for 'The Beginning...' _save
Gump *widget = new TextWidget(xbase, 12 + entryheight,
_TL_("The Beginning..."),
true, entryfont, 95);
@@ -134,18 +134,18 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
} else {
- if (save) {
+ if (_save) {
EditWidget *ew = new EditWidget(xbase, entryheight + 4 + 40 * yi,
- descriptions[i],
+ _descriptions[i],
true, entryfont,
95, 38 - entryheight, 0, true);
ew->SetIndex(i + 1);
ew->InitGump(this, false);
- editwidgets[i] = ew;
+ _editWidgets[i] = ew;
} else {
// load
Gump *widget = new TextWidget(xbase, entryheight + 4 + 40 * yi,
- descriptions[i], true, entryfont,
+ _descriptions[i], true, entryfont,
95);
widget->InitGump(this, false);
}
@@ -154,8 +154,8 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
}
// remove focus from children (just in case)
- if (focus_child) focus_child->OnFocus(false);
- focus_child = 0;
+ if (_focusChild) _focusChild->OnFocus(false);
+ _focusChild = 0;
}
void U8SaveGump::Close(bool no_del) {
@@ -164,7 +164,7 @@ void U8SaveGump::Close(bool no_del) {
void U8SaveGump::OnFocus(bool gain) {
if (gain) {
- if (save)
+ if (_save)
Mouse::get_instance()->setMouseCursor(Mouse::MOUSE_QUILL);
else
Mouse::get_instance()->setMouseCursor(Mouse::MOUSE_MAGGLASS);
@@ -185,7 +185,7 @@ void U8SaveGump::OnMouseClick(int button, int32 mx, int32 my) {
int x_;
if (mx >= 3 && mx <= 100)
x_ = 0;
- else if (mx >= dims.w / 2 + 10)
+ else if (mx >= _dims.w / 2 + 10)
x_ = 1;
else
return;
@@ -201,24 +201,24 @@ void U8SaveGump::OnMouseClick(int button, int32 mx, int32 my) {
return;
int i = 3 * x_ + y_;
- int index_ = 6 * page + i + 1;
+ int index_ = 6 * _page + i + 1;
- if (save && !focus_child && editwidgets[i]) {
- editwidgets[i]->MakeFocus();
- PagedGump *p = p_dynamic_cast<PagedGump *>(parent);
+ if (_save && !_focusChild && _editWidgets[i]) {
+ _editWidgets[i]->MakeFocus();
+ PagedGump *p = p_dynamic_cast<PagedGump *>(_parent);
if (p) p->enableButtons(false);
}
- if (!save) {
+ if (!_save) {
// If our parent has a notifiy process, we'll put our result in it and wont actually load the game
- GumpNotifyProcess *p = parent->GetNotifyProcess();
+ GumpNotifyProcess *p = _parent->GetNotifyProcess();
if (p) {
// Do nothing in this case
- if (index_ != 1 && descriptions[i].empty()) return;
+ if (index_ != 1 && _descriptions[i].empty()) return;
- parent->SetResult(index_);
- parent->Close(); // close PagedGump (and us)
+ _parent->SetResult(index_);
+ _parent->Close(); // close PagedGump (and us)
return;
}
@@ -228,8 +228,8 @@ void U8SaveGump::OnMouseClick(int button, int32 mx, int32 my) {
void U8SaveGump::ChildNotify(Gump *child, uint32 message) {
if (child->IsOfType<EditWidget>() && message == EditWidget::EDIT_ENTER) {
- // save
- assert(save);
+ // _save
+ assert(_save);
EditWidget *widget = p_dynamic_cast<EditWidget *>(child);
assert(widget);
@@ -237,26 +237,26 @@ void U8SaveGump::ChildNotify(Gump *child, uint32 message) {
Std::string name = widget->getText();
if (name.empty()) return;
- if (savegame(widget->GetIndex() + 6 * page, name))
- parent->Close(); // close PagedGump (and us)
+ if (savegame(widget->GetIndex() + 6 * _page, name))
+ _parent->Close(); // close PagedGump (and us)
return;
}
if (child->IsOfType<EditWidget>() && message == EditWidget::EDIT_ESCAPE) {
// cancel edit
- assert(save);
+ assert(_save);
// remove focus
- if (focus_child) focus_child->OnFocus(false);
- focus_child = 0;
+ if (_focusChild) _focusChild->OnFocus(false);
+ _focusChild = 0;
- PagedGump *p = p_dynamic_cast<PagedGump *>(parent);
+ PagedGump *p = p_dynamic_cast<PagedGump *>(_parent);
if (p) p->enableButtons(true);
EditWidget *widget = p_dynamic_cast<EditWidget *>(child);
assert(widget);
- widget->setText(descriptions[widget->GetIndex() - 1]);
+ widget->setText(_descriptions[widget->GetIndex() - 1]);
return;
}
@@ -288,10 +288,10 @@ bool U8SaveGump::savegame(int saveIndex, const Std::string &name) {
}
void U8SaveGump::loadDescriptions() {
- descriptions.resize( 6);
+ _descriptions.resize( 6);
for (int i = 0; i < 6; ++i) {
- int saveIndex = 6 * page + i + 1;
+ int saveIndex = 6 * _page + i + 1;
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(
Ultima8Engine::get_instance()->getSaveStateName(saveIndex));
@@ -300,26 +300,26 @@ void U8SaveGump::loadDescriptions() {
SavegameReader *sg = new SavegameReader(saveFile, true);
SavegameReader::State state = sg->isValid();
- descriptions[i] = "";
+ _descriptions[i] = "";
// FIXME: move version checks elsewhere!!
switch (state) {
case SavegameReader::SAVE_CORRUPT:
- descriptions[i] = _("[corrupt]");
+ _descriptions[i] = _("[corrupt]");
break;
case SavegameReader::SAVE_OUT_OF_DATE:
- descriptions[i] = _("[outdated]");
+ _descriptions[i] = _("[outdated]");
break;
case SavegameReader::SAVE_TOO_RECENT:
- descriptions[i] = _("[too modern]");
+ _descriptions[i] = _("[too modern]");
break;
default:
break;
}
if (state != SavegameReader::SAVE_VALID)
- descriptions[i] += " ";
- descriptions[i] += sg->getDescription();
+ _descriptions[i] += " ";
+ _descriptions[i] += sg->getDescription();
delete sg;
}
}
@@ -327,7 +327,7 @@ void U8SaveGump::loadDescriptions() {
//static
Gump *U8SaveGump::showLoadSaveGump(Gump *parent, bool save) {
if (save) {
- // can't save if game over
+ // can't _save if game over
// FIXME: this check should probably be in Game or GUIApp
MainActor *av = getMainActor();
if (!av || (av->getActorFlags() & Actor::ACT_DEAD)) return 0;
diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.h b/engines/ultima/ultima8/gumps/u8_save_gump.h
index 091db55..151f553 100644
--- a/engines/ultima/ultima8/gumps/u8_save_gump.h
+++ b/engines/ultima/ultima8/gumps/u8_save_gump.h
@@ -52,11 +52,11 @@ public:
static Gump *showLoadSaveGump(Gump *parent, bool save);
protected:
- bool save;
- int page;
+ bool _save;
+ int _page;
- Std::vector<EditWidget *> editwidgets;
- Std::vector<Std::string> descriptions;
+ Std::vector<EditWidget *> _editWidgets;
+ Std::vector<Std::string> _descriptions;
void loadDescriptions();
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
index e3c59d1..2e8f45b 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
@@ -59,8 +59,8 @@ ButtonWidget::ButtonWidget(int X, int Y, FrameID frame_up, FrameID frame_down,
: Gump(X, Y, 5, 5, 0, 0, layer_), textwidget(0), mouseOver(_mouseOver) {
shape_up = GameData::get_instance()->getShape(frame_up);
shape_down = GameData::get_instance()->getShape(frame_down);
- framenum_up = frame_up.framenum;
- framenum_down = frame_down.framenum;
+ _frameNum_up = frame_up._frameNum;
+ _frameNum_down = frame_down._frameNum;
}
@@ -74,19 +74,19 @@ void ButtonWidget::InitGump(Gump *newparent, bool take_focus) {
Gump *widget = getGump(textwidget);
assert(widget);
widget->InitGump(this);
- widget->GetDims(dims); // transfer child dimension to self
- widget->Move(0, dims.y); // move it to the correct height
+ widget->GetDims(_dims); // transfer child dimension to self
+ widget->Move(0, _dims.y); // move it to the correct height
} else {
assert(shape_up != 0);
assert(shape_down != 0);
- shape = shape_up;
- framenum = framenum_up;
+ _shape = shape_up;
+ _frameNum = _frameNum_up;
- ShapeFrame *sf = shape->getFrame(framenum);
+ ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
}
}
@@ -111,7 +111,7 @@ bool ButtonWidget::PointOnGump(int mx, int my) {
int32 gx = mx, gy = my;
ParentToGump(gx, gy);
- return dims.InRect(gx, gy);
+ return _dims.InRect(gx, gy);
}
Gump *ButtonWidget::OnMouseDown(int button, int32 mx, int32 my) {
@@ -120,8 +120,8 @@ Gump *ButtonWidget::OnMouseDown(int button, int32 mx, int32 my) {
if (button == Shared::BUTTON_LEFT) {
// CHECKME: change dimensions or not?
if (!mouseOver) {
- shape = shape_down;
- framenum = framenum_down;
+ _shape = shape_down;
+ _frameNum = _frameNum_down;
}
return this;
}
@@ -139,21 +139,21 @@ uint16 ButtonWidget::TraceObjId(int32 mx, int32 my) {
void ButtonWidget::OnMouseUp(int button, int32 mx, int32 my) {
if (button == Shared::BUTTON_LEFT) {
if (!mouseOver) {
- shape = shape_up;
- framenum = framenum_up;
+ _shape = shape_up;
+ _frameNum = _frameNum_up;
}
- parent->ChildNotify(this, BUTTON_UP);
+ _parent->ChildNotify(this, BUTTON_UP);
}
}
void ButtonWidget::OnMouseClick(int button, int32 mx, int32 my) {
int gx = mx, gy = my;
if (PointOnGump(gx, gy))
- parent->ChildNotify(this, BUTTON_CLICK);
+ _parent->ChildNotify(this, BUTTON_CLICK);
}
void ButtonWidget::OnMouseDouble(int button, int32 mx, int32 my) {
- parent->ChildNotify(this, BUTTON_DOUBLE);
+ _parent->ChildNotify(this, BUTTON_DOUBLE);
}
void ButtonWidget::OnMouseOver() {
@@ -164,8 +164,8 @@ void ButtonWidget::OnMouseOver() {
assert(txtWidget);
txtWidget->setBlendColour(mouseOverBlendCol);
} else {
- shape = shape_down;
- framenum = framenum_down;
+ _shape = shape_down;
+ _frameNum = _frameNum_down;
}
}
}
@@ -178,8 +178,8 @@ void ButtonWidget::OnMouseLeft() {
assert(txtWidget);
txtWidget->setBlendColour(0);
} else {
- shape = shape_up;
- framenum = framenum_up;
+ _shape = shape_up;
+ _frameNum = _frameNum_up;
}
}
}
@@ -188,18 +188,18 @@ void ButtonWidget::saveData(ODataSource *ods) {
// HACK ALERT
int w = 0, h = 0;
if (textwidget != 0) {
- w = dims.w;
- h = dims.h;
- dims.w = origw;
- dims.h = origh;
+ w = _dims.w;
+ h = _dims.h;
+ _dims.w = origw;
+ _dims.h = origh;
}
Gump::saveData(ods);
// HACK ALERT
if (textwidget != 0) {
- dims.w = w;
- dims.h = h;
+ _dims.w = w;
+ _dims.h = h;
}
uint16 flex = 0;
@@ -209,7 +209,7 @@ void ButtonWidget::saveData(ODataSource *ods) {
}
ods->write2(flex);
ods->write4(shapenum);
- ods->write4(framenum_up);
+ ods->write4(_frameNum_up);
flex = 0;
shapenum = 0;
@@ -218,7 +218,7 @@ void ButtonWidget::saveData(ODataSource *ods) {
}
ods->write2(flex);
ods->write4(shapenum);
- ods->write4(framenum_down);
+ ods->write4(_frameNum_down);
ods->write2(textwidget);
ods->write4(mouseOverBlendCol);
@@ -235,7 +235,7 @@ bool ButtonWidget::loadData(IDataSource *ids, uint32 version) {
if (flex) {
shape_up = flex->getShape(shapenum);
}
- framenum_up = ids->read4();
+ _frameNum_up = ids->read4();
shape_down = 0;
flex = GameData::get_instance()->getShapeFlex(ids->read2());
@@ -243,7 +243,7 @@ bool ButtonWidget::loadData(IDataSource *ids, uint32 version) {
if (flex) {
shape_down = flex->getShape(shapenum);
}
- framenum_down = ids->read4();
+ _frameNum_down = ids->read4();
textwidget = ids->read2();
mouseOverBlendCol = ids->read4();
mouseOver = (ids->read1() != 0);
@@ -251,8 +251,8 @@ bool ButtonWidget::loadData(IDataSource *ids, uint32 version) {
// HACK ALERT
if (textwidget != 0) {
Gump *widget = getGump(textwidget);
- widget->GetDims(dims); // transfer child dimension to self
- widget->Move(0, dims.y); // move it to the correct height
+ widget->GetDims(_dims); // transfer child dimension to self
+ widget->Move(0, _dims.y); // move it to the correct height
}
return true;
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.h b/engines/ultima/ultima8/gumps/widgets/button_widget.h
index 4daf73b..a518b19 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.h
@@ -58,8 +58,8 @@ public:
//! return the textwidget's vlead, or 0 for an image button
int getVlead();
- //void SetShapeDown(Shape *_shape, uint32 _framenum);
- //void SetShapeUp(Shape *_shape, uint32 _framenum);
+ //void SetShapeDown(Shape *_shape, uint32 frameNum);
+ //void SetShapeUp(Shape *_shape, uint32 frameNum);
enum Message {
BUTTON_CLICK = 0,
@@ -69,9 +69,9 @@ public:
protected:
Shape *shape_up;
- uint32 framenum_up;
+ uint32 _frameNum_up;
Shape *shape_down;
- uint32 framenum_down;
+ uint32 _frameNum_down;
uint16 textwidget;
uint32 mouseOverBlendCol;
bool mouseOver;
diff --git a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
index 665ae18..de3e7cb 100644
--- a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
@@ -58,14 +58,14 @@ void EditWidget::InitGump(Gump *newparent, bool take_focus) {
Font *font = getFont();
// Y offset is always baseline
- dims.y = -font->getBaseline();
+ _dims.y = -font->getBaseline();
// No X offset
- dims.x = 0;
+ _dims.x = 0;
if (gamefont && getFont()->isHighRes()) {
int32 x_ = 0, y_ = 0, w = 0;
- ScreenSpaceToGumpRect(x_, y_, w, dims.y, ROUND_OUTSIDE);
+ ScreenSpaceToGumpRect(x_, y_, w, _dims.y, ROUND_OUTSIDE);
}
}
@@ -93,8 +93,8 @@ bool EditWidget::textFits(Std::string &t) {
unsigned int remaining;
int32 width, height;
- int32 max_width = multiline ? dims.w : 0;
- int32 max_height = dims.h;
+ int32 max_width = multiline ? _dims.w : 0;
+ int32 max_height = _dims.h;
if (gamefont && font->isHighRes()) {
int32 x_ = 0, y_ = 0;
GumpRectToScreenSpace(x_, y_, max_width, max_height, ROUND_INSIDE);
@@ -112,7 +112,7 @@ bool EditWidget::textFits(Std::string &t) {
if (multiline)
return (remaining >= t.size());
else
- return (width <= dims.w);
+ return (width <= _dims.w);
}
void EditWidget::renderText() {
@@ -135,8 +135,8 @@ void EditWidget::renderText() {
if (!cached_text) {
Font *font = getFont();
- int32 max_width = multiline ? dims.w : 0;
- int32 max_height = dims.h;
+ int32 max_width = multiline ? _dims.w : 0;
+ int32 max_height = _dims.h;
if (gamefont && font->isHighRes()) {
int32 x_ = 0, y_ = 0;
GumpRectToScreenSpace(x_, y_, max_width, max_height, ROUND_INSIDE);
@@ -157,7 +157,7 @@ void EditWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
renderText();
if (scaled && gamefont && getFont()->isHighRes()) {
- surf->FillAlpha(0xFF, dims.x, dims.y, dims.w, dims.h);
+ surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.w, _dims.h);
return;
}
@@ -175,9 +175,9 @@ void EditWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 s
cached_text->draw(surf, x_, y_, true);
- x_ = dims.x;
- y_ = dims.y;
- int32 w = dims.w, h = dims.h;
+ x_ = _dims.x;
+ y_ = _dims.y;
+ int32 w = _dims.w, h = _dims.h;
GumpRectToScreenSpace(x_, y_, w, h, ROUND_OUTSIDE);
surf->FillAlpha(0x00, x_, y_, w, h);
}
@@ -191,10 +191,10 @@ bool EditWidget::OnKeyDown(int key, int mod) {
switch (key) {
case Common::KEYCODE_RETURN:
case Common::KEYCODE_KP_ENTER:
- parent->ChildNotify(this, EDIT_ENTER);
+ _parent->ChildNotify(this, EDIT_ENTER);
break;
case Common::KEYCODE_ESCAPE:
- parent->ChildNotify(this, EDIT_ESCAPE);
+ _parent->ChildNotify(this, EDIT_ESCAPE);
break;
case Common::KEYCODE_BACKSPACE:
if (cursor > 0) {
diff --git a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp b/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
index 75937e7..d72c2bc 100644
--- a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
@@ -95,8 +95,8 @@ void GameWidget::ChildNotify(Gump *child, uint32 message) {
message == ButtonWidget::BUTTON_CLICK) {
int32 index_ = child->GetIndex();
- if (parent)
- parent->ChildNotify(this, static_cast<uint32>(index_));
+ if (_parent)
+ _parent->ChildNotify(this, static_cast<uint32>(index_));
}
}
diff --git a/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp b/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
index 9f74ba5..d9fe0e4 100644
--- a/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
@@ -37,10 +37,10 @@ SlidingWidget::SlidingWidget()
: Gump() {
}
-SlidingWidget::SlidingWidget(int x_, int y_, Shape *shape_, uint32 framenum_)
- : Gump(x_, y_, 5, 5, 0, FLAG_DRAGGABLE) {
- shape = shape_;
- framenum = framenum_;
+SlidingWidget::SlidingWidget(int x, int y, Shape *shape, uint32 frameNum)
+ : Gump(x, y, 5, 5, 0, FLAG_DRAGGABLE) {
+ _shape = shape;
+ _frameNum = frameNum;
}
SlidingWidget::~SlidingWidget() {
@@ -49,11 +49,11 @@ SlidingWidget::~SlidingWidget() {
void SlidingWidget::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
- ShapeFrame *sf = shape->getFrame(framenum);
+ ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
- dims.w = sf->width;
- dims.h = sf->height;
+ _dims.w = sf->width;
+ _dims.h = sf->height;
}
uint16 SlidingWidget::TraceObjId(int32 mx, int32 my) {
diff --git a/engines/ultima/ultima8/gumps/widgets/sliding_widget.h b/engines/ultima/ultima8/gumps/widgets/sliding_widget.h
index 305e123..0e9ea2e 100644
--- a/engines/ultima/ultima8/gumps/widgets/sliding_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/sliding_widget.h
@@ -34,7 +34,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
SlidingWidget();
- SlidingWidget(int x, int y, Shape *shape, uint32 framenum);
+ SlidingWidget(int x, int y, Shape *shape, uint32 frameNum);
~SlidingWidget() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
index a65d09e..9451940 100644
--- a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
@@ -62,28 +62,28 @@ void TextWidget::InitGump(Gump *newparent, bool take_focus) {
Font *font = getFont();
// Y offset is always baseline
- dims.y = -font->getBaseline();
+ _dims.y = -font->getBaseline();
// No X offset
- dims.x = 0;
+ _dims.x = 0;
if (gamefont && getFont()->isHighRes()) {
int32 w = 0;
int32 x_ = 0, y_ = 0;
- ScreenSpaceToGumpRect(x_, y_, w, dims.y, ROUND_OUTSIDE);
+ ScreenSpaceToGumpRect(x_, y_, w, _dims.y, ROUND_OUTSIDE);
- int32 tx_ = dims.x;
- int32 ty_ = dims.y;
+ int32 tx_ = _dims.x;
+ int32 ty_ = _dims.y;
// Note that GumpRectToScreenSpace is guaranteed to keep
// targetwidth/targetheight zero if they already were.
GumpRectToScreenSpace(tx_, ty_, targetwidth, targetheight, ROUND_OUTSIDE);
- dims.w = targetwidth;
- dims.h = targetheight;
+ _dims.w = targetwidth;
+ _dims.h = targetheight;
x_ = 0;
y_ = 0;
- ScreenSpaceToGumpRect(x_, y_, dims.w, dims.h, ROUND_OUTSIDE);
+ ScreenSpaceToGumpRect(x_, y_, _dims.w, _dims.h, ROUND_OUTSIDE);
}
setupNextText();
@@ -122,10 +122,10 @@ bool TextWidget::setupNextText() {
targetwidth, targetheight, textalign, true);
- dims.w = tx;
- dims.h = ty;
- dims.y = -font->getBaseline();
- dims.x = 0;
+ _dims.w = tx;
+ _dims.h = ty;
+ _dims.y = -font->getBaseline();
+ _dims.x = 0;
current_end = current_start + remaining;
delete cached_text;
@@ -135,12 +135,12 @@ bool TextWidget::setupNextText() {
Font *fontP = getFont();
if (fontP->isHighRes()) {
int32 x_ = 0, y_ = 0;
- ScreenSpaceToGumpRect(x_, y_, dims.w, dims.h, ROUND_OUTSIDE);
+ ScreenSpaceToGumpRect(x_, y_, _dims.w, _dims.h, ROUND_OUTSIDE);
int32 w = 0;
x_ = 0;
y_ = 0;
- ScreenSpaceToGumpRect(x_, y_, w, dims.y, ROUND_OUTSIDE);
+ ScreenSpaceToGumpRect(x_, y_, w, _dims.y, ROUND_OUTSIDE);
}
}
@@ -172,7 +172,7 @@ void TextWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
renderText();
if (scaled && gamefont && getFont()->isHighRes()) {
- surf->FillAlpha(0xFF, dims.x, dims.y, dims.w, dims.h);
+ surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.w, _dims.h);
return;
}
@@ -196,13 +196,13 @@ void TextWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 s
else
cached_text->drawBlended(surf, x_, y_, blendColour, true);
- if (parent->IsOfType<BarkGump>()) return;
+ if (_parent->IsOfType<BarkGump>()) return;
- if (parent->IsOfType<ButtonWidget>() && parent->GetParent()->IsOfType<AskGump>()) return;
+ if (_parent->IsOfType<ButtonWidget>() && _parent->GetParent()->IsOfType<AskGump>()) return;
- x_ = dims.x;
- y_ = dims.y;
- int32 w = dims.w, h = dims.h;
+ x_ = _dims.x;
+ y_ = _dims.y;
+ int32 w = _dims.w, h = _dims.h;
GumpRectToScreenSpace(x_, y_, w, h, ROUND_OUTSIDE);
surf->FillAlpha(0x00, x_, y_, w, h);
}
@@ -261,9 +261,9 @@ bool TextWidget::loadData(IDataSource *ids, uint32 version) {
targetwidth, targetheight, textalign, true);
// Y offset is always baseline
- dims.y = -font->getBaseline();
- dims.w = tx_;
- dims.h = ty_;
+ _dims.y = -font->getBaseline();
+ _dims.w = tx_;
+ _dims.h = ty_;
current_end = current_start + remaining;
return true;
Commit: 4f0cda070f4155afdf0c94018e7d44455130df3f
https://github.com/scummvm/scummvm/commit/4f0cda070f4155afdf0c94018e7d44455130df3f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-15T21:39:28-08:00
Commit Message:
ULTIMA8: More field renaming of gump classes
Changed paths:
engines/ultima/ultima8/gumps/bark_gump.cpp
engines/ultima/ultima8/gumps/bark_gump.h
engines/ultima/ultima8/gumps/bind_gump.h
engines/ultima/ultima8/gumps/console_gump.cpp
engines/ultima/ultima8/gumps/console_gump.h
engines/ultima/ultima8/gumps/container_gump.cpp
engines/ultima/ultima8/gumps/container_gump.h
engines/ultima/ultima8/gumps/controls_gump.cpp
engines/ultima/ultima8/gumps/controls_gump.h
engines/ultima/ultima8/gumps/credits_gump.h
engines/ultima/ultima8/gumps/desktop_gump.cpp
engines/ultima/ultima8/gumps/desktop_gump.h
engines/ultima/ultima8/gumps/fast_area_vis_gump.h
engines/ultima/ultima8/gumps/game_map_gump.cpp
engines/ultima/ultima8/gumps/game_map_gump.h
engines/ultima/ultima8/gumps/gump.cpp
engines/ultima/ultima8/gumps/gump.h
engines/ultima/ultima8/gumps/gump_notify_process.cpp
engines/ultima/ultima8/gumps/gump_notify_process.h
engines/ultima/ultima8/gumps/inverter_gump.cpp
engines/ultima/ultima8/gumps/inverter_gump.h
engines/ultima/ultima8/gumps/item_relative_gump.cpp
engines/ultima/ultima8/gumps/item_relative_gump.h
engines/ultima/ultima8/gumps/main_menu_process.cpp
engines/ultima/ultima8/gumps/main_menu_process.h
engines/ultima/ultima8/gumps/menu_gump.h
engines/ultima/ultima8/gumps/message_box_gump.cpp
engines/ultima/ultima8/gumps/message_box_gump.h
engines/ultima/ultima8/gumps/mini_stats_gump.h
engines/ultima/ultima8/gumps/minimap_gump.cpp
engines/ultima/ultima8/gumps/minimap_gump.h
engines/ultima/ultima8/gumps/movie_gump.cpp
engines/ultima/ultima8/gumps/movie_gump.h
engines/ultima/ultima8/gumps/options_gump.h
engines/ultima/ultima8/gumps/paged_gump.cpp
engines/ultima/ultima8/gumps/paged_gump.h
engines/ultima/ultima8/gumps/paperdoll_gump.cpp
engines/ultima/ultima8/gumps/paperdoll_gump.h
engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
engines/ultima/ultima8/gumps/pentagram_menu_gump.h
engines/ultima/ultima8/gumps/quit_gump.cpp
engines/ultima/ultima8/gumps/quit_gump.h
engines/ultima/ultima8/gumps/readable_gump.cpp
engines/ultima/ultima8/gumps/readable_gump.h
engines/ultima/ultima8/gumps/resizable_gump.cpp
engines/ultima/ultima8/gumps/scaler_gump.h
engines/ultima/ultima8/gumps/scroll_gump.cpp
engines/ultima/ultima8/gumps/scroll_gump.h
engines/ultima/ultima8/gumps/shape_viewer_gump.h
engines/ultima/ultima8/gumps/slider_gump.cpp
engines/ultima/ultima8/gumps/slider_gump.h
engines/ultima/ultima8/gumps/target_gump.cpp
engines/ultima/ultima8/gumps/target_gump.h
engines/ultima/ultima8/gumps/widgets/button_widget.cpp
engines/ultima/ultima8/gumps/widgets/button_widget.h
engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
engines/ultima/ultima8/gumps/widgets/edit_widget.h
engines/ultima/ultima8/gumps/widgets/game_widget.cpp
engines/ultima/ultima8/gumps/widgets/game_widget.h
engines/ultima/ultima8/gumps/widgets/text_widget.cpp
engines/ultima/ultima8/gumps/widgets/text_widget.h
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index ab8df3d..6ba91cd 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -27,7 +27,6 @@
#include "ultima/ultima8/audio/audio_process.h"
#include "ultima/ultima8/world/get_object.h"
#include "ultima/ultima8/conf/setting_manager.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -38,16 +37,13 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(BarkGump, ItemRelativeGump)
// TODO: Remove all the hacks
-BarkGump::BarkGump()
- : ItemRelativeGump() {
-
+BarkGump::BarkGump() : ItemRelativeGump() {
}
-BarkGump::BarkGump(uint16 owner_, Std::string msg, uint32 speechshapenum_) :
- ItemRelativeGump(0, 0, 100, 100, owner_,
- FLAG_KEEP_VISIBLE, LAYER_ABOVE_NORMAL),
- barked(msg), counter(100), speechshapenum(speechshapenum_),
- speechlength(0), totaltextheight(0) {
+BarkGump::BarkGump(uint16 owner, const Std::string &msg, uint32 speechShapeNum) :
+ ItemRelativeGump(0, 0, 100, 100, owner, FLAG_KEEP_VISIBLE, LAYER_ABOVE_NORMAL),
+ _barked(msg), _counter(100), _speechShapeNum(speechShapeNum),
+ _speechLength(0), _totalTextHeight(0), _textWidget(0) {
SettingManager::get_instance()->get("textdelay", textdelay);
}
@@ -77,27 +73,27 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
ItemRelativeGump::InitGump(newparent, take_focus);
// Create the TextWidget
- TextWidget *widget = new TextWidget(0, 0, barked, true, fontnum, 194, 55);
+ TextWidget *widget = new TextWidget(0, 0, _barked, true, fontnum, 194, 55);
widget->InitGump(this);
- textwidget = widget->getObjId();
+ _textWidget = widget->getObjId();
// see if we need to play speech
AudioProcess *ap = AudioProcess::get_instance();
- speechlength = 0;
- if (speechshapenum && ap) {
- if (ap->playSpeech(barked, speechshapenum, _owner)) {
- speechlength = ap->getSpeechLength(barked, speechshapenum) / 33;
- if (speechlength == 0) speechlength = 1;
+ _speechLength = 0;
+ if (_speechShapeNum && ap) {
+ if (ap->playSpeech(_barked, _speechShapeNum, _owner)) {
+ _speechLength = ap->getSpeechLength(_barked, _speechShapeNum) / 33;
+ if (_speechLength == 0) _speechLength = 1;
// We're playing speech, so need to sync the text with the speech.
// First we count the total height of all text blocks.
Rect d;
widget->GetDims(d);
- totaltextheight = d.h;
+ _totalTextHeight = d.h;
while (widget->setupNextText()) {
widget->GetDims(d);
- totaltextheight += d.h;
+ _totalTextHeight += d.h;
}
widget->rewind();
}
@@ -106,10 +102,10 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
// This is just a hack
Rect d;
widget->GetDims(d);
- if (speechlength && totaltextheight) {
- counter = (d.h * speechlength) / totaltextheight;
+ if (_speechLength && _totalTextHeight) {
+ _counter = (d.h * _speechLength) / _totalTextHeight;
} else {
- counter = d.h * textdelay;
+ _counter = d.h * textdelay;
}
_dims.h = d.h;
_dims.w = d.w;
@@ -119,16 +115,16 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
}
bool BarkGump::NextText() {
- TextWidget *widget = p_dynamic_cast<TextWidget *>(getGump(textwidget));
+ TextWidget *widget = p_dynamic_cast<TextWidget *>(getGump(_textWidget));
assert(widget);
if (widget->setupNextText()) {
// This is just a hack
Rect d;
widget->GetDims(d);
- if (speechlength && totaltextheight) {
- counter = (d.h * speechlength) / totaltextheight;
+ if (_speechLength && _totalTextHeight) {
+ _counter = (d.h * _speechLength) / _totalTextHeight;
} else {
- counter = d.h * textdelay;
+ _counter = d.h * textdelay;
}
_dims.h = d.h;
_dims.w = d.w;
@@ -143,24 +139,24 @@ void BarkGump::run() {
// Auto close
if (!Kernel::get_instance()->isPaused()) {
- if (!--counter) {
+ if (!--_counter) {
// try next text
bool done = !NextText();
if (done) {
bool speechplaying = false;
- if (speechlength) {
+ if (_speechLength) {
// waiting for speech to finish?
AudioProcess *ap = AudioProcess::get_instance();
if (ap)
- speechplaying = ap->isSpeechPlaying(barked,
- speechshapenum);
+ speechplaying = ap->isSpeechPlaying(_barked,
+ _speechShapeNum);
}
// if speech done too, close
if (!speechplaying)
Close();
else
- counter = textdelay;
+ _counter = textdelay;
}
}
}
@@ -172,9 +168,9 @@ Gump *BarkGump::OnMouseDown(int button, int32 mx, int32 my) {
// Scroll to next text, if possible
if (!NextText()) {
- if (speechlength) {
+ if (_speechLength) {
AudioProcess *ap = AudioProcess::get_instance();
- if (ap) ap->stopSpeech(barked, speechshapenum, _owner);
+ if (ap) ap->stopSpeech(_barked, _speechShapeNum, _owner);
}
Close();
}
@@ -184,44 +180,44 @@ Gump *BarkGump::OnMouseDown(int button, int32 mx, int32 my) {
void BarkGump::saveData(ODataSource *ods) {
ItemRelativeGump::saveData(ods);
- ods->write4(static_cast<uint32>(counter));
- ods->write2(textwidget);
- ods->write4(speechshapenum);
- ods->write4(speechlength);
- ods->write4(totaltextheight);
- ods->write4(static_cast<uint32>(barked.size()));
- ods->write(barked.c_str(), barked.size());
+ ods->write4(static_cast<uint32>(_counter));
+ ods->write2(_textWidget);
+ ods->write4(_speechShapeNum);
+ ods->write4(_speechLength);
+ ods->write4(_totalTextHeight);
+ ods->write4(static_cast<uint32>(_barked.size()));
+ ods->write(_barked.c_str(), _barked.size());
}
bool BarkGump::loadData(IDataSource *ids, uint32 version) {
if (!ItemRelativeGump::loadData(ids, version)) return false;
- counter = static_cast<int32>(ids->read4());
- textwidget = ids->read2();
- speechshapenum = ids->read4();
- speechlength = ids->read4();
- totaltextheight = ids->read4();
+ _counter = static_cast<int32>(ids->read4());
+ _textWidget = ids->read2();
+ _speechShapeNum = ids->read4();
+ _speechLength = ids->read4();
+ _totalTextHeight = ids->read4();
uint32 slen = ids->read4();
if (slen > 0) {
char *buf = new char[slen + 1];
ids->read(buf, slen);
buf[slen] = 0;
- barked = buf;
+ _barked = buf;
delete[] buf;
} else {
- barked = "";
+ _barked = "";
}
- TextWidget *widget = p_dynamic_cast<TextWidget *>(getGump(textwidget));
+ TextWidget *widget = p_dynamic_cast<TextWidget *>(getGump(_textWidget));
SettingManager::get_instance()->get("textdelay", textdelay);
// This is just a hack
Rect d;
widget->GetDims(d);
- counter = d.h * textdelay;
+ _counter = d.h * textdelay;
_dims.h = d.h;
_dims.w = d.w;
diff --git a/engines/ultima/ultima8/gumps/bark_gump.h b/engines/ultima/ultima8/gumps/bark_gump.h
index 57cb81b..ff418d4 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.h
+++ b/engines/ultima/ultima8/gumps/bark_gump.h
@@ -31,19 +31,19 @@ namespace Ultima8 {
class BarkGump : public ItemRelativeGump {
protected:
- Std::string barked;
- int32 counter;
- ObjId textwidget;
- uint32 speechshapenum;
- uint32 speechlength;
- uint32 totaltextheight;
+ Std::string _barked;
+ int32 _counter;
+ ObjId _textWidget;
+ uint32 _speechShapeNum;
+ uint32 _speechLength;
+ uint32 _totalTextHeight;
public:
ENABLE_RUNTIME_CLASSTYPE()
BarkGump();
- BarkGump(uint16 owner_, Std::string msg, uint32 speechshapenum = 0);
- ~BarkGump(void) override;
+ BarkGump(uint16 owner, const Std::string &msg, uint32 speechShapeNum = 0);
+ ~BarkGump() override;
// Run the gump (decrement the counter)
void run() override;
diff --git a/engines/ultima/ultima8/gumps/bind_gump.h b/engines/ultima/ultima8/gumps/bind_gump.h
index cd51504..f9aa63c 100644
--- a/engines/ultima/ultima8/gumps/bind_gump.h
+++ b/engines/ultima/ultima8/gumps/bind_gump.h
@@ -36,7 +36,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
BindGump(istring *b, Gump *g);
- ~BindGump(void) override;
+ ~BindGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/console_gump.cpp b/engines/ultima/ultima8/gumps/console_gump.cpp
index 3d9f9a1..43757c5 100644
--- a/engines/ultima/ultima8/gumps/console_gump.cpp
+++ b/engines/ultima/ultima8/gumps/console_gump.cpp
@@ -26,7 +26,6 @@
#include "ultima/ultima8/graphics/render_surface.h"
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
-
#include "ultima/ultima8/ultima8.h"
namespace Ultima {
@@ -34,22 +33,19 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(ConsoleGump, Gump)
-ConsoleGump::ConsoleGump()
- : Gump() {
- con->AddConsoleCommand("ConsoleGump::toggle",
- ConsoleGump::ConCmd_toggle);
+ConsoleGump::ConsoleGump() : Gump() {
+ con->AddConsoleCommand("ConsoleGump::toggle", ConsoleGump::ConCmd_toggle);
}
-ConsoleGump::ConsoleGump(int X, int Y, int Width, int Height) :
- Gump(X, Y, Width, Height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP, LAYER_CONSOLE),
- scroll_state(NORMAL_DISPLAY), scroll_frame(8) {
+ConsoleGump::ConsoleGump(int x, int y, int width, int height) :
+ Gump(x, y, width, height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP, LAYER_CONSOLE),
+ _scrollState(NORMAL_DISPLAY), _scrollFrame(8) {
con->ClearCommandBuffer();
// Resize it
- con->CheckResize(Width);
+ con->CheckResize(width);
- con->AddConsoleCommand("ConsoleGump::toggle",
- ConsoleGump::ConCmd_toggle);
+ con->AddConsoleCommand("ConsoleGump::toggle", ConsoleGump::ConCmd_toggle);
}
ConsoleGump::~ConsoleGump() {
@@ -69,10 +65,10 @@ void ConsoleGump::RenderSurfaceChanged() {
void ConsoleGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
int h = _dims.h;
- uint32 next_frame = scroll_frame + 1;
+ uint32 next_frame = _scrollFrame + 1;
Gump::PaintThis(surf, lerp_factor, scaled);
- switch (scroll_state) {
+ switch (_scrollState) {
case NOTIFY_OVERLAY:
#ifdef DEBUG
con->DrawConsoleNotify(surf);
@@ -82,10 +78,10 @@ void ConsoleGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
return;
case SCROLLING_TO_HIDE:
- if (scroll_frame == 0)
+ if (_scrollFrame == 0)
return;
// Just reverse next_frame and fall through
- next_frame = scroll_frame - 1;
+ next_frame = _scrollFrame - 1;
case SCROLLING_TO_SHOW:
if (next_frame > 8)
break;
@@ -94,9 +90,9 @@ void ConsoleGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
if (lerp_factor == 256)
h = (h * next_frame) >> 3;
else if (lerp_factor == 0)
- h = (h * scroll_frame) >> 3;
+ h = (h * _scrollFrame) >> 3;
else
- h = (h * ((scroll_frame * (256 - lerp_factor))
+ h = (h * ((_scrollFrame * (256 - lerp_factor))
+ (next_frame * lerp_factor))) >> 11;
if (h > _dims.h)
@@ -115,23 +111,23 @@ void ConsoleGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
}
void ConsoleGump::ToggleConsole() {
- switch (scroll_state) {
+ switch (_scrollState) {
case WAITING_TO_HIDE:
case SCROLLING_TO_HIDE:
- scroll_state = SCROLLING_TO_SHOW;
+ _scrollState = SCROLLING_TO_SHOW;
break;
case NOTIFY_OVERLAY:
- scroll_state = WAITING_TO_SHOW;
+ _scrollState = WAITING_TO_SHOW;
break;
case WAITING_TO_SHOW:
case SCROLLING_TO_SHOW:
- scroll_state = SCROLLING_TO_HIDE;
+ _scrollState = SCROLLING_TO_HIDE;
break;
case NORMAL_DISPLAY:
- scroll_state = WAITING_TO_HIDE;
+ _scrollState = WAITING_TO_HIDE;
Ultima8Engine::get_instance()->leaveTextMode(this);
con->ClearCommandBuffer();
break;
@@ -143,14 +139,14 @@ void ConsoleGump::ToggleConsole() {
void ConsoleGump::HideConsole() {
- switch (scroll_state) {
+ switch (_scrollState) {
case WAITING_TO_SHOW:
case SCROLLING_TO_SHOW:
- scroll_state = SCROLLING_TO_HIDE;
+ _scrollState = SCROLLING_TO_HIDE;
break;
case NORMAL_DISPLAY:
- scroll_state = WAITING_TO_HIDE;
+ _scrollState = WAITING_TO_HIDE;
Ultima8Engine::get_instance()->leaveTextMode(this);
con->ClearCommandBuffer();
break;
@@ -162,14 +158,14 @@ void ConsoleGump::HideConsole() {
void ConsoleGump::ShowConsole() {
- switch (scroll_state) {
+ switch (_scrollState) {
case WAITING_TO_HIDE:
case SCROLLING_TO_HIDE:
- scroll_state = SCROLLING_TO_SHOW;
+ _scrollState = SCROLLING_TO_SHOW;
break;
case NOTIFY_OVERLAY:
- scroll_state = WAITING_TO_SHOW;
+ _scrollState = WAITING_TO_SHOW;
break;
default:
@@ -178,7 +174,7 @@ void ConsoleGump::ShowConsole() {
}
bool ConsoleGump::ConsoleIsVisible() {
- return scroll_state != NOTIFY_OVERLAY;
+ return _scrollState != NOTIFY_OVERLAY;
}
void ConsoleGump::run() {
@@ -186,31 +182,31 @@ void ConsoleGump::run() {
con->setFrameNum(Kernel::get_instance()->getFrameNum());
- switch (scroll_state) {
+ switch (_scrollState) {
case WAITING_TO_HIDE:
- scroll_state = SCROLLING_TO_HIDE;
+ _scrollState = SCROLLING_TO_HIDE;
break;
case SCROLLING_TO_HIDE:
- if (scroll_frame > 0) {
- --scroll_frame;
+ if (_scrollFrame > 0) {
+ --_scrollFrame;
break;
}
- scroll_frame = 0;
- scroll_state = NOTIFY_OVERLAY;
+ _scrollFrame = 0;
+ _scrollState = NOTIFY_OVERLAY;
break;
case WAITING_TO_SHOW:
- scroll_state = SCROLLING_TO_SHOW;
+ _scrollState = SCROLLING_TO_SHOW;
break;
case SCROLLING_TO_SHOW:
- if (scroll_frame < 8) {
- ++scroll_frame;
+ if (_scrollFrame < 8) {
+ ++_scrollFrame;
break;
}
- scroll_frame = 8;
- scroll_state = NORMAL_DISPLAY;
+ _scrollFrame = 8;
+ _scrollState = NORMAL_DISPLAY;
Ultima8Engine::get_instance()->enterTextMode(this);
con->ClearCommandBuffer();
break;
@@ -237,7 +233,7 @@ bool ConsoleGump::loadData(IDataSource *ids, uint32 version) {
bool ConsoleGump::OnTextInput(int unicode) {
bool handled = false;
- if (scroll_state == NORMAL_DISPLAY) {
+ if (_scrollState == NORMAL_DISPLAY) {
con->AddCharacterToCommandBuffer(unicode);
handled = true;
@@ -248,7 +244,7 @@ bool ConsoleGump::OnTextInput(int unicode) {
bool ConsoleGump::OnKeyDown(int key, int mod) {
bool handled = false;
- if (scroll_state == NORMAL_DISPLAY) {
+ if (_scrollState == NORMAL_DISPLAY) {
switch (key) {
// Command completion
case Common::KEYCODE_TAB:
@@ -323,7 +319,7 @@ bool ConsoleGump::OnKeyDown(int key, int mod) {
void ConsoleGump::OnFocus(bool gain) {
/*
- if (scroll_state == NORMAL_DISPLAY) {
+ if (_scrollState == NORMAL_DISPLAY) {
if (gain)
Ultima8Engine::get_instance()->enterTextMode(this);
else
diff --git a/engines/ultima/ultima8/gumps/console_gump.h b/engines/ultima/ultima8/gumps/console_gump.h
index d994b4e..9495b4c 100644
--- a/engines/ultima/ultima8/gumps/console_gump.h
+++ b/engines/ultima/ultima8/gumps/console_gump.h
@@ -39,8 +39,8 @@ class ConsoleGump : public Gump {
SCROLLING_TO_SHOW
};
- ConsoleScrollState scroll_state;
- uint32 scroll_frame;
+ ConsoleScrollState _scrollState;
+ uint32 _scrollFrame;
public:
ENABLE_RUNTIME_CLASSTYPE()
diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index 82fc029..fc5ab86 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -50,14 +50,14 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(ContainerGump, ItemRelativeGump)
ContainerGump::ContainerGump()
- : ItemRelativeGump(), display_dragging(false) {
+ : ItemRelativeGump(), _displayDragging(false) {
}
ContainerGump::ContainerGump(Shape *shape, uint32 frameNum, uint16 owner,
uint32 flags, int32 layer)
: ItemRelativeGump(0, 0, 5, 5, owner, flags, layer),
- display_dragging(false) {
+ _displayDragging(false) {
_shape = shape;
_frameNum = frameNum;
}
@@ -99,14 +99,14 @@ void ContainerGump::getItemCoords(Item *item, int32 &itemx, int32 &itemy) {
// randomize position
// TODO: maybe try to put it somewhere where it doesn't overlap others?
- itemx = getRandom() % itemarea.w;
- itemy = getRandom() % itemarea.h;
+ itemx = getRandom() % _itemArea.w;
+ itemy = getRandom() % _itemArea.h;
item->setGumpLocation(itemx, itemy);
}
- itemx += itemarea.x;
- itemy += itemarea.y;
+ itemx += _itemArea.x;
+ itemy += _itemArea.y;
}
@@ -144,14 +144,14 @@ void ContainerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
}
- if (display_dragging) {
+ if (_displayDragging) {
int32 itemx, itemy;
- itemx = dragging_x + itemarea.x;
- itemy = dragging_y + itemarea.y;
+ itemx = dragging_x + _itemArea.x;
+ itemy = dragging_y + _itemArea.y;
Shape *s = GameData::get_instance()->getMainShapes()->
- getShape(dragging_shape);
+ getShape(_draggingShape);
assert(s);
- surf->PaintInvisible(s, dragging_frame, itemx, itemy, false, (dragging_flags & Item::FLG_FLIPPED) != 0);
+ surf->PaintInvisible(s, _draggingFrame, itemx, itemy, false, (_draggingFlags & Item::FLG_FLIPPED) != 0);
}
}
@@ -251,8 +251,8 @@ void ContainerGump::GetItemLocation(int32 lerp_factor) {
if (_parent) _parent->ScreenSpaceToGump(gx, gy);
// Set x and y, and center us over it
- ix = gx - _dims.w / 2;
- iy = gy - _dims.h;
+ _ix = gx - _dims.w / 2;
+ _iy = gy - _dims.h;
}
void ContainerGump::Close(bool no_del) {
@@ -389,41 +389,41 @@ bool ContainerGump::DraggingItem(Item *item, int mx, int my) {
// check if the container the item is in is in range
MainActor *avatar = getMainActor();
if (!avatar->canReach(c, 128)) {
- display_dragging = false;
+ _displayDragging = false;
return false;
}
int32 dox, doy;
Mouse::get_instance()->getDraggingOffset(dox, doy);
Mouse::get_instance()->setMouseCursor(Mouse::MOUSE_TARGET);
- display_dragging = true;
+ _displayDragging = true;
- dragging_shape = item->getShape();
- dragging_frame = item->getFrame();
- dragging_flags = item->getFlags();
+ _draggingShape = item->getShape();
+ _draggingFrame = item->getFrame();
+ _draggingFlags = item->getFlags();
// determine target location and set dragging_x/y
- dragging_x = mx - itemarea.x - dox;
- dragging_y = my - itemarea.y - doy;
+ dragging_x = mx - _itemArea.x - dox;
+ dragging_y = my - _itemArea.y - doy;
Shape *sh = item->getShapeObject();
assert(sh);
- ShapeFrame *fr = sh->getFrame(dragging_frame);
+ ShapeFrame *fr = sh->getFrame(_draggingFrame);
assert(fr);
if (dragging_x - fr->xoff < 0 ||
- dragging_x - fr->xoff + fr->width > itemarea.w ||
+ dragging_x - fr->xoff + fr->width > _itemArea.w ||
dragging_y - fr->yoff < 0 ||
- dragging_y - fr->yoff + fr->height > itemarea.h) {
- display_dragging = false;
+ dragging_y - fr->yoff + fr->height > _itemArea.h) {
+ _displayDragging = false;
return false;
}
// check if item will fit (weight/volume/adding container to itself)
Container *target = getTargetContainer(item, mx, my);
if (!target || !target->CanAddItem(item, true)) {
- display_dragging = false;
+ _displayDragging = false;
return false;
}
@@ -431,7 +431,7 @@ bool ContainerGump::DraggingItem(Item *item, int mx, int my) {
}
void ContainerGump::DraggingItemLeftGump(Item *item) {
- display_dragging = false;
+ _displayDragging = false;
}
@@ -440,7 +440,7 @@ void ContainerGump::StopDraggingItem(Item *item, bool moved) {
}
void ContainerGump::DropItem(Item *item, int mx, int my) {
- display_dragging = false;
+ _displayDragging = false;
int32 px = mx, py = my;
GumpToParent(px, py);
@@ -533,8 +533,8 @@ void ContainerGump::DropItem(Item *item, int mx, int my) {
int32 dox, doy;
Mouse::get_instance()->getDraggingOffset(dox, doy);
- dragging_x = mx - itemarea.x - dox;
- dragging_y = my - itemarea.y - doy;
+ dragging_x = mx - _itemArea.x - dox;
+ dragging_y = my - _itemArea.y - doy;
item->setGumpLocation(dragging_x, dragging_y);
}
}
@@ -542,10 +542,10 @@ void ContainerGump::DropItem(Item *item, int mx, int my) {
void ContainerGump::saveData(ODataSource *ods) {
ItemRelativeGump::saveData(ods);
- ods->write4(static_cast<uint32>(itemarea.x));
- ods->write4(static_cast<uint32>(itemarea.y));
- ods->write4(static_cast<uint32>(itemarea.w));
- ods->write4(static_cast<uint32>(itemarea.h));
+ ods->write4(static_cast<uint32>(_itemArea.x));
+ ods->write4(static_cast<uint32>(_itemArea.y));
+ ods->write4(static_cast<uint32>(_itemArea.w));
+ ods->write4(static_cast<uint32>(_itemArea.h));
}
bool ContainerGump::loadData(IDataSource *ids, uint32 version) {
@@ -555,7 +555,7 @@ bool ContainerGump::loadData(IDataSource *ids, uint32 version) {
int32 iay = static_cast<int32>(ids->read4());
int32 iaw = static_cast<int32>(ids->read4());
int32 iah = static_cast<int32>(ids->read4());
- itemarea.Set(iax, iay, iaw, iah);
+ _itemArea.Set(iax, iay, iaw, iah);
return true;
}
diff --git a/engines/ultima/ultima8/gumps/container_gump.h b/engines/ultima/ultima8/gumps/container_gump.h
index 0578c56..5b5b3ae 100644
--- a/engines/ultima/ultima8/gumps/container_gump.h
+++ b/engines/ultima/ultima8/gumps/container_gump.h
@@ -39,10 +39,10 @@ public:
ContainerGump();
ContainerGump(Shape *shape, uint32 frameNum, uint16 owner,
uint32 flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
- ~ContainerGump(void) override;
+ ~ContainerGump() override;
- void setItemArea(Rect *itemarea_) {
- itemarea = *itemarea_;
+ void setItemArea(Rect *itemArea) {
+ _itemArea = *itemArea;
}
// Close the gump
@@ -83,12 +83,12 @@ protected:
void getItemCoords(Item *item, int32 &itemx, int32 &itemy);
- Rect itemarea;
+ Rect _itemArea;
- bool display_dragging;
- uint32 dragging_shape;
- uint32 dragging_frame;
- uint32 dragging_flags;
+ bool _displayDragging;
+ uint32 _draggingShape;
+ uint32 _draggingFrame;
+ uint32 _draggingFlags;
int32 dragging_x, dragging_y;
};
diff --git a/engines/ultima/ultima8/gumps/controls_gump.cpp b/engines/ultima/ultima8/gumps/controls_gump.cpp
index d9ddbb3..01e89c1 100644
--- a/engines/ultima/ultima8/gumps/controls_gump.cpp
+++ b/engines/ultima/ultima8/gumps/controls_gump.cpp
@@ -44,7 +44,7 @@ class ControlEntryGump : public Gump {
public:
ENABLE_RUNTIME_CLASSTYPE()
ControlEntryGump(int x_, int y_, int width, const char *binding, const char *name);
- ~ControlEntryGump(void) override;
+ ~ControlEntryGump() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
void ChildNotify(Gump *child, uint32 message) override;
void init();
@@ -135,12 +135,12 @@ void ControlsGump::InitGump(Gump *newparent, bool take_focus) {
widget->InitGump(this, false);
}
-void ControlsGump::addEntry(const char *binding, const char *name, int &x_, int &y_) {
+void ControlsGump::addEntry(const char *binding, const char *name, int &x, int &y) {
Rect rect;
- Gump *widget = new ControlEntryGump(x_, y_, _dims.w - x_, binding, name);
+ Gump *widget = new ControlEntryGump(x, y, _dims.w - x, binding, name);
widget->InitGump(this);
widget->GetDims(rect);
- y_ += rect.h;
+ y += rect.h;
}
void ControlsGump::ChildNotify(Gump *child, uint32 message) {
diff --git a/engines/ultima/ultima8/gumps/controls_gump.h b/engines/ultima/ultima8/gumps/controls_gump.h
index 78a1940..1138420 100644
--- a/engines/ultima/ultima8/gumps/controls_gump.h
+++ b/engines/ultima/ultima8/gumps/controls_gump.h
@@ -36,7 +36,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
ControlsGump();
- ~ControlsGump(void) override;
+ ~ControlsGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
@@ -49,7 +49,7 @@ public:
static void showEngineMenu(PagedGump *pagedgump);
static void showU8Menu(PagedGump *pagedgump);
- void addEntry(const char *binding, const char *name, int &x_, int &y_);
+ void addEntry(const char *binding, const char *name, int &x, int &y);
bool loadData(IDataSource *ids);
protected:
diff --git a/engines/ultima/ultima8/gumps/credits_gump.h b/engines/ultima/ultima8/gumps/credits_gump.h
index 5efb0cc..3f023e5 100644
--- a/engines/ultima/ultima8/gumps/credits_gump.h
+++ b/engines/ultima/ultima8/gumps/credits_gump.h
@@ -38,7 +38,7 @@ public:
CreditsGump();
CreditsGump(const Std::string &text, int parskip = 24,
uint32 flags = 0, int32 layer = LAYER_MODAL);
- ~CreditsGump(void) override;
+ ~CreditsGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.cpp b/engines/ultima/ultima8/gumps/desktop_gump.cpp
index 463a77c..4aec2ab 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.cpp
+++ b/engines/ultima/ultima8/gumps/desktop_gump.cpp
@@ -35,7 +35,7 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(DesktopGump, Gump)
-bool DesktopGump::faded_modal = true;
+bool DesktopGump::_fadedModal = true;
DesktopGump::DesktopGump()
: Gump() {
@@ -72,7 +72,7 @@ void DesktopGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sca
if (!g->IsClosing()) {
// If background blanking on modal is enabled...
// Background is partially transparent
- if (faded_modal && g->IsOfType<ModalGump>() &&
+ if (_fadedModal && g->IsOfType<ModalGump>() &&
!g->IsOfType<TargetGump>() && !g->IsHidden())
surf->FillBlended(0x7F000000, 0, 0, _dims.w, _dims.h);
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.h b/engines/ultima/ultima8/gumps/desktop_gump.h
index e20bcc1..40a58d5 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.h
+++ b/engines/ultima/ultima8/gumps/desktop_gump.h
@@ -30,13 +30,13 @@ namespace Ultima {
namespace Ultima8 {
class DesktopGump : public Gump {
- static bool faded_modal;
+ static bool _fadedModal;
public:
ENABLE_RUNTIME_CLASSTYPE()
DesktopGump();
DesktopGump(int32 x, int32 y, int32 width, int32 height);
- ~DesktopGump(void) override;
+ ~DesktopGump() override;
void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
void PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
@@ -50,7 +50,7 @@ public:
void RenderSurfaceChanged(RenderSurface *surf);
static void SetFadedModal(bool set) {
- faded_modal = set;
+ _fadedModal = set;
}
protected:
diff --git a/engines/ultima/ultima8/gumps/fast_area_vis_gump.h b/engines/ultima/ultima8/gumps/fast_area_vis_gump.h
index 73bcbb9..5c7c651 100644
--- a/engines/ultima/ultima8/gumps/fast_area_vis_gump.h
+++ b/engines/ultima/ultima8/gumps/fast_area_vis_gump.h
@@ -33,8 +33,8 @@ class FastAreaVisGump : public Gump {
public:
ENABLE_RUNTIME_CLASSTYPE()
- FastAreaVisGump(void);
- ~FastAreaVisGump(void) override;
+ FastAreaVisGump();
+ ~FastAreaVisGump() override;
void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
uint16 TraceObjId(int32 mx, int32 my) override;
diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp
index 801e5ff..463fc67 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.cpp
+++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp
@@ -58,26 +58,26 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(GameMapGump, Gump)
-bool GameMapGump::highlightItems = false;
+bool GameMapGump::_highlightItems = false;
GameMapGump::GameMapGump() :
- Gump(), display_dragging(false) {
- display_list = new ItemSorter();
+ Gump(), _displayDragging(false) {
+ _displayList = new ItemSorter();
}
-GameMapGump::GameMapGump(int X, int Y, int Width, int Height) :
- Gump(X, Y, Width, Height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP, LAYER_GAMEMAP),
- display_list(0), display_dragging(false) {
+GameMapGump::GameMapGump(int x, int y, int width, int height) :
+ Gump(x, y, width, height, 0, FLAG_DONT_SAVE | FLAG_CORE_GUMP, LAYER_GAMEMAP),
+ _displayList(0), _displayDragging(false) {
// Offset the gump. We want 0,0 to be the centre
_dims.x -= _dims.w / 2;
_dims.y -= _dims.h / 2;
- pout << "Create display_list ItemSorter object" << Std::endl;
- display_list = new ItemSorter();
+ pout << "Create _displayList ItemSorter object" << Std::endl;
+ _displayList = new ItemSorter();
}
GameMapGump::~GameMapGump() {
- delete display_list;
+ delete _displayList;
}
void GameMapGump::GetCameraLocation(int32 &lx, int32 &ly, int32 &lz,
@@ -123,7 +123,7 @@ void GameMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
zlimit = roof->getZ();
}
- display_list->BeginDisplayList(surf, lx, ly, lz);
+ _displayList->BeginDisplayList(surf, lx, ly, lz);
uint32 gametick = Kernel::get_instance()->getFrameNum();
@@ -163,26 +163,26 @@ void GameMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
int32 x_, y_, z_;
item->getLerped(x_, y_, z_);
- display_list->AddItem(x_, y_, z_, item->getShape(), item->getFrame(), item->getFlags() & ~Item::FLG_INVISIBLE, item->getExtFlags() | Item::EXT_TRANSPARENT, 1);
+ _displayList->AddItem(x_, y_, z_, item->getShape(), item->getFrame(), item->getFlags() & ~Item::FLG_INVISIBLE, item->getExtFlags() | Item::EXT_TRANSPARENT, 1);
}
continue;
}
- display_list->AddItem(item);
+ _displayList->AddItem(item);
}
}
}
// Dragging:
- if (display_dragging) {
- display_list->AddItem(dragging_pos[0], dragging_pos[1], dragging_pos[2],
- dragging_shape, dragging_frame,
- dragging_flags, Item::EXT_TRANSPARENT);
+ if (_displayDragging) {
+ _displayList->AddItem(_draggingPos[0], _draggingPos[1], _draggingPos[2],
+ _draggingShape, _draggingFrame,
+ _draggingFlags, Item::EXT_TRANSPARENT);
}
- display_list->PaintDisplayList(highlightItems);
+ _displayList->PaintDisplayList(_highlightItems);
}
// Trace a click, and return ObjId
@@ -191,7 +191,7 @@ uint16 GameMapGump::TraceObjId(int32 mx, int32 my) {
if (objId_ && objId_ != 65535) return objId_;
ParentToGump(mx, my);
- return display_list->Trace(mx, my, 0, highlightItems);
+ return _displayList->Trace(mx, my, 0, _highlightItems);
}
uint16 GameMapGump::TraceCoordinates(int mx, int my, int32 coords[3],
@@ -204,7 +204,7 @@ uint16 GameMapGump::TraceCoordinates(int mx, int my, int32 coords[3],
GetCameraLocation(cx, cy, cz);
ItemSorter::HitFace face;
- ObjId trace = display_list->Trace(mx, my, &face);
+ ObjId trace = _displayList->Trace(mx, my, &face);
Item *hit = getItem(trace);
if (!hit) // strange...
@@ -410,8 +410,8 @@ void GameMapGump::OnMouseDouble(int button, int32 mx, int32 my) {
}
void GameMapGump::IncSortOrder(int count) {
- if (count > 0) display_list->IncSortLimit();
- else display_list->DecSortLimit();
+ if (count > 0) _displayList->IncSortLimit();
+ else _displayList->DecSortLimit();
}
bool GameMapGump::StartDraggingItem(Item *item, int mx, int my) {
@@ -435,14 +435,14 @@ bool GameMapGump::DraggingItem(Item *item, int mx, int my) {
int32 dox, doy;
Mouse::get_instance()->getDraggingOffset(dox, doy);
- dragging_shape = item->getShape();
- dragging_frame = item->getFrame();
- dragging_flags = item->getFlags();
- display_dragging = true;
+ _draggingShape = item->getShape();
+ _draggingFrame = item->getFrame();
+ _draggingFlags = item->getFlags();
+ _displayDragging = true;
// determine if item can be dropped here
- ObjId trace = TraceCoordinates(mx, my, dragging_pos, dox, doy, item);
+ ObjId trace = TraceCoordinates(mx, my, _draggingPos, dox, doy, item);
if (!trace)
return false;
@@ -455,17 +455,17 @@ bool GameMapGump::DraggingItem(Item *item, int mx, int my) {
bool throwing = false;
if (!avatar->canReach(item, 128, // CONSTANT!
- dragging_pos[0], dragging_pos[1], dragging_pos[2])) {
+ _draggingPos[0], _draggingPos[1], _draggingPos[2])) {
// can't reach, so see if we can throw
int throwrange = item->getThrowRange();
- if (throwrange && avatar->canReach(item, throwrange, dragging_pos[0],
- dragging_pos[1], dragging_pos[2])) {
+ if (throwrange && avatar->canReach(item, throwrange, _draggingPos[0],
+ _draggingPos[1], _draggingPos[2])) {
int speed = 64 - item->getTotalWeight() + avatar->getStr();
if (speed < 1) speed = 1;
int32 ax, ay, az;
avatar->getLocation(ax, ay, az);
MissileTracker t(item, ax, ay, az,
- dragging_pos[0], dragging_pos[1], dragging_pos[2],
+ _draggingPos[0], _draggingPos[1], _draggingPos[2],
speed, 4);
if (t.isPathClear())
throwing = true;
@@ -476,7 +476,7 @@ bool GameMapGump::DraggingItem(Item *item, int mx, int my) {
}
}
- if (!item->canExistAt(dragging_pos[0], dragging_pos[1], dragging_pos[2]))
+ if (!item->canExistAt(_draggingPos[0], _draggingPos[1], _draggingPos[2]))
return false;
if (throwing)
@@ -486,12 +486,12 @@ bool GameMapGump::DraggingItem(Item *item, int mx, int my) {
}
void GameMapGump::DraggingItemLeftGump(Item *item) {
- display_dragging = false;
+ _displayDragging = false;
}
void GameMapGump::StopDraggingItem(Item *item, bool moved) {
- display_dragging = false;
+ _displayDragging = false;
if (!moved) return; // nothing to do
@@ -503,10 +503,10 @@ void GameMapGump::DropItem(Item *item, int mx, int my) {
int32 dox, doy;
Mouse::get_instance()->getDraggingOffset(dox, doy);
- display_dragging = false;
+ _displayDragging = false;
Actor *avatar = getMainActor();
- ObjId trace = TraceCoordinates(mx, my, dragging_pos, dox, doy, item);
+ ObjId trace = TraceCoordinates(mx, my, _draggingPos, dox, doy, item);
if (trace == 1) { // dropping on self
ObjId bp = avatar->getEquip(7); // !! constant
Container *backpack = getContainer(bp);
@@ -518,10 +518,10 @@ void GameMapGump::DropItem(Item *item, int mx, int my) {
}
if (!avatar->canReach(item, 128, // CONSTANT!
- dragging_pos[0], dragging_pos[1], dragging_pos[2])) {
+ _draggingPos[0], _draggingPos[1], _draggingPos[2])) {
// can't reach, so throw
- pout << "Throwing item to (" << dragging_pos[0] << ","
- << dragging_pos[1] << "," << dragging_pos[2] << ")" << Std::endl;
+ pout << "Throwing item to (" << _draggingPos[0] << ","
+ << _draggingPos[1] << "," << _draggingPos[2] << ")" << Std::endl;
int speed = 64 - item->getTotalWeight() + avatar->getStr();
if (speed < 1) speed = 1;
int32 ax, ay, az;
@@ -530,13 +530,13 @@ void GameMapGump::DropItem(Item *item, int mx, int my) {
// CHECKME: correct events triggered when doing this move?
item->move(ax, ay, az + 24);
int32 tx, ty;
- tx = dragging_pos[0];
- ty = dragging_pos[1];
+ tx = _draggingPos[0];
+ ty = _draggingPos[1];
int inaccuracy = 4 * (30 - avatar->getDex());
if (inaccuracy < 20) inaccuracy = 20; // just in case dex > 25
tx += (getRandom() % inaccuracy) - (getRandom() % inaccuracy);
ty += (getRandom() % inaccuracy) - (getRandom() % inaccuracy);
- MissileTracker t(item, tx, ty, dragging_pos[2],
+ MissileTracker t(item, tx, ty, _draggingPos[2],
speed, 4);
t.launchItem();
@@ -544,24 +544,24 @@ void GameMapGump::DropItem(Item *item, int mx, int my) {
// get stuck on the avatar. Why?
#if 0
avatar->doAnim(Animation::stand,
- Get_WorldDirection(dragging_pos[1] - ay,
- dragging_pos[0] - ax));
+ Get_WorldDirection(_draggingPos[1] - ay,
+ _draggingPos[0] - ax));
#endif
} else {
- pout << "Dropping item at (" << dragging_pos[0] << ","
- << dragging_pos[1] << "," << dragging_pos[2] << ")" << Std::endl;
+ pout << "Dropping item at (" << _draggingPos[0] << ","
+ << _draggingPos[1] << "," << _draggingPos[2] << ")" << Std::endl;
// CHECKME: collideMove and grab (in StopDraggingItem)
// both call release on supporting items.
- item->collideMove(dragging_pos[0], dragging_pos[1], dragging_pos[2],
+ item->collideMove(_draggingPos[0], _draggingPos[1], _draggingPos[2],
true, true); // teleport item
item->fall();
}
}
void GameMapGump::ConCmd_toggleHighlightItems(const Console::ArgvType &argv) {
- GameMapGump::SetHighlightItems(!GameMapGump::isHighlightItems());
+ GameMapGump::Set_highlightItems(!GameMapGump::is_highlightItems());
}
void GameMapGump::ConCmd_dumpMap(const Console::ArgvType &) {
diff --git a/engines/ultima/ultima8/gumps/game_map_gump.h b/engines/ultima/ultima8/gumps/game_map_gump.h
index a2eae3f..07bc1eb 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.h
+++ b/engines/ultima/ultima8/gumps/game_map_gump.h
@@ -35,7 +35,7 @@ class CameraProcess;
class GameMapGump : public Gump {
protected:
- ItemSorter *display_list;
+ ItemSorter *_displayList;
public:
ENABLE_RUNTIME_CLASSTYPE()
@@ -77,11 +77,11 @@ public:
bool loadData(IDataSource *ids, uint32 version);
- static void SetHighlightItems(bool highlight) {
- highlightItems = highlight;
+ static void Set_highlightItems(bool highlight) {
+ _highlightItems = highlight;
}
- static bool isHighlightItems() {
- return highlightItems;
+ static bool is_highlightItems() {
+ return _highlightItems;
}
static void ConCmd_toggleHighlightItems(const Console::ArgvType &argv);
@@ -95,14 +95,13 @@ public:
protected:
void saveData(ODataSource *ods) override;
- bool display_dragging;
- uint32 dragging_shape;
- uint32 dragging_frame;
- uint32 dragging_flags;
- int32 dragging_pos[3];
-
- static bool highlightItems;
+ bool _displayDragging;
+ uint32 _draggingShape;
+ uint32 _draggingFrame;
+ uint32 _draggingFlags;
+ int32 _draggingPos[3];
+ static bool _highlightItems;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/gump.cpp b/engines/ultima/ultima8/gumps/gump.cpp
index b2d5d2d..e74368d 100644
--- a/engines/ultima/ultima8/gumps/gump.cpp
+++ b/engines/ultima/ultima8/gumps/gump.cpp
@@ -43,10 +43,10 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(Gump, Object)
Gump::Gump() : Object(), _parent(0), _children() {
}
-Gump::Gump(int inX, int inY, int Width, int Height, uint16 inOwner,
+Gump::Gump(int inX, int inY, int width, int height, uint16 inOwner,
uint32 inFlags, int32 inLayer) :
Object(), _owner(inOwner), _parent(0), _x(inX), _y(inY),
- _dims(0, 0, Width, Height), _flags(inFlags), _layer(inLayer), _index(-1),
+ _dims(0, 0, width, height), _flags(inFlags), _layer(inLayer), _index(-1),
_shape(0), _frameNum(0), _children(), _focusChild(0), _notifier(0),
_processResult(0) {
assignObjId(); // gumps always get an objid
diff --git a/engines/ultima/ultima8/gumps/gump.h b/engines/ultima/ultima8/gumps/gump.h
index 43eab95..b11cb55 100644
--- a/engines/ultima/ultima8/gumps/gump.h
+++ b/engines/ultima/ultima8/gumps/gump.h
@@ -144,7 +144,7 @@ public:
//! Close item-dependent gumps (recursively).
//! Called when there is a map change (so the gumps can self terminate
//! among other things), or when backspace is pressed by the user.
- virtual void CloseItemDependents(void);
+ virtual void CloseItemDependents();
//! Paint the Gump (RenderSurface is relative to parent).
//! Calls PaintThis and PaintChildren
diff --git a/engines/ultima/ultima8/gumps/gump_notify_process.cpp b/engines/ultima/ultima8/gumps/gump_notify_process.cpp
index 4dc796e..412646e 100644
--- a/engines/ultima/ultima8/gumps/gump_notify_process.cpp
+++ b/engines/ultima/ultima8/gumps/gump_notify_process.cpp
@@ -24,7 +24,6 @@
#include "ultima/ultima8/gumps/gump_notify_process.h"
#include "ultima/ultima8/gumps/gump.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -38,7 +37,7 @@ GumpNotifyProcess::GumpNotifyProcess()
}
-GumpNotifyProcess::GumpNotifyProcess(uint16 it) : Process(it), gump(0) {
+GumpNotifyProcess::GumpNotifyProcess(uint16 it) : Process(it), _gump(0) {
result = 0;
type = 0x200; // CONSTANT!
}
@@ -47,12 +46,12 @@ GumpNotifyProcess::~GumpNotifyProcess(void) {
}
void GumpNotifyProcess::setGump(Gump *g) {
- gump = g->getObjId();
+ _gump = g->getObjId();
}
void GumpNotifyProcess::notifyClosing(int res) {
- gump = 0;
+ _gump = 0;
result = res;
if (!(flags & PROC_TERMINATED)) terminate();
}
@@ -60,8 +59,8 @@ void GumpNotifyProcess::notifyClosing(int res) {
void GumpNotifyProcess::terminate() {
Process::terminate();
- if (gump) {
- Gump *g = Ultima8::getGump(gump);
+ if (_gump) {
+ Gump *g = Ultima8::getGump(_gump);
assert(g);
g->Close();
}
@@ -72,19 +71,19 @@ void GumpNotifyProcess::run() {
void GumpNotifyProcess::dumpInfo() {
Process::dumpInfo();
- pout << " gump: " << gump << Std::endl;
+ pout << " gump: " << _gump << Std::endl;
}
void GumpNotifyProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write2(gump);
+ ods->write2(_gump);
}
bool GumpNotifyProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- gump = ids->read2();
+ _gump = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/gumps/gump_notify_process.h b/engines/ultima/ultima8/gumps/gump_notify_process.h
index 533f81e..affbdbe 100644
--- a/engines/ultima/ultima8/gumps/gump_notify_process.h
+++ b/engines/ultima/ultima8/gumps/gump_notify_process.h
@@ -32,18 +32,18 @@ namespace Ultima8 {
class Gump;
class GumpNotifyProcess : public Process {
- uint16 gump;
+ uint16 _gump;
public:
ENABLE_RUNTIME_CLASSTYPE()
GumpNotifyProcess();
GumpNotifyProcess(uint16 it);
- ~GumpNotifyProcess(void) override;
+ ~GumpNotifyProcess() override;
void setGump(Gump *g);
uint16 getGump() const {
- return gump;
+ return _gump;
}
virtual void notifyClosing(int res);
diff --git a/engines/ultima/ultima8/gumps/inverter_gump.cpp b/engines/ultima/ultima8/gumps/inverter_gump.cpp
index c7f0c3b..6f170c6 100644
--- a/engines/ultima/ultima8/gumps/inverter_gump.cpp
+++ b/engines/ultima/ultima8/gumps/inverter_gump.cpp
@@ -34,11 +34,11 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(InverterGump, DesktopGump)
InverterGump::InverterGump(int32 x, int32 y, int32 width, int32 height)
: DesktopGump(x, y, width, height) {
- buffer = 0;
+ _buffer = 0;
}
InverterGump::~InverterGump() {
- delete buffer;
+ delete _buffer;
}
static inline int getLine(int index, int n) {
@@ -94,15 +94,15 @@ void InverterGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sc
// need a backbuffer
- if (!buffer) {
- buffer = RenderSurface::CreateSecondaryRenderSurface(width, height);
+ if (!_buffer) {
+ _buffer = RenderSurface::CreateSecondaryRenderSurface(width, height);
}
- DesktopGump::PaintChildren(buffer, lerp_factor, scaled);
+ DesktopGump::PaintChildren(_buffer, lerp_factor, scaled);
- Texture *tex = buffer->GetSurfaceAsTexture();
+ Texture *tex = _buffer->GetSurfaceAsTexture();
- // now invert-blit buffer to screen
+ // now invert-blit _buffer to screen
int t = (state * height) / 0x10000;
for (int i = 0; i < height; ++i) {
@@ -132,7 +132,7 @@ void InverterGump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir) {
void InverterGump::RenderSurfaceChanged() {
DesktopGump::RenderSurfaceChanged();
- FORGET_OBJECT(buffer);
+ FORGET_OBJECT(_buffer);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/inverter_gump.h b/engines/ultima/ultima8/gumps/inverter_gump.h
index 67f47af..7b9cf2f 100644
--- a/engines/ultima/ultima8/gumps/inverter_gump.h
+++ b/engines/ultima/ultima8/gumps/inverter_gump.h
@@ -37,7 +37,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
InverterGump(int32 x, int32 y, int32 width, int32 height);
- ~InverterGump(void) override;
+ ~InverterGump() override;
void Paint(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
void PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
@@ -50,7 +50,7 @@ public:
void RenderSurfaceChanged() override;
protected:
- RenderSurface *buffer;
+ RenderSurface *_buffer;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/item_relative_gump.cpp b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
index 4f6d20e..4c5d14e 100644
--- a/engines/ultima/ultima8/gumps/item_relative_gump.cpp
+++ b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
@@ -35,13 +35,12 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(ItemRelativeGump, Gump)
-ItemRelativeGump::ItemRelativeGump()
- : Gump(), ix(0), iy(0) {
+ItemRelativeGump::ItemRelativeGump() : Gump(), _ix(0), _iy(0) {
}
ItemRelativeGump::ItemRelativeGump(int32 x, int32 y, int32 width, int32 height,
uint16 owner, uint32 flags, int32 layer)
- : Gump(x, y, width, height, owner, flags, layer), ix(0), iy(0) {
+ : Gump(x, y, width, height, owner, flags, layer), _ix(0), _iy(0) {
}
ItemRelativeGump::~ItemRelativeGump(void) {
@@ -99,16 +98,16 @@ void ItemRelativeGump::Paint(RenderSurface *surf, int32 lerp_factor, bool scaled
// Convert a parent relative point to a gump point
void ItemRelativeGump::ParentToGump(int32 &px, int32 &py, PointRoundDir r) {
- px -= ix;
- py -= iy;
+ px -= _ix;
+ py -= _iy;
Gump::ParentToGump(px, py, r);
}
// Convert a gump point to parent relative point
void ItemRelativeGump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir r) {
Gump::GumpToParent(gx, gy, r);
- gx += ix;
- gy += iy;
+ gx += _ix;
+ gy += _iy;
}
void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
@@ -158,9 +157,9 @@ void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
if (_parent) _parent->ScreenSpaceToGump(gx, gy);
// Set x and y, and center us over it
- ix = gx - _dims.w / 2;
-// iy = gy-_dims.h-it->getShapeInfo()->z*8-16;
- iy = gy - _dims.h;
+ _ix = gx - _dims.w / 2;
+// _iy = gy-_dims.h-it->getShapeInfo()->z*8-16;
+ _iy = gy - _dims.h;
if (_flags & FLAG_KEEP_VISIBLE)
diff --git a/engines/ultima/ultima8/gumps/item_relative_gump.h b/engines/ultima/ultima8/gumps/item_relative_gump.h
index c7ad9d1..3a7b5f2 100644
--- a/engines/ultima/ultima8/gumps/item_relative_gump.h
+++ b/engines/ultima/ultima8/gumps/item_relative_gump.h
@@ -31,14 +31,14 @@ namespace Ultima8 {
class ItemRelativeGump : public Gump {
protected:
- int32 ix, iy;
+ int32 _ix, _iy;
public:
ENABLE_RUNTIME_CLASSTYPE()
ItemRelativeGump();
ItemRelativeGump(int32 x, int32 y, int32 width, int32 height, uint16 owner, uint32 flags = 0, int32 layer = LAYER_NORMAL);
- ~ItemRelativeGump(void) override;
+ ~ItemRelativeGump() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/main_menu_process.cpp b/engines/ultima/ultima8/gumps/main_menu_process.cpp
index 11d1644..5553b5a 100644
--- a/engines/ultima/ultima8/gumps/main_menu_process.cpp
+++ b/engines/ultima/ultima8/gumps/main_menu_process.cpp
@@ -38,7 +38,7 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(MainMenuProcess, Process)
MainMenuProcess::MainMenuProcess() : Process() {
- init = false;
+ _init = false;
}
diff --git a/engines/ultima/ultima8/gumps/main_menu_process.h b/engines/ultima/ultima8/gumps/main_menu_process.h
index d7e8957..ac1922a 100644
--- a/engines/ultima/ultima8/gumps/main_menu_process.h
+++ b/engines/ultima/ultima8/gumps/main_menu_process.h
@@ -44,7 +44,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- bool init;
+ bool _init;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/menu_gump.h b/engines/ultima/ultima8/gumps/menu_gump.h
index 092d965..b875992 100644
--- a/engines/ultima/ultima8/gumps/menu_gump.h
+++ b/engines/ultima/ultima8/gumps/menu_gump.h
@@ -36,7 +36,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
MenuGump(bool nameEntryMode = false);
- ~MenuGump(void) override;
+ ~MenuGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/message_box_gump.cpp b/engines/ultima/ultima8/gumps/message_box_gump.cpp
index 18df713..feca619 100644
--- a/engines/ultima/ultima8/gumps/message_box_gump.cpp
+++ b/engines/ultima/ultima8/gumps/message_box_gump.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/gumps/message_box_gump.h"
-
#include "ultima/ultima8/gumps/widgets/text_widget.h"
#include "ultima/ultima8/gumps/widgets/button_widget.h"
#include "ultima/ultima8/games/game_data.h"
@@ -40,7 +39,6 @@
#include "ultima/ultima8/graphics/fonts/font.h"
#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/graphics/render_surface.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -54,14 +52,14 @@ MessageBoxGump::MessageBoxGump()
}
-MessageBoxGump::MessageBoxGump(const Std::string &title_, const Std::string &message_, uint32 title_colour_,
- Std::vector<Std::string> *buttons_) :
- ModalGump(0, 0, 100, 100), title(title_), message(message_), title_colour(title_colour_) {
- if (buttons_)
- buttons_->swap(buttons);
+MessageBoxGump::MessageBoxGump(const Std::string &title, const Std::string &message_, uint32 titleColour,
+ Std::vector<Std::string> *buttons) :
+ ModalGump(0, 0, 100, 100), _title(title), _message(message_), _titleColour(titleColour) {
+ if (buttons)
+ buttons->swap(_buttons);
- if (buttons.empty())
- buttons.push_back(Std::string("Ok"));
+ if (_buttons.empty())
+ _buttons.push_back(Std::string("Ok"));
}
MessageBoxGump::~MessageBoxGump(void) {
@@ -79,19 +77,19 @@ void MessageBoxGump::InitGump(Gump *newparent, bool take_focus) {
unsigned int rem;
// Title width
- font->getStringSize(title, width, height);
+ font->getStringSize(_title, width, height);
int title_w = width;
- // Width of buttons
+ // Width of _buttons
int buttons_w = MBG_PADDING;
- for (size_t i = 0; i < buttons.size(); i++) {
+ for (size_t i = 0; i < _buttons.size(); i++) {
width = height = 0;
- font->getStringSize(buttons[i], width, height);
+ font->getStringSize(_buttons[i], width, height);
buttons_w += width + MBG_PADDING;
}
// Message size
- font->getTextSize(message, width, height, rem);
+ font->getTextSize(_message, width, height, rem);
_dims.w = MBG_PADDING + width + MBG_PADDING;
if (_dims.w < MBG_PADDING + title_w + MBG_PADDING) _dims.w = MBG_PADDING + title_w + MBG_PADDING;
@@ -100,21 +98,21 @@ void MessageBoxGump::InitGump(Gump *newparent, bool take_focus) {
_dims.h = 23 + MBG_PADDING + height + MBG_PADDING + 28;
// Title
- Gump *w = new TextWidget(MBG_PADDING, 2, title, false, 0);
+ Gump *w = new TextWidget(MBG_PADDING, 2, _title, false, 0);
w->InitGump(this, false);
// Message
- w = new TextWidget(MBG_PADDING, 23 + MBG_PADDING, message, false, 0, width, height);
+ w = new TextWidget(MBG_PADDING, 23 + MBG_PADDING, _message, false, 0, width, height);
w->InitGump(this, false);
// Buttons (right aligned)
int off = _dims.w - buttons_w;
- for (size_t i = 0; i < buttons.size(); i++) {
- w = new ButtonWidget(off, _dims.h - 23, buttons[i], false, 1, 0x80D000D0);
+ for (size_t i = 0; i < _buttons.size(); i++) {
+ w = new ButtonWidget(off, _dims.h - 23, _buttons[i], false, 1, 0x80D000D0);
w->SetIndex(static_cast<int32>(i));
w->InitGump(this, false);
width = height = 0;
- font->getStringSize(buttons[i], width, height);
+ font->getStringSize(_buttons[i], width, height);
off += width + MBG_PADDING;
}
@@ -143,14 +141,14 @@ void MessageBoxGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*sc
surf->Fill32(line_colour, 0, _dims.h - 1, _dims.w, 1);
surf->Fill32(line_colour, _dims.w - 1, 0, 1, _dims.h);
- // line above buttons
+ // line above _buttons
surf->Fill32(line_colour, 0, _dims.h - 28, _dims.w, 1);
- // line below title
+ // line below _title
surf->Fill32(line_colour, 0, 23, _dims.w, 1);
- // Highlight behind message..
- if (IsFocus()) surf->Fill32(title_colour, 1, 1, _dims.w - 2, 22);
+ // Highlight behind _message..
+ if (IsFocus()) surf->Fill32(_titleColour, 1, 1, _dims.w - 2, 22);
else surf->Fill32(0xFF000000, 1, 1, _dims.w - 2, 22);
}
@@ -161,8 +159,8 @@ void MessageBoxGump::ChildNotify(Gump *child, uint32 msg) {
}
}
-ProcId MessageBoxGump::Show(Std::string title, Std::string message, uint32 title_colour, Std::vector<Std::string> *buttons) {
- Gump *gump = new MessageBoxGump(title, message, title_colour, buttons);
+ProcId MessageBoxGump::Show(Std::string _title, Std::string _message, uint32 _titleColour, Std::vector<Std::string> *_buttons) {
+ Gump *gump = new MessageBoxGump(_title, _message, _titleColour, _buttons);
gump->InitGump(0);
gump->setRelativePosition(CENTER);
gump->CreateNotifier();
diff --git a/engines/ultima/ultima8/gumps/message_box_gump.h b/engines/ultima/ultima8/gumps/message_box_gump.h
index 017709a..10c911c 100644
--- a/engines/ultima/ultima8/gumps/message_box_gump.h
+++ b/engines/ultima/ultima8/gumps/message_box_gump.h
@@ -33,10 +33,10 @@ namespace Ultima {
namespace Ultima8 {
class MessageBoxGump : public ModalGump {
- Std::string title;
- Std::string message;
- Std::vector<Std::string> buttons;
- int title_colour;
+ Std::string _title;
+ Std::string _message;
+ Std::vector<Std::string> _buttons;
+ int _titleColour;
public:
ENABLE_RUNTIME_CLASSTYPE()
diff --git a/engines/ultima/ultima8/gumps/mini_stats_gump.h b/engines/ultima/ultima8/gumps/mini_stats_gump.h
index fe7eb83..be9151c 100644
--- a/engines/ultima/ultima8/gumps/mini_stats_gump.h
+++ b/engines/ultima/ultima8/gumps/mini_stats_gump.h
@@ -36,7 +36,7 @@ public:
MiniStatsGump();
MiniStatsGump(int x, int y, uint32 flags = FLAG_DRAGGABLE,
int32 layer = LAYER_NORMAL);
- ~MiniStatsGump(void) override;
+ ~MiniStatsGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/minimap_gump.cpp b/engines/ultima/ultima8/gumps/minimap_gump.cpp
index 77d2a23..5dea341 100644
--- a/engines/ultima/ultima8/gumps/minimap_gump.cpp
+++ b/engines/ultima/ultima8/gumps/minimap_gump.cpp
@@ -40,10 +40,10 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(MiniMapGump, Gump)
MiniMapGump::MiniMapGump(int x_, int y_) :
Gump(x_, y_, MAP_NUM_CHUNKS * 2 + 2, MAP_NUM_CHUNKS * 2 + 2, 0,
- FLAG_DRAGGABLE, LAYER_NORMAL), minimap(), lastMapNum(0) {
- minimap.format = TEX_FMT_NATIVE;
- minimap.width = minimap.height = MAP_NUM_CHUNKS * MINMAPGUMP_SCALE;
- minimap.buffer = texbuffer[0];
+ FLAG_DRAGGABLE, LAYER_NORMAL), _minimap(), _lastMapNum(0) {
+ _minimap.format = TEX_FMT_NATIVE;
+ _minimap.width = _minimap.height = MAP_NUM_CHUNKS * MINMAPGUMP_SCALE;
+ _minimap.buffer = texbuffer[0];
con->AddConsoleCommand("MiniMapGump::generateWholeMap",
MiniMapGump::ConCmd_generateWholeMap);
@@ -62,9 +62,9 @@ void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
CurrentMap *currentmap = world->getCurrentMap();
int mapChunkSize = currentmap->getChunkSize();
- if (currentmap->getNum() != lastMapNum) {
+ if (currentmap->getNum() != _lastMapNum) {
Std::memset(texbuffer, 0, sizeof(texbuffer));
- lastMapNum = currentmap->getNum();
+ _lastMapNum = currentmap->getNum();
}
surf->Fill32(0xFFFFAF00, 0, 0, MAP_NUM_CHUNKS * 2 + 1, 1);
@@ -117,7 +117,7 @@ void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
surf->Fill32(0, 1, 1 + (MAP_NUM_CHUNKS * 2) - ly, MAP_NUM_CHUNKS * 2, ly);
}
- surf->Blit(&minimap, sx + ox, sy + oy, MAP_NUM_CHUNKS * 2 - (ox + lx), MAP_NUM_CHUNKS * 2 - (oy + ly), 1 + ox, 1 + oy);
+ surf->Blit(&_minimap, sx + ox, sy + oy, MAP_NUM_CHUNKS * 2 - (ox + lx), MAP_NUM_CHUNKS * 2 - (oy + ly), 1 + ox, 1 + oy);
surf->Fill32(0xFFFFFF00, 1 + ax - 2, 1 + ay + 0, 2, 1);
surf->Fill32(0xFFFFFF00, 1 + ax + 0, 1 + ay - 2, 1, 2);
@@ -206,10 +206,10 @@ void MiniMapGump::saveData(ODataSource *ods) {
bool MiniMapGump::loadData(IDataSource *ids, uint32 version) {
if (!Gump::loadData(ids, version)) return false;
- lastMapNum = 0;
- minimap.format = TEX_FMT_NATIVE;
- minimap.width = minimap.height = MAP_NUM_CHUNKS * MINMAPGUMP_SCALE;
- minimap.buffer = texbuffer[0];
+ _lastMapNum = 0;
+ _minimap.format = TEX_FMT_NATIVE;
+ _minimap.width = _minimap.height = MAP_NUM_CHUNKS * MINMAPGUMP_SCALE;
+ _minimap.buffer = texbuffer[0];
con->AddConsoleCommand("MiniMapGump::generateWholeMap",
MiniMapGump::ConCmd_generateWholeMap);
diff --git a/engines/ultima/ultima8/gumps/minimap_gump.h b/engines/ultima/ultima8/gumps/minimap_gump.h
index 32611bc..db4f457 100644
--- a/engines/ultima/ultima8/gumps/minimap_gump.h
+++ b/engines/ultima/ultima8/gumps/minimap_gump.h
@@ -34,8 +34,8 @@ namespace Ultima8 {
#define MINMAPGUMP_SCALE 8
class MiniMapGump : public Gump {
- Texture minimap;
- unsigned int lastMapNum;
+ Texture _minimap;
+ unsigned int _lastMapNum;
uint32 texbuffer[MAP_NUM_CHUNKS * MINMAPGUMP_SCALE][MAP_NUM_CHUNKS * MINMAPGUMP_SCALE];
uint32 sampleAtPoint(int x, int y, CurrentMap *map);
@@ -43,9 +43,9 @@ class MiniMapGump : public Gump {
public:
ENABLE_RUNTIME_CLASSTYPE()
- MiniMapGump(void);
+ MiniMapGump();
MiniMapGump(int x, int y);
- ~MiniMapGump(void) override;
+ ~MiniMapGump() override;
void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
uint16 TraceObjId(int32 mx, int32 my) override;
diff --git a/engines/ultima/ultima8/gumps/movie_gump.cpp b/engines/ultima/ultima8/gumps/movie_gump.cpp
index 7ce9f5a..4409cc2 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.cpp
+++ b/engines/ultima/ultima8/gumps/movie_gump.cpp
@@ -39,23 +39,23 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(MovieGump, ModalGump)
-MovieGump::MovieGump() : ModalGump(), player(0) {
+MovieGump::MovieGump() : ModalGump(), _player(0) {
}
MovieGump::MovieGump(int width, int height, RawArchive *movie,
bool introMusicHack, uint32 flags, int32 layer)
: ModalGump(50, 50, width, height, 0, flags, layer) {
- player = new SKFPlayer(movie, width, height, introMusicHack);
+ _player = new SKFPlayer(movie, width, height, introMusicHack);
}
MovieGump::~MovieGump() {
- delete player;
+ delete _player;
}
void MovieGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- player->start();
+ _player->start();
Mouse::get_instance()->pushMouseCursor();
Mouse::get_instance()->setMouseCursor(Mouse::MOUSE_NONE);
@@ -70,14 +70,14 @@ void MovieGump::Close(bool no_del) {
void MovieGump::run() {
ModalGump::run();
- player->run();
- if (!player->isPlaying()) {
+ _player->run();
+ if (!_player->isPlaying()) {
Close();
}
}
void MovieGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
- player->paint(surf, lerp_factor);
+ _player->paint(surf, lerp_factor);
}
bool MovieGump::OnKeyDown(int key, int mod) {
diff --git a/engines/ultima/ultima8/gumps/movie_gump.h b/engines/ultima/ultima8/gumps/movie_gump.h
index 92336c8..3802eda 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.h
+++ b/engines/ultima/ultima8/gumps/movie_gump.h
@@ -39,7 +39,7 @@ public:
MovieGump();
MovieGump(int width, int height, RawArchive *skf, bool introMusicHack = false,
uint32 flags = 0, int32 layer = LAYER_MODAL);
- ~MovieGump(void) override;
+ ~MovieGump() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
@@ -61,7 +61,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- SKFPlayer *player;
+ SKFPlayer *_player;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/options_gump.h b/engines/ultima/ultima8/gumps/options_gump.h
index 87df34f..a30499c 100644
--- a/engines/ultima/ultima8/gumps/options_gump.h
+++ b/engines/ultima/ultima8/gumps/options_gump.h
@@ -34,7 +34,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
OptionsGump();
- ~OptionsGump(void) override;
+ ~OptionsGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/paged_gump.cpp b/engines/ultima/ultima8/gumps/paged_gump.cpp
index 8dfae5e..3517fbb 100644
--- a/engines/ultima/ultima8/gumps/paged_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paged_gump.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/gumps/paged_gump.h"
-
#include "ultima/ultima8/games/game_data.h"
#include "ultima/ultima8/graphics/gump_shape_archive.h"
#include "ultima/ultima8/graphics/shape.h"
@@ -35,20 +34,20 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(PagedGump, ModalGump)
-PagedGump::PagedGump(int left, int right, int top, int shape_):
- ModalGump(0, 0, 5, 5), leftOff(left), rightOff(right), topOff(top),
- gumpShape(shape_), nextButton(0), prevButton(0), buttonsEnabled(true) {
- current = gumps.end();
+PagedGump::PagedGump(int left, int right, int top, int shape):
+ ModalGump(0, 0, 5, 5), _leftOff(left), _rightOff(right), _topOff(top),
+ _gumpShape(shape), _nextButton(0), _prevButton(0), _buttonsEnabled(true) {
+ _current = _gumps.end();
}
PagedGump::~PagedGump(void) {
- gumps.clear();
+ _gumps.clear();
}
void PagedGump::Close(bool no_del) {
Mouse::get_instance()->popMouseCursor();
Std::vector<Gump *>::iterator iter;
- for (iter = gumps.begin(); iter != gumps.end(); ++iter) {
+ for (iter = _gumps.begin(); iter != _gumps.end(); ++iter) {
(*iter)->Close(no_del); // CHECKME: no_del?
}
@@ -60,7 +59,7 @@ static const int pageOverShape = 34;
void PagedGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- _shape = GameData::get_instance()->getGumps()->getShape(gumpShape);
+ _shape = GameData::get_instance()->getGumps()->getShape(_gumpShape);
ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
@@ -71,16 +70,16 @@ void PagedGump::InitGump(Gump *newparent, bool take_focus) {
FrameID buttonright(GameData::GUMPS, pageOverShape, 1);
//!! Hardcoded gump
- nextButton = new ButtonWidget(0, 0, buttonright, buttonright, false,
+ _nextButton = new ButtonWidget(0, 0, buttonright, buttonright, false,
LAYER_ABOVE_NORMAL);
- nextButton->InitGump(this);
- nextButton->setRelativePosition(TOP_RIGHT, rightOff, topOff);
+ _nextButton->InitGump(this);
+ _nextButton->setRelativePosition(TOP_RIGHT, _rightOff, _topOff);
- prevButton = new ButtonWidget(0, 0, buttonleft, buttonleft, false,
+ _prevButton = new ButtonWidget(0, 0, buttonleft, buttonleft, false,
LAYER_ABOVE_NORMAL);
- prevButton->InitGump(this);
- prevButton->setRelativePosition(TOP_LEFT, leftOff, topOff);
- prevButton->HideGump();
+ _prevButton->InitGump(this);
+ _prevButton->setRelativePosition(TOP_LEFT, _leftOff, _topOff);
+ _prevButton->HideGump();
Mouse *mouse = Mouse::get_instance();
mouse->pushMouseCursor();
@@ -94,8 +93,8 @@ void PagedGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
bool PagedGump::OnKeyDown(int key, int mod) {
- if (current != gumps.end())
- if ((*current)->OnKeyDown(key, mod)) return true;
+ if (_current != _gumps.end())
+ if ((*_current)->OnKeyDown(key, mod)) return true;
switch (key) {
case Common::KEYCODE_ESCAPE:
@@ -109,35 +108,35 @@ bool PagedGump::OnKeyDown(int key, int mod) {
}
void PagedGump::ChildNotify(Gump *child, uint32 message) {
- if (!buttonsEnabled) return;
- if (gumps.empty()) return;
+ if (!_buttonsEnabled) return;
+ if (_gumps.empty()) return;
ObjId cid = child->getObjId();
if (message == ButtonWidget::BUTTON_CLICK) {
- if (cid == nextButton->getObjId()) {
- if (current + 1 != gumps.end()) {
- (*current)->HideGump();
- ++current;
- (*current)->UnhideGump();
- (*current)->MakeFocus();
+ if (cid == _nextButton->getObjId()) {
+ if (_current + 1 != _gumps.end()) {
+ (*_current)->HideGump();
+ ++_current;
+ (*_current)->UnhideGump();
+ (*_current)->MakeFocus();
- if (current + 1 == gumps.end())
- nextButton->HideGump();
+ if (_current + 1 == _gumps.end())
+ _nextButton->HideGump();
- prevButton->UnhideGump();
+ _prevButton->UnhideGump();
}
- } else if (cid == prevButton->getObjId()) {
- if (current != gumps.begin()) {
- (*current)->HideGump();
- --current;
- (*current)->UnhideGump();
- (*current)->MakeFocus();
+ } else if (cid == _prevButton->getObjId()) {
+ if (_current != _gumps.begin()) {
+ (*_current)->HideGump();
+ --_current;
+ (*_current)->UnhideGump();
+ (*_current)->MakeFocus();
- if (current == gumps.begin())
- prevButton->HideGump();
+ if (_current == _gumps.begin())
+ _prevButton->HideGump();
- nextButton->UnhideGump();
+ _nextButton->UnhideGump();
}
}
}
@@ -145,19 +144,19 @@ void PagedGump::ChildNotify(Gump *child, uint32 message) {
void PagedGump::addPage(Gump *g) {
assert(g->GetParent() == this);
- g->setRelativePosition(TOP_CENTER, 0, 3 + topOff);
+ g->setRelativePosition(TOP_CENTER, 0, 3 + _topOff);
g->HideGump();
- gumps.push_back(g);
+ _gumps.push_back(g);
- current = gumps.begin();
- (*current)->UnhideGump();
- if (_focusChild != *current)
- (*current)->MakeFocus();
+ _current = _gumps.begin();
+ (*_current)->UnhideGump();
+ if (_focusChild != *_current)
+ (*_current)->MakeFocus();
- if (current + 1 == gumps.end())
- nextButton->HideGump();
+ if (_current + 1 == _gumps.end())
+ _nextButton->HideGump();
else
- nextButton->UnhideGump();
+ _nextButton->UnhideGump();
}
bool PagedGump::loadData(IDataSource *ids) {
diff --git a/engines/ultima/ultima8/gumps/paged_gump.h b/engines/ultima/ultima8/gumps/paged_gump.h
index e82512a..ffb374a 100644
--- a/engines/ultima/ultima8/gumps/paged_gump.h
+++ b/engines/ultima/ultima8/gumps/paged_gump.h
@@ -34,7 +34,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
PagedGump(int left, int right, int top, int shape);
- ~PagedGump(void) override;
+ ~PagedGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
@@ -50,18 +50,18 @@ public:
void addPage(Gump *g);
void enableButtons(bool enabled) {
- buttonsEnabled = enabled;
+ _buttonsEnabled = enabled;
}
bool loadData(IDataSource *ids);
protected:
void saveData(ODataSource *ods) override;
- int leftOff, rightOff, topOff, gumpShape;
- Std::vector<Gump *> gumps;
- Gump *nextButton;
- Gump *prevButton;
- Std::vector<Gump *>::iterator current;
- bool buttonsEnabled;
+ int _leftOff, _rightOff, _topOff, _gumpShape;
+ Std::vector<Gump *> _gumps;
+ Gump *_nextButton;
+ Gump *_prevButton;
+ Std::vector<Gump *>::iterator _current;
+ bool _buttonsEnabled;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
index 57f9b2e..0a6660b 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/gumps/paperdoll_gump.h"
-
#include "ultima/ultima8/graphics/shape.h"
#include "ultima/ultima8/graphics/shape_frame.h"
#include "ultima/ultima8/graphics/shape_info.h"
@@ -38,7 +37,6 @@
#include "ultima/ultima8/gumps/mini_stats_gump.h"
#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -85,8 +83,8 @@ static const int statbuttonx = 81;
static const int statbuttony = 84;
-PaperdollGump::PaperdollGump() : ContainerGump(), statbuttongid(0),
- backpack_rect(49, 25, 10, 25) {
+PaperdollGump::PaperdollGump() : ContainerGump(), _statButtonId(0),
+ _backpackRect(49, 25, 10, 25) {
Common::fill(cached_text, cached_text + 14, (RenderedText *)nullptr);
Common::fill(cached_val, cached_val + 7, 0);
}
@@ -94,8 +92,8 @@ PaperdollGump::PaperdollGump() : ContainerGump(), statbuttongid(0),
PaperdollGump::PaperdollGump(Shape *shape_, uint32 frameNum, uint16 owner,
uint32 Flags, int32 layer)
: ContainerGump(shape_, frameNum, owner, Flags, layer),
- statbuttongid(0), backpack_rect(49, 25, 10, 25) {
- statbuttongid = 0;
+ _statButtonId(0), _backpackRect(49, 25, 10, 25) {
+ _statButtonId = 0;
Common::fill(cached_text, cached_text + 14, (RenderedText *)nullptr);
Common::fill(cached_val, cached_val + 7, 0);
@@ -116,7 +114,7 @@ void PaperdollGump::InitGump(Gump *newparent, bool take_focus) {
Gump *widget = new ButtonWidget(statbuttonx, statbuttony,
button_up, button_down);
- statbuttongid = widget->getObjId();
+ _statButtonId = widget->getObjId();
widget->InitGump(this);
}
@@ -206,21 +204,21 @@ void PaperdollGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
itemx = equipcoords[i].x;
itemy = equipcoords[i].y;
- itemx += itemarea.x;
- itemy += itemarea.y;
+ itemx += _itemArea.x;
+ itemy += _itemArea.y;
Shape *s = item->getShapeObject();
assert(s);
surf->Paint(s, frame, itemx, itemy);
}
- if (display_dragging) {
+ if (_displayDragging) {
int32 itemx, itemy;
- itemx = dragging_x + itemarea.x;
- itemy = dragging_y + itemarea.y;
+ itemx = dragging_x + _itemArea.x;
+ itemy = dragging_y + _itemArea.y;
Shape *s = GameData::get_instance()->getMainShapes()->
- getShape(dragging_shape);
+ getShape(_draggingShape);
assert(s);
- surf->PaintInvisible(s, dragging_frame, itemx, itemy, false, (dragging_flags & Item::FLG_FLIPPED) != 0);
+ surf->PaintInvisible(s, _draggingFrame, itemx, itemy, false, (_draggingFlags & Item::FLG_FLIPPED) != 0);
}
}
@@ -243,8 +241,8 @@ uint16 PaperdollGump::TraceObjId(int32 mx, int32 my) {
itemx = equipcoords[i].x;
itemy = equipcoords[i].y;
- itemx += itemarea.x;
- itemy += itemarea.y;
+ itemx += _itemArea.x;
+ itemy += _itemArea.y;
Shape *s = item->getShapeObject();
assert(s);
ShapeFrame *frame = s->getFrame(item->getFrame() + 1);
@@ -256,7 +254,7 @@ uint16 PaperdollGump::TraceObjId(int32 mx, int32 my) {
}
// try backpack
- if (backpack_rect.InRect(mx - itemarea.x, my - itemarea.y)) {
+ if (_backpackRect.InRect(mx - _itemArea.x, my - _itemArea.y)) {
if (a->getEquip(7)) // constants
return a->getEquip(7);
}
@@ -277,16 +275,16 @@ bool PaperdollGump::GetLocationOfItem(uint16 itemid, int32 &gx, int32 &gy,
//!!! need to use lerp_factor
if (item->getShape() == 529) { //!! constant
- gx = backpack_rect.x;
- gy = backpack_rect.y;
+ gx = _backpackRect.x;
+ gy = _backpackRect.y;
} else {
int equiptype = item->getZ();
assert(equiptype >= 0 && equiptype <= 6); //!! constants
gx = equipcoords[equiptype].x;
gy = equipcoords[equiptype].y;
}
- gx += itemarea.x;
- gy += itemarea.y;
+ gx += _itemArea.x;
+ gy += _itemArea.y;
return true;
}
@@ -313,8 +311,8 @@ bool PaperdollGump::StartDraggingItem(Item *item, int mx, int my) {
bool PaperdollGump::DraggingItem(Item *item, int mx, int my) {
- if (!itemarea.InRect(mx, my)) {
- display_dragging = false;
+ if (!_itemArea.InRect(mx, my)) {
+ _displayDragging = false;
return false;
}
@@ -324,45 +322,45 @@ bool PaperdollGump::DraggingItem(Item *item, int mx, int my) {
bool over_backpack = false;
Container *backpack = getContainer(a->getEquip(7)); // constant!
- if (backpack && backpack_rect.InRect(mx - itemarea.x, my - itemarea.y)) {
+ if (backpack && _backpackRect.InRect(mx - _itemArea.x, my - _itemArea.y)) {
over_backpack = true;
}
- display_dragging = true;
+ _displayDragging = true;
- dragging_shape = item->getShape();
- dragging_frame = item->getFrame();
- dragging_flags = item->getFlags();
+ _draggingShape = item->getShape();
+ _draggingFrame = item->getFrame();
+ _draggingFlags = item->getFlags();
int equiptype = item->getShapeInfo()->equiptype;
// determine target location and set dragging_x/y
if (!over_backpack && equiptype) {
// check if item will fit (weight/volume/etc...)
if (!a->CanAddItem(item, true)) {
- display_dragging = false;
+ _displayDragging = false;
return false;
}
- dragging_frame++;
+ _draggingFrame++;
dragging_x = equipcoords[equiptype].x;
dragging_y = equipcoords[equiptype].y;
} else {
// drop in backpack
if (!backpack->CanAddItem(item, true)) {
- display_dragging = false;
+ _displayDragging = false;
return false;
}
- dragging_x = backpack_rect.x + backpack_rect.w / 2;
- dragging_y = backpack_rect.y + backpack_rect.h / 2;
+ dragging_x = _backpackRect.x + _backpackRect.w / 2;
+ dragging_y = _backpackRect.y + _backpackRect.h / 2;
}
return true;
}
void PaperdollGump::DropItem(Item *item, int mx, int my) {
- display_dragging = false;
+ _displayDragging = false;
Actor *a = getActor(_owner);
assert(a);
@@ -370,7 +368,7 @@ void PaperdollGump::DropItem(Item *item, int mx, int my) {
bool over_backpack = false;
Container *backpack = getContainer(a->getEquip(7)); // constant!
- if (backpack && backpack_rect.InRect(mx - itemarea.x, my - itemarea.y)) {
+ if (backpack && _backpackRect.InRect(mx - _itemArea.x, my - _itemArea.y)) {
over_backpack = true;
}
@@ -384,7 +382,7 @@ void PaperdollGump::DropItem(Item *item, int mx, int my) {
}
void PaperdollGump::ChildNotify(Gump *child, uint32 message) {
- if (child->getObjId() == statbuttongid &&
+ if (child->getObjId() == _statButtonId &&
message == ButtonWidget::BUTTON_CLICK) {
// check if there already is an open MiniStatsGump
Gump *desktop = Ultima8Engine::get_instance()->getDesktopGump();
@@ -415,13 +413,13 @@ void PaperdollGump::ChildNotify(Gump *child, uint32 message) {
void PaperdollGump::saveData(ODataSource *ods) {
ContainerGump::saveData(ods);
- ods->write2(statbuttongid);
+ ods->write2(_statButtonId);
}
bool PaperdollGump::loadData(IDataSource *ids, uint32 version) {
if (!ContainerGump::loadData(ids, version)) return false;
- statbuttongid = ids->read2();
+ _statButtonId = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.h b/engines/ultima/ultima8/gumps/paperdoll_gump.h
index 335cac1..65271c1 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.h
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.h
@@ -38,7 +38,7 @@ public:
PaperdollGump();
PaperdollGump(Shape *shape, uint32 frameNum, uint16 owner,
uint32 flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
- ~PaperdollGump(void) override;
+ ~PaperdollGump() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
@@ -77,9 +77,9 @@ protected:
RenderedText *cached_text[14]; // constant!!
int cached_val[7]; // constant!!
- uint16 statbuttongid;
+ uint16 _statButtonId;
private:
- const Rect backpack_rect;
+ const Rect _backpackRect;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp b/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
index d9a2ad6..91db774 100644
--- a/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/pentagram_menu_gump.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/gumps/pentagram_menu_gump.h"
-
#include "ultima/ultima8/graphics/render_surface.h"
#include "ultima/ultima8/ultima8.h"
#include "ultima/ultima8/gumps/widgets/game_widget.h"
@@ -39,29 +38,29 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(PentagramMenuGump, ModalGump)
-PentagramMenuGump::PentagramMenuGump(int X, int Y, int Width, int Height) :
- ModalGump(X, Y, Width, Height) {
- gameScrollPos = 0;
- gameScrollTarget = 0;
- gameScrollLastDelta = 0;
- titleImage = 0;
- navbarImage = 0;
- coversImage = 0;
- flagsImage = 0;
+PentagramMenuGump::PentagramMenuGump(int x, int y, int width, int height) :
+ ModalGump(x, y, width, height) {
+ _gameScrollPos = 0;
+ _gameScrollTarget = 0;
+ _gameScrollLastDelta = 0;
+ _titleImage = 0;
+ _navbarImage = 0;
+ _coversImage = 0;
+ _flagsImage = 0;
}
PentagramMenuGump::~PentagramMenuGump() {
- delete titleImage;
- delete navbarImage;
- delete coversImage;
- delete flagsImage;
+ delete _titleImage;
+ delete _navbarImage;
+ delete _coversImage;
+ delete _flagsImage;
}
void PentagramMenuGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
GameWidget *g;
- int y_ = 50;
+ int y = 50;
Std::vector<istring> games;
// TODO: listGames() should probably be in CoreApp
@@ -73,28 +72,28 @@ void PentagramMenuGump::InitGump(Gump *newparent, bool take_focus) {
if (gameName == "pentagram") continue;
if (!Ultima8Engine::get_instance()->getGameInfo(gameName)) continue;
- g = new GameWidget(150, y_, gameName);
+ g = new GameWidget(150, y, gameName);
g->InitGump(this, false);
g->SetIndex(gameIndex++);
- y_ += 114;
+ y += 114;
}
- gamecount = gameIndex;
+ _gameCount = gameIndex;
IDataSource *ds = FileSystem::get_instance()->ReadFile("@data/title.png");
- titleImage = Texture::Create(ds, "title.png");
+ _titleImage = Texture::Create(ds, "title.png");
delete ds;
ds = FileSystem::get_instance()->ReadFile("@data/navbar.png");
- navbarImage = Texture::Create(ds, "navbar.png");
+ _navbarImage = Texture::Create(ds, "navbar.png");
delete ds;
ds = FileSystem::get_instance()->ReadFile("@data/covers.png");
- coversImage = Texture::Create(ds, "covers.png");
+ _coversImage = Texture::Create(ds, "covers.png");
delete ds;
ds = FileSystem::get_instance()->ReadFile("@data/flags.png");
- flagsImage = Texture::Create(ds, "flags.png");
+ _flagsImage = Texture::Create(ds, "flags.png");
delete ds;
}
@@ -113,10 +112,10 @@ void PentagramMenuGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /
#endif
// surf->Fill32(0xFFDCB95C, 18, 0, 90, 400);
- surf->Blit(navbarImage, 0, 0, navbarImage->width, navbarImage->height, 9, 0);
+ surf->Blit(_navbarImage, 0, 0, _navbarImage->width, _navbarImage->height, 9, 0);
// surf->Fill32(0xFFC11515, 200, 6, 340, 36);
- surf->Blit(titleImage, 0, 0, titleImage->width, titleImage->height, 200, 6);
+ surf->Blit(_titleImage, 0, 0, _titleImage->width, _titleImage->height, 200, 6);
}
void PentagramMenuGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) {
@@ -134,7 +133,7 @@ void PentagramMenuGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bo
if (g->IsOfType<GameWidget>()) {
surf->SetClippingRect(game_clip_rect);
- g->Move(150, 50 + 114 * g->GetIndex() + gameScrollPos);
+ g->Move(150, 50 + 114 * g->GetIndex() + _gameScrollPos);
}
g->Paint(surf, lerp_factor, scaled);
@@ -188,19 +187,19 @@ void PentagramMenuGump::ChildNotify(Gump *child, uint32 message) {
}
void PentagramMenuGump::run() {
- int oldpos = gameScrollPos;
+ int oldpos = _gameScrollPos;
ModalGump::run();
- if (gameScrollPos != gameScrollTarget) {
- int diff = gameScrollTarget - gameScrollPos;
+ if (_gameScrollPos != _gameScrollTarget) {
+ int diff = _gameScrollTarget - _gameScrollPos;
if (diff < 20 && diff > -20) {
- gameScrollPos = gameScrollTarget;
+ _gameScrollPos = _gameScrollTarget;
} else {
- gameScrollPos += diff / 3;
+ _gameScrollPos += diff / 3;
}
}
- gameScrollLastDelta = gameScrollPos - oldpos;
+ _gameScrollLastDelta = _gameScrollPos - oldpos;
}
@@ -213,13 +212,13 @@ bool PentagramMenuGump::OnKeyDown(int key, int mod) {
delta = 114;
}
- if (delta && gamecount > 3) {
- gameScrollTarget += delta;
+ if (delta && _gameCount > 3) {
+ _gameScrollTarget += delta;
- if (gameScrollTarget > 0)
- gameScrollTarget = 0;
- if (gameScrollTarget < -114 * (gamecount - 3))
- gameScrollTarget = -114 * (gamecount - 3);
+ if (_gameScrollTarget > 0)
+ _gameScrollTarget = 0;
+ if (_gameScrollTarget < -114 * (_gameCount - 3))
+ _gameScrollTarget = -114 * (_gameCount - 3);
return true;
}
diff --git a/engines/ultima/ultima8/gumps/pentagram_menu_gump.h b/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
index 733205d..98ebbfd 100644
--- a/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
+++ b/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
@@ -35,16 +35,16 @@ struct Texture;
class PentagramMenuGump : public ModalGump {
class PentagramMenuCallbackProcess : public Process {
- Std::string game;
+ Std::string _game;
public:
- PentagramMenuCallbackProcess(ObjId id, Std::string game_) : Process(id), game(game_) {
+ PentagramMenuCallbackProcess(ObjId id, const Std::string &game) : Process(id), _game(game) {
flags |= PROC_RUNPAUSED;
}
void run() override {
pout << "Gump returned: " << result << Std::endl;
PentagramMenuGump *menu = p_dynamic_cast<PentagramMenuGump *>(ObjectManager::get_instance()->getObject(getItemNum()));
- if (menu) menu->ProcessCallback(game, result);
+ if (menu) menu->ProcessCallback(_game, result);
terminate();
}
};
@@ -82,27 +82,25 @@ public:
#endif
Texture *getCovers() const {
- return coversImage;
+ return _coversImage;
}
Texture *getFlags() const {
- return flagsImage;
+ return _flagsImage;
}
private:
+ int _gameScrollPos;
+ int _gameScrollTarget;
+ int _gameScrollLastDelta;
- int gameScrollPos;
- int gameScrollTarget;
- int gameScrollLastDelta;
+ int _gameCount;
- int gamecount;
-
- Texture *titleImage;
- Texture *navbarImage;
- Texture *coversImage;
- Texture *flagsImage;
+ Texture *_titleImage;
+ Texture *_navbarImage;
+ Texture *_coversImage;
+ Texture *_flagsImage;
void ProcessCallback(Std::string gamename, int message);
-
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/quit_gump.cpp b/engines/ultima/ultima8/gumps/quit_gump.cpp
index e5a27e1..e1f874c 100644
--- a/engines/ultima/ultima8/gumps/quit_gump.cpp
+++ b/engines/ultima/ultima8/gumps/quit_gump.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/gumps/quit_gump.h"
-
#include "ultima/ultima8/games/game_data.h"
#include "ultima/ultima8/graphics/gump_shape_archive.h"
#include "ultima/ultima8/graphics/shape.h"
@@ -31,7 +30,6 @@
#include "ultima/ultima8/gumps/desktop_gump.h"
#include "ultima/ultima8/gumps/widgets/button_widget.h"
#include "ultima/ultima8/gumps/widgets/text_widget.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -86,7 +84,7 @@ void QuitGump::InitGump(Gump *newparent, bool take_focus) {
widget = new ButtonWidget(0, 0, yesbutton_up, yesbutton_down);
widget->InitGump(this);
widget->setRelativePosition(TOP_LEFT, 16, 38);
- yesWidget = widget->getObjId();
+ _yesWidget = widget->getObjId();
FrameID nobutton_up(GameData::GUMPS, noShapeId, 0);
FrameID nobutton_down(GameData::GUMPS, noShapeId, 1);
@@ -96,7 +94,7 @@ void QuitGump::InitGump(Gump *newparent, bool take_focus) {
widget = new ButtonWidget(0, 0, nobutton_up, nobutton_down);
widget->InitGump(this);
widget->setRelativePosition(TOP_RIGHT, -16, 38);
- noWidget = widget->getObjId();
+ _noWidget = widget->getObjId();
}
@@ -120,9 +118,9 @@ bool QuitGump::OnKeyDown(int key, int mod) {
void QuitGump::ChildNotify(Gump *child, uint32 message) {
ObjId cid = child->getObjId();
if (message == ButtonWidget::BUTTON_CLICK) {
- if (cid == yesWidget) {
+ if (cid == _yesWidget) {
Ultima8Engine::get_instance()->ForceQuit();
- } else if (cid == noWidget) {
+ } else if (cid == _noWidget) {
Close();
}
}
diff --git a/engines/ultima/ultima8/gumps/quit_gump.h b/engines/ultima/ultima8/gumps/quit_gump.h
index 850be4b..eb23f3e 100644
--- a/engines/ultima/ultima8/gumps/quit_gump.h
+++ b/engines/ultima/ultima8/gumps/quit_gump.h
@@ -34,7 +34,7 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
QuitGump();
- ~QuitGump(void) override;
+ ~QuitGump() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
@@ -51,7 +51,7 @@ public:
bool loadData(IDataSource *ids);
protected:
void saveData(ODataSource *ods) override;
- ObjId yesWidget, noWidget;
+ ObjId _yesWidget, _noWidget;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/readable_gump.cpp b/engines/ultima/ultima8/gumps/readable_gump.cpp
index b8fff4f..b1f4aab 100644
--- a/engines/ultima/ultima8/gumps/readable_gump.cpp
+++ b/engines/ultima/ultima8/gumps/readable_gump.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/gumps/readable_gump.h"
-
#include "ultima/ultima8/gumps/widgets/text_widget.h"
#include "ultima/ultima8/games/game_data.h"
#include "ultima/ultima8/graphics/shape.h"
@@ -35,7 +34,6 @@
#include "ultima/ultima8/kernel/core_app.h"
#include "ultima/ultima8/games/game_info.h"
#include "ultima/ultima8/misc/util.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -51,8 +49,8 @@ ReadableGump::ReadableGump()
}
-ReadableGump::ReadableGump(ObjId owner_, uint16 shape_, int font, Std::string msg) :
- ModalGump(0, 0, 100, 100, owner_), shapenum(shape_), fontnum(font), text(msg) {
+ReadableGump::ReadableGump(ObjId owner, uint16 shape, int font, const Std::string &msg) :
+ ModalGump(0, 0, 100, 100, owner), _shapeNum(shape), _fontNum(font), _text(msg) {
}
ReadableGump::~ReadableGump(void) {
@@ -61,7 +59,7 @@ ReadableGump::~ReadableGump(void) {
void ReadableGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
- Shape *shape_ = GameData::get_instance()->getGumps()->getShape(shapenum);
+ Shape *shape_ = GameData::get_instance()->getGumps()->getShape(_shapeNum);
SetShape(shape_, 0);
@@ -75,10 +73,10 @@ void ReadableGump::InitGump(Gump *newparent, bool take_focus) {
GameInfo::GAMELANG_JAPANESE) {
// Japanese subtitles
Std::string::size_type pos;
- pos = text.find('%');
+ pos = _text.find('%');
if (pos != Std::string::npos) {
- Std::string jpsub = text.substr(pos + 1);
- text = text.substr(0, pos);
+ Std::string jpsub = _text.substr(pos + 1);
+ _text = _text.substr(0, pos);
Gump *subwidget = new TextWidget(0, 0, jpsub, true, jpsub_font, 0, 0, Font::TEXT_CENTER);
subwidget->InitGump(this);
@@ -86,7 +84,7 @@ void ReadableGump::InitGump(Gump *newparent, bool take_focus) {
}
}
- Gump *widget = new TextWidget(0, 0, text, true, fontnum, _dims.w - 16, 0, Font::TEXT_CENTER);
+ Gump *widget = new TextWidget(0, 0, _text, true, _fontNum, _dims.w - 16, 0, Font::TEXT_CENTER);
widget->InitGump(this);
widget->setRelativePosition(CENTER);
}
diff --git a/engines/ultima/ultima8/gumps/readable_gump.h b/engines/ultima/ultima8/gumps/readable_gump.h
index 459a1a3..22aed69 100644
--- a/engines/ultima/ultima8/gumps/readable_gump.h
+++ b/engines/ultima/ultima8/gumps/readable_gump.h
@@ -31,14 +31,14 @@ namespace Ultima {
namespace Ultima8 {
class ReadableGump : public ModalGump {
- uint16 shapenum;
- int fontnum;
- Std::string text;
+ uint16 _shapeNum;
+ int _fontNum;
+ Std::string _text;
public:
ENABLE_RUNTIME_CLASSTYPE()
ReadableGump();
- ReadableGump(ObjId owner, uint16 shape, int font, Std::string msg);
+ ReadableGump(ObjId owner, uint16 shape, int font, const Std::string &msg);
~ReadableGump() override;
// Close on mouse click on key press
diff --git a/engines/ultima/ultima8/gumps/resizable_gump.cpp b/engines/ultima/ultima8/gumps/resizable_gump.cpp
index cfcd703..27687f2 100644
--- a/engines/ultima/ultima8/gumps/resizable_gump.cpp
+++ b/engines/ultima/ultima8/gumps/resizable_gump.cpp
@@ -26,7 +26,7 @@
namespace Ultima {
namespace Ultima8 {
-ResizableGump::ResizableGump(int X, int Y, int Width, int Height) : Gump(X, Y, Width, Height) {
+ResizableGump::ResizableGump(int x, int y, int width, int height) : Gump(x, y, width, height) {
}
ResizableGump::~ResizableGump() {
diff --git a/engines/ultima/ultima8/gumps/scaler_gump.h b/engines/ultima/ultima8/gumps/scaler_gump.h
index 2d3d35e..2c7ea6b 100644
--- a/engines/ultima/ultima8/gumps/scaler_gump.h
+++ b/engines/ultima/ultima8/gumps/scaler_gump.h
@@ -47,7 +47,7 @@ public:
//! \param sheight1 height before scaling (usually game-height)
//! \param scaler1 scaler to use
ScalerGump(int32 x, int32 y, int32 width, int32 height);
- ~ScalerGump(void) override;
+ ~ScalerGump() override;
void Paint(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
void RenderSurfaceChanged() override;
diff --git a/engines/ultima/ultima8/gumps/scroll_gump.cpp b/engines/ultima/ultima8/gumps/scroll_gump.cpp
index 2ae0654..c27ff1d 100644
--- a/engines/ultima/ultima8/gumps/scroll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/scroll_gump.cpp
@@ -31,7 +31,6 @@
#include "ultima/ultima8/gumps/gump_notify_process.h"
#include "ultima/ultima8/world/item.h"
#include "ultima/ultima8/world/get_object.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -48,7 +47,7 @@ ScrollGump::ScrollGump()
}
ScrollGump::ScrollGump(ObjId owner_, Std::string msg) :
- ModalGump(0, 0, 100, 100, owner_), text(msg) {
+ ModalGump(0, 0, 100, 100, owner_), _text(msg) {
}
ScrollGump::~ScrollGump(void) {
@@ -58,11 +57,11 @@ void ScrollGump::InitGump(Gump *newparent, bool take_focus) {
ModalGump::InitGump(newparent, take_focus);
// Create the TextWidget
- Gump *widget = new TextWidget(22, 29, text, true, 9, 204, 115); //!! constants
+ Gump *widget = new TextWidget(22, 29, _text, true, 9, 204, 115); //!! constants
widget->InitGump(this);
- textwidget = widget->getObjId();
+ _textWidget = widget->getObjId();
- text.clear(); // no longer need this
+ _text.clear(); // no longer need this
Shape *shape_ = GameData::get_instance()->getGumps()->getShape(19);
@@ -76,7 +75,7 @@ void ScrollGump::InitGump(Gump *newparent, bool take_focus) {
}
void ScrollGump::NextText() {
- TextWidget *widget = p_dynamic_cast<TextWidget *>(getGump(textwidget));
+ TextWidget *widget = p_dynamic_cast<TextWidget *>(getGump(_textWidget));
assert(widget);
if (!widget->setupNextText()) {
Close();
@@ -84,7 +83,7 @@ void ScrollGump::NextText() {
}
void ScrollGump::OnMouseClick(int button, int32 mx, int32 my) {
- // Scroll to next text, if possible
+ // Scroll to next _text, if possible
NextText();
}
diff --git a/engines/ultima/ultima8/gumps/scroll_gump.h b/engines/ultima/ultima8/gumps/scroll_gump.h
index 30f4365..20f11be 100644
--- a/engines/ultima/ultima8/gumps/scroll_gump.h
+++ b/engines/ultima/ultima8/gumps/scroll_gump.h
@@ -31,8 +31,8 @@ namespace Ultima {
namespace Ultima8 {
class ScrollGump : public ModalGump {
- Std::string text;
- ObjId textwidget;
+ Std::string _text;
+ ObjId _textWidget;
public:
ENABLE_RUNTIME_CLASSTYPE()
diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.h b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
index 409ae4e..fc1d20e 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.h
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
@@ -42,7 +42,7 @@ public:
ShapeViewerGump(int width, int height,
Std::vector<Std::pair<Std::string, ShapeArchive *> > &flexes,
uint32 flags = 0, int32 layer = LAYER_MODAL);
- ~ShapeViewerGump(void) override;
+ ~ShapeViewerGump() override;
void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
diff --git a/engines/ultima/ultima8/gumps/slider_gump.cpp b/engines/ultima/ultima8/gumps/slider_gump.cpp
index b8bcf00..fa11eea 100644
--- a/engines/ultima/ultima8/gumps/slider_gump.cpp
+++ b/engines/ultima/ultima8/gumps/slider_gump.cpp
@@ -22,7 +22,6 @@
#include "ultima/ultima8/misc/pent_include.h"
#include "ultima/ultima8/gumps/slider_gump.h"
-
#include "ultima/ultima8/games/game_data.h"
#include "ultima/ultima8/graphics/shape_frame.h"
#include "ultima/ultima8/graphics/gump_shape_archive.h"
@@ -35,7 +34,6 @@
#include "ultima/ultima8/usecode/uc_process.h"
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/ultima8.h"
-
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -45,15 +43,15 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(SliderGump, ModalGump)
SliderGump::SliderGump() : ModalGump() {
- renderedtext = 0;
+ _renderedText = 0;
}
-SliderGump::SliderGump(int x_, int y_, int16 min_, int16 max_,
- int16 value_, int16 delta_)
- : ModalGump(x_, y_, 5, 5), min(min_), max(max_), delta(delta_), value(value_) {
- usecodeNotifyPID = 0;
- renderedtext = 0;
+SliderGump::SliderGump(int x, int y, int16 min, int16 max,
+ int16 value_, int16 delta)
+ : ModalGump(x, y, 5, 5), _min(min), _max(max), _delta(delta), _value(value_) {
+ _usecodeNotifyPID = 0;
+ _renderedText = 0;
}
SliderGump::~SliderGump() {
@@ -87,14 +85,14 @@ static const int RIGHT_INDEX = 3;
static const int SLIDER_INDEX = 4;
int SliderGump::getSliderPos() {
- return sliderminx + (value - min) * (slidermaxx - sliderminx) / (max - min);
+ return sliderminx + (_value - _min) * (slidermaxx - sliderminx) / (_max - _min);
}
void SliderGump::setValueFromSlider(int sliderx) {
- int val = (sliderx - sliderminx) * (max - min) / (slidermaxx - sliderminx) + min;
- if (val < min) val = min;
- if (val > max) val = max;
- value = min + delta * (static_cast<int16>(val / delta));
+ int val = (sliderx - sliderminx) * (_max - _min) / (slidermaxx - sliderminx) + _min;
+ if (val < _min) val = _min;
+ if (val > _max) val = _max;
+ _value = _min + _delta * (static_cast<int16>(val / _delta));
}
void SliderGump::setSliderPos() {
@@ -104,19 +102,19 @@ void SliderGump::setSliderPos() {
}
void SliderGump::drawText(RenderSurface *surf) {
- if (!renderedtext || value != renderedvalue) {
+ if (!_renderedText || _value != _renderedValue) {
Font *font;
font = FontManager::get_instance()->getGameFont(labelfont);
char buf[10]; // more than enough for a int16
- sprintf(buf, "%d", value);
+ sprintf(buf, "%d", _value);
unsigned int remaining;
- delete renderedtext;
- renderedtext = font->renderText(buf, remaining);
- renderedvalue = value;
+ delete _renderedText;
+ _renderedText = font->renderText(buf, remaining);
+ _renderedValue = _value;
}
- renderedtext->draw(surf, labelx, labely);
+ _renderedText->draw(surf, labelx, labely);
}
void SliderGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
@@ -175,13 +173,13 @@ void SliderGump::ChildNotify(Gump *child, uint32 message) {
Close();
break;
case LEFT_INDEX:
- value -= delta;
- if (value < min) value = min;
+ _value -= _delta;
+ if (_value < _min) _value = _min;
setSliderPos();
break;
case RIGHT_INDEX:
- value += delta;
- if (value > max) value = max;
+ _value += _delta;
+ if (_value > _max) _value = _max;
setSliderPos();
break;
}
@@ -190,13 +188,13 @@ void SliderGump::ChildNotify(Gump *child, uint32 message) {
void SliderGump::Close(bool no_del) {
- _processResult = value;
+ _processResult = _value;
- if (usecodeNotifyPID) {
- UCProcess *ucp = p_dynamic_cast<UCProcess *>(Kernel::get_instance()->getProcess(usecodeNotifyPID));
+ if (_usecodeNotifyPID) {
+ UCProcess *ucp = p_dynamic_cast<UCProcess *>(Kernel::get_instance()->getProcess(_usecodeNotifyPID));
assert(ucp);
- ucp->setReturnValue(value);
- ucp->wakeUp(value);
+ ucp->setReturnValue(_value);
+ ucp->wakeUp(_value);
}
ModalGump::Close(no_del);
@@ -227,13 +225,13 @@ void SliderGump::StopDraggingChild(Gump *gump) {
bool SliderGump::OnKeyDown(int key, int mod) {
switch (key) {
case Common::KEYCODE_LEFT:
- value -= delta;
- if (value < min) value = min;
+ _value -= _delta;
+ if (_value < _min) _value = _min;
setSliderPos();
break;
case Common::KEYCODE_RIGHT:
- value += delta;
- if (value > max) value = max;
+ _value += _delta;
+ if (_value > _max) _value = _max;
setSliderPos();
break;
case Common::KEYCODE_RETURN:
@@ -248,7 +246,7 @@ bool SliderGump::OnKeyDown(int key, int mod) {
void SliderGump::setUsecodeNotify(UCProcess *ucp) {
assert(ucp);
- usecodeNotifyPID = ucp->getPid();
+ _usecodeNotifyPID = ucp->getPid();
}
void SliderGump::saveData(ODataSource *ods) {
diff --git a/engines/ultima/ultima8/gumps/slider_gump.h b/engines/ultima/ultima8/gumps/slider_gump.h
index 5761d5c..2c15a6b 100644
--- a/engines/ultima/ultima8/gumps/slider_gump.h
+++ b/engines/ultima/ultima8/gumps/slider_gump.h
@@ -39,7 +39,7 @@ public:
SliderGump();
SliderGump(int x, int y, int16 min, int16 max,
int16 value, int16 delta = 1);
- ~SliderGump(void) override;
+ ~SliderGump() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
@@ -59,15 +59,15 @@ public:
protected:
void saveData(ODataSource *ods) override;
- int16 min;
- int16 max;
- int16 delta;
- int16 value;
+ int16 _min;
+ int16 _max;
+ int16 _delta;
+ int16 _value;
- uint16 usecodeNotifyPID;
+ uint16 _usecodeNotifyPID;
- int16 renderedvalue;
- RenderedText *renderedtext;
+ int16 _renderedValue;
+ RenderedText *_renderedText;
int getSliderPos();
void setSliderPos();
diff --git a/engines/ultima/ultima8/gumps/target_gump.cpp b/engines/ultima/ultima8/gumps/target_gump.cpp
index 027a19d..285291e 100644
--- a/engines/ultima/ultima8/gumps/target_gump.cpp
+++ b/engines/ultima/ultima8/gumps/target_gump.cpp
@@ -36,13 +36,13 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(TargetGump, ModalGump)
-TargetGump::TargetGump() : ModalGump(), target_tracing(false) {
+TargetGump::TargetGump() : ModalGump(), _targetTracing(false) {
}
TargetGump::TargetGump(int x_, int y_)
- : ModalGump(x_, y_, 0, 0), target_tracing(false) {
+ : ModalGump(x_, y_, 0, 0), _targetTracing(false) {
}
@@ -75,13 +75,13 @@ void TargetGump::Close(bool no_del) {
bool TargetGump::PointOnGump(int mx, int my) {
// HACK alert: if we're currently tracing from TargetGump::OnMouseUp,
// then we do NOT want to intercept the trace
- if (target_tracing) return false;
+ if (_targetTracing) return false;
return ModalGump::PointOnGump(mx, my);
}
void TargetGump::OnMouseUp(int button, int32 mx, int32 my) {
- target_tracing = true;
+ _targetTracing = true;
_parent->GumpToScreenSpace(mx, my);
@@ -98,7 +98,7 @@ void TargetGump::OnMouseUp(int button, int32 mx, int32 my) {
Close();
}
- target_tracing = false;
+ _targetTracing = false;
}
uint32 TargetGump::I_target(const uint8 * /*args*/, unsigned int /*argsize*/) {
diff --git a/engines/ultima/ultima8/gumps/target_gump.h b/engines/ultima/ultima8/gumps/target_gump.h
index 5127093..865ab91 100644
--- a/engines/ultima/ultima8/gumps/target_gump.h
+++ b/engines/ultima/ultima8/gumps/target_gump.h
@@ -39,7 +39,7 @@ public:
TargetGump();
TargetGump(int x, int y);
- ~TargetGump(void) override;
+ ~TargetGump() override;
bool PointOnGump(int mx, int my) override;
void InitGump(Gump *newparent, bool take_focus = true) override;
@@ -54,7 +54,7 @@ protected:
void saveData(ODataSource *ods) override;
private:
- bool target_tracing;
+ bool _targetTracing;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
index 2e8f45b..491f76d 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
@@ -43,10 +43,10 @@ ButtonWidget::ButtonWidget()
: Gump() {
}
-ButtonWidget::ButtonWidget(int X, int Y, Std::string txt, bool gamefont,
+ButtonWidget::ButtonWidget(int x, int y, Std::string txt, bool gamefont,
int font, uint32 mouseOverBlendCol_,
int w, int h, int32 layer_) :
- Gump(X, Y, w, h, 0, 0, layer_), shape_up(0), shape_down(0),
+ Gump(x, y, w, h, 0, 0, layer_), shape_up(0), shape_down(0),
mouseOver(false), origw(w), origh(h) {
TextWidget *widget = new TextWidget(0, 0, txt, gamefont, font, w, h);
textwidget = widget->getObjId();
@@ -54,9 +54,9 @@ ButtonWidget::ButtonWidget(int X, int Y, Std::string txt, bool gamefont,
mouseOver = (mouseOverBlendCol != 0);
}
-ButtonWidget::ButtonWidget(int X, int Y, FrameID frame_up, FrameID frame_down,
+ButtonWidget::ButtonWidget(int x, int y, FrameID frame_up, FrameID frame_down,
bool _mouseOver, int32 layer_)
- : Gump(X, Y, 5, 5, 0, 0, layer_), textwidget(0), mouseOver(_mouseOver) {
+ : Gump(x, y, 5, 5, 0, 0, layer_), textwidget(0), mouseOver(_mouseOver) {
shape_up = GameData::get_instance()->getShape(frame_up);
shape_down = GameData::get_instance()->getShape(frame_down);
_frameNum_up = frame_up._frameNum;
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.h b/engines/ultima/ultima8/gumps/widgets/button_widget.h
index a518b19..be62026 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.h
@@ -36,12 +36,12 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
ButtonWidget();
- ButtonWidget(int X, int Y, Std::string txt, bool gamefont, int font,
+ ButtonWidget(int x, int y, Std::string txt, bool gamefont, int font,
uint32 mouseOverBlendCol = 0, int width = 0, int height = 0,
int32 layer = LAYER_NORMAL);
- ButtonWidget(int X, int Y, FrameID frame_up, FrameID frame_down,
+ ButtonWidget(int x, int y, FrameID frame_up, FrameID frame_down,
bool mouseOver = false, int32 layer = LAYER_NORMAL);
- ~ButtonWidget(void) override;
+ ~ButtonWidget() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
uint16 TraceObjId(int32 mx, int32 my) override;
diff --git a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
index de3e7cb..656f42e 100644
--- a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
@@ -38,9 +38,9 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(EditWidget, Gump)
-EditWidget::EditWidget(int X, int Y, Std::string txt, bool gamefont_, int font,
+EditWidget::EditWidget(int x, int y, Std::string txt, bool gamefont_, int font,
int w, int h, unsigned int maxlength_, bool multiline_)
- : Gump(X, Y, w, h), text(txt), gamefont(gamefont_), fontnum(font),
+ : Gump(x, y, w, h), text(txt), gamefont(gamefont_), fontnum(font),
maxlength(maxlength_), multiline(multiline_),
cursor_changed(0), cursor_visible(true), cached_text(0) {
cursor = text.size();
diff --git a/engines/ultima/ultima8/gumps/widgets/edit_widget.h b/engines/ultima/ultima8/gumps/widgets/edit_widget.h
index a0be97f..540e529 100644
--- a/engines/ultima/ultima8/gumps/widgets/edit_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/edit_widget.h
@@ -41,10 +41,10 @@ class EditWidget : public Gump {
public:
ENABLE_RUNTIME_CLASSTYPE()
- EditWidget(int X, int Y, Std::string txt, bool gamefont, int fontnum,
+ EditWidget(int x, int y, Std::string txt, bool gamefont, int fontnum,
int width, int height, unsigned int maxlength = 0,
bool multiline = false);
- ~EditWidget(void) override;
+ ~EditWidget() override;
void InitGump(Gump *newparent, bool take_focus = true) override;
diff --git a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp b/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
index d72c2bc..6e95af7 100644
--- a/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/game_widget.cpp
@@ -36,8 +36,8 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(GameWidget, Gump)
-GameWidget::GameWidget(int X, int Y, istring &game)
- : Gump(X, Y, 443, 109), highlight(false) {
+GameWidget::GameWidget(int x, int y, istring &game)
+ : Gump(x, y, 443, 109), highlight(false) {
info = Ultima8Engine::get_instance()->getGameInfo(game);
assert(info);
}
diff --git a/engines/ultima/ultima8/gumps/widgets/game_widget.h b/engines/ultima/ultima8/gumps/widgets/game_widget.h
index d34e72b..43e5bd1 100644
--- a/engines/ultima/ultima8/gumps/widgets/game_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/game_widget.h
@@ -36,7 +36,7 @@ public:
// p_dynamic_class stuff
ENABLE_RUNTIME_CLASSTYPE()
- GameWidget(int X, int Y, istring &game);
+ GameWidget(int x, int y, istring &game);
~GameWidget() override;
istring getGameName();
diff --git a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
index 9451940..d1f28b9 100644
--- a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
@@ -43,9 +43,9 @@ TextWidget::TextWidget() : Gump(), gamefont(false), fontnum(0), blendColour(0),
cached_text(0), textalign(Font::TEXT_LEFT) {
}
-TextWidget::TextWidget(int X, int Y, Std::string txt, bool gamefont_, int font,
+TextWidget::TextWidget(int x, int y, Std::string txt, bool gamefont_, int font,
int w, int h, Font::TextAlign align) :
- Gump(X, Y, w, h), text(txt), gamefont(gamefont_), fontnum(font),
+ Gump(x, y, w, h), text(txt), gamefont(gamefont_), fontnum(font),
blendColour(0), current_start(0), current_end(0),
targetwidth(w), targetheight(h), cached_text(0), textalign(align) {
}
diff --git a/engines/ultima/ultima8/gumps/widgets/text_widget.h b/engines/ultima/ultima8/gumps/widgets/text_widget.h
index 6509a1b..ec3dc89 100644
--- a/engines/ultima/ultima8/gumps/widgets/text_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/text_widget.h
@@ -55,10 +55,10 @@ public:
ENABLE_RUNTIME_CLASSTYPE()
TextWidget();
- TextWidget(int X, int Y, Std::string txt, bool gamefont, int fontnum,
+ TextWidget(int x, int y, Std::string txt, bool gamefont, int fontnum,
int width = 0, int height = 0,
Font::TextAlign align = Font::TEXT_LEFT);
- ~TextWidget(void) override;
+ ~TextWidget() override;
// Init the gump, call after construction
void InitGump(Gump *newparent, bool take_focus = true) override;
Commit: 17c6ce410287ff8c60a8277b4a232cb8bda5c41c
https://github.com/scummvm/scummvm/commit/17c6ce410287ff8c60a8277b4a232cb8bda5c41c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-15T21:39:28-08:00
Commit Message:
ULTIMA8: Renaming kernel class fields
Changed paths:
engines/ultima/ultima8/audio/audio_process.cpp
engines/ultima/ultima8/audio/music_process.cpp
engines/ultima/ultima8/gumps/gump_notify_process.cpp
engines/ultima/ultima8/gumps/pentagram_menu_gump.h
engines/ultima/ultima8/kernel/core_app.cpp
engines/ultima/ultima8/kernel/core_app.h
engines/ultima/ultima8/kernel/delay_process.cpp
engines/ultima/ultima8/kernel/delay_process.h
engines/ultima/ultima8/kernel/joystick.cpp
engines/ultima/ultima8/kernel/joystick.h
engines/ultima/ultima8/kernel/kernel.cpp
engines/ultima/ultima8/kernel/kernel.h
engines/ultima/ultima8/kernel/memory_manager.cpp
engines/ultima/ultima8/kernel/memory_manager.h
engines/ultima/ultima8/kernel/mouse.cpp
engines/ultima/ultima8/kernel/mouse.h
engines/ultima/ultima8/kernel/object.cpp
engines/ultima/ultima8/kernel/object.h
engines/ultima/ultima8/kernel/object_manager.cpp
engines/ultima/ultima8/kernel/object_manager.h
engines/ultima/ultima8/kernel/process.cpp
engines/ultima/ultima8/kernel/process.h
engines/ultima/ultima8/kernel/segmented_allocator.cpp
engines/ultima/ultima8/kernel/segmented_allocator.h
engines/ultima/ultima8/kernel/segmented_pool.cpp
engines/ultima/ultima8/kernel/segmented_pool.h
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/ultima8.h
engines/ultima/ultima8/usecode/uc_machine.cpp
engines/ultima/ultima8/usecode/uc_process.cpp
engines/ultima/ultima8/world/actors/actor.cpp
engines/ultima/ultima8/world/actors/actor_anim_process.cpp
engines/ultima/ultima8/world/actors/actor_anim_process.h
engines/ultima/ultima8/world/actors/actor_bark_notify_process.cpp
engines/ultima/ultima8/world/actors/ambush_process.cpp
engines/ultima/ultima8/world/actors/ambush_process.h
engines/ultima/ultima8/world/actors/avatar_death_process.cpp
engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
engines/ultima/ultima8/world/actors/clear_feign_death_process.cpp
engines/ultima/ultima8/world/actors/combat_process.cpp
engines/ultima/ultima8/world/actors/grant_peace_process.cpp
engines/ultima/ultima8/world/actors/heal_process.cpp
engines/ultima/ultima8/world/actors/loiter_process.cpp
engines/ultima/ultima8/world/actors/main_actor.cpp
engines/ultima/ultima8/world/actors/pathfinder_process.cpp
engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
engines/ultima/ultima8/world/actors/resurrection_process.cpp
engines/ultima/ultima8/world/actors/scheduler_process.cpp
engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
engines/ultima/ultima8/world/camera_process.cpp
engines/ultima/ultima8/world/container.cpp
engines/ultima/ultima8/world/create_item_process.cpp
engines/ultima/ultima8/world/destroy_item_process.cpp
engines/ultima/ultima8/world/fireball_process.cpp
engines/ultima/ultima8/world/gravity_process.cpp
engines/ultima/ultima8/world/gravity_process.h
engines/ultima/ultima8/world/item.cpp
engines/ultima/ultima8/world/item_factory.cpp
engines/ultima/ultima8/world/split_item_process.cpp
engines/ultima/ultima8/world/sprite_process.cpp
diff --git a/engines/ultima/ultima8/audio/audio_process.cpp b/engines/ultima/ultima8/audio/audio_process.cpp
index f648047..d9359a9 100644
--- a/engines/ultima/ultima8/audio/audio_process.cpp
+++ b/engines/ultima/ultima8/audio/audio_process.cpp
@@ -46,7 +46,7 @@ AudioProcess *AudioProcess::the_audio_process = 0;
AudioProcess::AudioProcess(void) : paused(0) {
the_audio_process = this;
- type = 1; // persistent
+ _type = 1; // persistent
}
AudioProcess::~AudioProcess(void) {
diff --git a/engines/ultima/ultima8/audio/music_process.cpp b/engines/ultima/ultima8/audio/music_process.cpp
index 6c82df9..91ea7eb 100644
--- a/engines/ultima/ultima8/audio/music_process.cpp
+++ b/engines/ultima/ultima8/audio/music_process.cpp
@@ -51,8 +51,8 @@ MusicProcess::MusicProcess(MidiPlayer *player) : _midiPlayer(player),
Std::memset(_songBranches, (byte)-1, 128 * sizeof(int));
the_music_process = this;
- flags |= PROC_RUNPAUSED;
- type = 1; // persistent
+ _flags |= PROC_RUNPAUSED;
+ _type = 1; // persistent
}
MusicProcess::~MusicProcess() {
diff --git a/engines/ultima/ultima8/gumps/gump_notify_process.cpp b/engines/ultima/ultima8/gumps/gump_notify_process.cpp
index 412646e..4381a8e 100644
--- a/engines/ultima/ultima8/gumps/gump_notify_process.cpp
+++ b/engines/ultima/ultima8/gumps/gump_notify_process.cpp
@@ -38,8 +38,8 @@ GumpNotifyProcess::GumpNotifyProcess()
}
GumpNotifyProcess::GumpNotifyProcess(uint16 it) : Process(it), _gump(0) {
- result = 0;
- type = 0x200; // CONSTANT!
+ _result = 0;
+ _type = 0x200; // CONSTANT!
}
GumpNotifyProcess::~GumpNotifyProcess(void) {
@@ -52,8 +52,8 @@ void GumpNotifyProcess::setGump(Gump *g) {
void GumpNotifyProcess::notifyClosing(int res) {
_gump = 0;
- result = res;
- if (!(flags & PROC_TERMINATED)) terminate();
+ _result = res;
+ if (!(_flags & PROC_TERMINATED)) terminate();
}
void GumpNotifyProcess::terminate() {
diff --git a/engines/ultima/ultima8/gumps/pentagram_menu_gump.h b/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
index 98ebbfd..88372bc 100644
--- a/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
+++ b/engines/ultima/ultima8/gumps/pentagram_menu_gump.h
@@ -38,13 +38,13 @@ class PentagramMenuGump : public ModalGump {
Std::string _game;
public:
PentagramMenuCallbackProcess(ObjId id, const Std::string &game) : Process(id), _game(game) {
- flags |= PROC_RUNPAUSED;
+ _flags |= PROC_RUNPAUSED;
}
void run() override {
- pout << "Gump returned: " << result << Std::endl;
+ pout << "Gump returned: " << _result << Std::endl;
PentagramMenuGump *menu = p_dynamic_cast<PentagramMenuGump *>(ObjectManager::get_instance()->getObject(getItemNum()));
- if (menu) menu->ProcessCallback(_game, result);
+ if (menu) menu->ProcessCallback(_game, _result);
terminate();
}
};
diff --git a/engines/ultima/ultima8/kernel/core_app.cpp b/engines/ultima/ultima8/kernel/core_app.cpp
index 0f00893..79648b1 100644
--- a/engines/ultima/ultima8/kernel/core_app.cpp
+++ b/engines/ultima/ultima8/kernel/core_app.cpp
@@ -39,28 +39,28 @@ using Std::string;
// p_dynamic_cast stuff
DEFINE_RUNTIME_CLASSTYPE_CODE_BASE_CLASS(CoreApp)
-CoreApp *CoreApp::application = 0;
+CoreApp *CoreApp::_application = 0;
CoreApp::CoreApp(const Ultima::UltimaGameDescription *gameDesc)
- : _gameDesc(gameDesc), isRunning(false), gameinfo(0), filesystem(0),
- configfileman(0), settingman(0), oHelp(false), oQuiet(false), oVQuiet(false) {
- application = this;
+ : _gameDesc(gameDesc), _isRunning(false), _gameInfo(0), _fileSystem(0),
+ _configFileMan(0), _settingMan(0), _oHelp(false), _oQuiet(false), _oVQuiet(false) {
+ _application = this;
_console = new Console();
}
CoreApp::~CoreApp() {
- for (GameMap::iterator i = games.begin(); i != games.end(); ++i)
+ for (GameMap::iterator i = _games.begin(); i != _games.end(); ++i)
delete i->_value;
- games.clear();
+ _games.clear();
- FORGET_OBJECT(filesystem);
- FORGET_OBJECT(settingman);
- FORGET_OBJECT(configfileman);
- FORGET_OBJECT(gameinfo);
+ FORGET_OBJECT(_fileSystem);
+ FORGET_OBJECT(_settingMan);
+ FORGET_OBJECT(_configFileMan);
+ FORGET_OBJECT(_gameInfo);
FORGET_OBJECT(_console);
- application = 0;
+ _application = 0;
}
void CoreApp::startup() {
@@ -70,17 +70,17 @@ void CoreApp::startup() {
// if we're spitting out help, we probably want to avoid having the
// other cruft dumped too...
- if (oHelp) {
- oQuiet = oVQuiet = true;
+ if (_oHelp) {
+ _oQuiet = _oVQuiet = true;
}
- if (oQuiet)
+ if (_oQuiet)
con->setMsgMask(static_cast<MsgMask>(MM_ALL & ~MM_INFO &
~MM_MINOR_WARN));
- if (oVQuiet)
+ if (_oVQuiet)
con->setMsgMask(static_cast<MsgMask>(MM_ALL & ~MM_INFO & ~MM_MINOR_WARN
& ~MM_MAJOR_WARN & ~MM_MINOR_ERR));
- if (oHelp) {
+ if (_oHelp) {
helpMe(); // Note: this is virtual
error("Startup failed");
}
@@ -92,22 +92,22 @@ void CoreApp::startup() {
}
void CoreApp::DeclareArgs() {
- parameters.declare("--game", &oGamename, "");
- parameters.declare("-h", &oHelp, true);
- parameters.declare("--help", &oHelp, true);
- parameters.declare("-q", &oQuiet, true);
- parameters.declare("-qq", &oVQuiet, true);
+ _parameters.declare("--game", &_oGameName, "");
+ _parameters.declare("-h", &_oHelp, true);
+ _parameters.declare("--help", &_oHelp, true);
+ _parameters.declare("-q", &_oQuiet, true);
+ _parameters.declare("-qq", &_oVQuiet, true);
}
void CoreApp::sysInit() {
- gameinfo = 0;
+ _gameInfo = 0;
- filesystem = new FileSystem;
+ _fileSystem = new FileSystem;
- configfileman = new ConfigFileManager();
- settingman = new SettingManager();
- settingman->setDomainName(SettingManager::DOM_GLOBAL, "pentagram");
- settingman->setCurrentDomain(SettingManager::DOM_GLOBAL);
+ _configFileMan = new ConfigFileManager();
+ _settingMan = new SettingManager();
+ _settingMan->setDomainName(SettingManager::DOM_GLOBAL, "pentagram");
+ _settingMan->setCurrentDomain(SettingManager::DOM_GLOBAL);
}
// load configuration files
@@ -117,10 +117,10 @@ void CoreApp::loadConfig() {
bool dataconf, homeconf;
// system-wide config, read-only
- dataconf = settingman->readConfigFile("@data/pentagram.ini", true);
+ dataconf = _settingMan->readConfigFile("@data/pentagram.ini", true);
// user config
- homeconf = settingman->readConfigFile("@home/pentagram.ini");
+ homeconf = _settingMan->readConfigFile("@home/pentagram.ini");
if (!homeconf && !dataconf) {
pout << "No configuration files found." << Std::endl;
@@ -134,9 +134,9 @@ void CoreApp::loadConfig() {
// load pentagram specific data path
Std::string data;
- if (settingman->get("data", data, SettingManager::DOM_GLOBAL)) {
+ if (_settingMan->get("data", data, SettingManager::DOM_GLOBAL)) {
pout << "Setting custom data path: " << data << Std::endl;
- bool ok = filesystem->AddVirtualPath("@data", data);
+ bool ok = _fileSystem->AddVirtualPath("@data", data);
if (!ok) {
perr << "Error opening data directory." << Std::endl;
}
@@ -145,7 +145,7 @@ void CoreApp::loadConfig() {
void CoreApp::setupGameList() {
Std::vector<istring> gamelist;
- gamelist = settingman->listGames();
+ gamelist = _settingMan->listGames();
con->Print(MM_INFO, "Scanning config file for games:\n");
Std::vector<istring>::iterator iter;
istring gamename;
@@ -159,7 +159,7 @@ void CoreApp::setupGameList() {
con->Printf(MM_INFO, "%s: ", game.c_str());
if (detected) {
// add game to games map
- games[game] = info;
+ _games[game] = info;
Std::string details = info->getPrintDetails();
con->Print(MM_INFO, details.c_str());
@@ -174,26 +174,26 @@ GameInfo *CoreApp::getDefaultGame() {
istring gamename;
Std::string defaultgame;
- bool defaultset = settingman->get("defaultgame", defaultgame,
+ bool defaultset = _settingMan->get("defaultgame", defaultgame,
SettingManager::DOM_GLOBAL);
- if (oGamename != "") {
+ if (_oGameName != "") {
// game specified on commandline
- gamename = oGamename;
+ gamename = _oGameName;
} else if (defaultset) {
// default game specified in config file
gamename = defaultgame;
- } else if (games.size() == 2) {// TODO - Do this in a better method
+ } else if (_games.size() == 2) {// TODO - Do this in a better method
// only one game in config file, so pick that
- for (GameMap::iterator i = games.begin(); i != games.end(); ++i) {
+ for (GameMap::iterator i = _games.begin(); i != _games.end(); ++i) {
if (i->_value->name != "pentagram")
gamename = i->_value->name;
}
- } else if (games.size() == 1) {
- gamename = games.begin()->_value->name;
+ } else if (_games.size() == 1) {
+ gamename = _games.begin()->_value->name;
} else {
perr << "Multiple games found in configuration, but no default "
@@ -221,7 +221,7 @@ bool CoreApp::setupGame(GameInfo *info) {
if (!info) return false;
assert(info->name != "");
- gameinfo = info;
+ _gameInfo = info;
pout << "Selected game: " << info->name << Std::endl;
pout << info->getPrintDetails() << Std::endl;
@@ -234,21 +234,21 @@ bool CoreApp::setupGame(GameInfo *info) {
void CoreApp::killGame() {
// Save the settings!
pout << "Saving settings" << Std::endl;
- settingman->write();
+ _settingMan->write();
- filesystem->RemoveVirtualPath("@game");
- filesystem->RemoveVirtualPath("@work");
- filesystem->RemoveVirtualPath("@save");
+ _fileSystem->RemoveVirtualPath("@game");
+ _fileSystem->RemoveVirtualPath("@work");
+ _fileSystem->RemoveVirtualPath("@save");
- configfileman->clearRoot("bindings");
- configfileman->clearRoot("language");
- configfileman->clearRoot("weapons");
- configfileman->clearRoot("armour");
- configfileman->clearRoot("monsters");
- configfileman->clearRoot("game");
- settingman->setCurrentDomain(SettingManager::DOM_GLOBAL);
+ _configFileMan->clearRoot("bindings");
+ _configFileMan->clearRoot("language");
+ _configFileMan->clearRoot("weapons");
+ _configFileMan->clearRoot("armour");
+ _configFileMan->clearRoot("monsters");
+ _configFileMan->clearRoot("game");
+ _settingMan->setCurrentDomain(SettingManager::DOM_GLOBAL);
- gameinfo = 0;
+ _gameInfo = 0;
}
@@ -300,24 +300,24 @@ bool CoreApp::getGameInfo(istring &game, GameInfo *ginfo) {
void CoreApp::setupGamePaths(GameInfo *ginfo) {
if (!ginfo || ginfo->name == "pentagram") {
- settingman->setCurrentDomain(SettingManager::DOM_GLOBAL);
+ _settingMan->setCurrentDomain(SettingManager::DOM_GLOBAL);
return;
}
istring game = ginfo->name;
- settingman->setDomainName(SettingManager::DOM_GAME, game);
- settingman->setCurrentDomain(SettingManager::DOM_GAME);
+ _settingMan->setDomainName(SettingManager::DOM_GAME, game);
+ _settingMan->setCurrentDomain(SettingManager::DOM_GAME);
// load main game data path
Std::string gpath;
- settingman->get("path", gpath, SettingManager::DOM_GAME);
- filesystem->AddVirtualPath("@game", gpath);
+ _settingMan->get("path", gpath, SettingManager::DOM_GAME);
+ _fileSystem->AddVirtualPath("@game", gpath);
// load work path. Default is @home/game-work
// where 'game' in the above is the specified 'game' loaded
Std::string work;
- if (!settingman->get("work", work, SettingManager::DOM_GAME))
+ if (!_settingMan->get("work", work, SettingManager::DOM_GAME))
work = "@home/" + game + "-work";
#if 0
@@ -326,28 +326,28 @@ void CoreApp::setupGamePaths(GameInfo *ginfo) {
// TODO: I don't like these being created here.
// I'd prefer them to be created when needed. (-wjp)
- filesystem->AddVirtualPath("@work", work, true);
+ _fileSystem->AddVirtualPath("@work", work, true);
con->Printf(MM_INFO, "U8 Workdir: %s\n", work.c_str()); //!!FIXME (u8)
- // make sure we've got a minimal sane filesystem under there...
- filesystem->MkDir("@work/usecode");
- filesystem->MkDir("@work/usecode/obj");
- filesystem->MkDir("@work/usecode/src");
- filesystem->MkDir("@work/usecode/asm");
+ // make sure we've got a minimal sane _fileSystem under there...
+ _fileSystem->MkDir("@work/usecode");
+ _fileSystem->MkDir("@work/usecode/obj");
+ _fileSystem->MkDir("@work/usecode/src");
+ _fileSystem->MkDir("@work/usecode/asm");
#endif
// load savegame path. Default is @home/game-save
Std::string save;
- if (!settingman->get("save", save, SettingManager::DOM_GAME))
+ if (!_settingMan->get("save", save, SettingManager::DOM_GAME))
save = "@home/" + game + "-save";
// force creation if it doesn't exist
- filesystem->AddVirtualPath("@save", save, true);
+ _fileSystem->AddVirtualPath("@save", save, true);
con->Printf(MM_INFO, "Savegame directory: %s\n", save.c_str());
}
void CoreApp::ParseArgs(const int argc_, const char *const *const argv_) {
- parameters.process(argc_, argv_);
+ _parameters.process(argc_, argv_);
}
void CoreApp::helpMe() {
@@ -359,9 +359,9 @@ void CoreApp::helpMe() {
GameInfo *CoreApp::getGameInfo(istring game) const {
GameMap::const_iterator i;
- i = games.find(game);
+ i = _games.find(game);
- if (i != games.end())
+ if (i != _games.end())
return i->_value;
else
return 0;
diff --git a/engines/ultima/ultima8/kernel/core_app.h b/engines/ultima/ultima8/kernel/core_app.h
index af6e01b..1c16eeb 100644
--- a/engines/ultima/ultima8/kernel/core_app.h
+++ b/engines/ultima/ultima8/kernel/core_app.h
@@ -52,7 +52,7 @@ public:
virtual ~CoreApp();
static CoreApp *get_instance() {
- return application;
+ return _application;
};
virtual void runGame() = 0;
@@ -62,7 +62,7 @@ public:
}
virtual void ForceQuit() {
- isRunning = false;
+ _isRunning = false;
};
//! Startup the application. This will prepare the application for run().
@@ -71,7 +71,7 @@ public:
//! Get current GameInfo struct
GameInfo *getGameInfo() const {
- return gameinfo;
+ return _gameInfo;
}
//! Get GameInfo for other configured game, or 0 for an invalid name.
@@ -79,14 +79,14 @@ public:
virtual void helpMe();
- bool help() const {
- return oHelp;
+ bool help() const {
+ return _oHelp;
};
- bool quiet() const {
- return oQuiet;
+ bool quiet() const {
+ return _oQuiet;
};
bool vquiet() const {
- return oVQuiet;
+ return _oVQuiet;
};
protected:
@@ -95,20 +95,20 @@ protected:
//! Should call parent class' DeclareArgs().
virtual void DeclareArgs();
- bool isRunning;
+ bool _isRunning;
typedef Std::map<Common::String, GameInfo *, Common::IgnoreCase_Hash> GameMap;
- GameMap games;
- GameInfo *gameinfo;
+ GameMap _games;
+ GameInfo *_gameInfo;
// minimal system
- FileSystem *filesystem;
- ConfigFileManager *configfileman;
- SettingManager *settingman;
+ FileSystem *_fileSystem;
+ ConfigFileManager *_configFileMan;
+ SettingManager *_settingMan;
- Args parameters;
+ Args _parameters;
- static CoreApp *application;
+ static CoreApp *_application;
private:
const Ultima::UltimaGameDescription *_gameDesc;
@@ -147,10 +147,10 @@ protected:
//! Specifically, @game and @work
void setupGamePaths(GameInfo *gameinfo);
- Std::string oGamename;
- bool oHelp;
- bool oQuiet;
- bool oVQuiet;
+ Std::string _oGameName;
+ bool _oHelp;
+ bool _oQuiet;
+ bool _oVQuiet;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/delay_process.cpp b/engines/ultima/ultima8/kernel/delay_process.cpp
index 946af38..64c015c 100644
--- a/engines/ultima/ultima8/kernel/delay_process.cpp
+++ b/engines/ultima/ultima8/kernel/delay_process.cpp
@@ -34,37 +34,34 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(DelayProcess, Process)
-DelayProcess::DelayProcess(int count_)
- : Process(), count(count_) {
-
+DelayProcess::DelayProcess(int count) : Process(), _count(count) {
}
DelayProcess::~DelayProcess() {
-
}
void DelayProcess::run() {
- if (--count == 0)
+ if (--_count == 0)
terminate();
}
void DelayProcess::dumpInfo() {
Process::dumpInfo();
- pout << "Frames left: " << count << Std::endl;
+ pout << "Frames left: " << _count << Std::endl;
}
bool DelayProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- count = static_cast<int>(ids->read4());
+ _count = static_cast<int>(ids->read4());
return true;
}
void DelayProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(static_cast<uint32>(count));
+ ods->write4(static_cast<uint32>(_count));
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/delay_process.h b/engines/ultima/ultima8/kernel/delay_process.h
index 8f8d598..049563c 100644
--- a/engines/ultima/ultima8/kernel/delay_process.h
+++ b/engines/ultima/ultima8/kernel/delay_process.h
@@ -48,7 +48,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- int count;
+ int _count;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/joystick.cpp b/engines/ultima/ultima8/kernel/joystick.cpp
index dda1c13..98758ef 100644
--- a/engines/ultima/ultima8/kernel/joystick.cpp
+++ b/engines/ultima/ultima8/kernel/joystick.cpp
@@ -81,19 +81,19 @@ void ShutdownJoystick() {
DEFINE_RUNTIME_CLASSTYPE_CODE(JoystickCursorProcess, Process)
JoystickCursorProcess::JoystickCursorProcess()
- : Process(), js(JOY1), x_axis(0), y_axis(1), ticks(0), accel(0) {
+ : Process(), _js(JOY1), _xAxis(0), _yAxis(1), _ticks(0), _accel(0) {
}
JoystickCursorProcess::JoystickCursorProcess(Joystick js_, int x_axis_, int y_axis_)
- : Process(), js(js_), x_axis(x_axis_), y_axis(y_axis_), ticks(0), accel(0) {
+ : Process(), _js(js_), _xAxis(x_axis_), _yAxis(y_axis_), _ticks(0), _accel(0) {
#ifdef TODO
flags |= PROC_RUNPAUSED;
type = 1;
- if (joy[js] && js < JOY_LAST) {
- int axes = SDL_JoystickNumAxes(joy[js]);
- if (x_axis >= axes && y_axis >= axes) {
- perr << "Failed to start JoystickCursorProcess: illegal axis for x (" << x_axis << ") or y (" << y_axis << ")" << Std::endl;
+ if (joy[_js] && _js < JOY_LAST) {
+ int axes = SDL_JoystickNumAxes(joy[_js]);
+ if (_xAxis >= axes && _yAxis >= axes) {
+ perr << "Failed to start JoystickCursorProcess: illegal axis for x (" << _xAxis << ") or y (" << _yAxis << ")" << Std::endl;
terminate();
}
} else {
@@ -113,18 +113,18 @@ void JoystickCursorProcess::run() {
int dx = 0, dy = 0;
int now = g_system->getMillis();
- if (joy[js] && ticks) {
- int tx = now - ticks;
- int r = 350 - accel * 30;
- int16 jx = SDL_JoystickGetAxis(joy[js], x_axis);
- int16 jy = SDL_JoystickGetAxis(joy[js], y_axis);
+ if (joy[_js] && _ticks) {
+ int tx = now - _ticks;
+ int r = 350 - _accel * 30;
+ int16 jx = SDL_JoystickGetAxis(joy[_js], _xAxis);
+ int16 jy = SDL_JoystickGetAxis(joy[_js], _yAxis);
if (jx > AXIS_TOLERANCE || jx < -AXIS_TOLERANCE)
dx = ((jx / 1000) * tx) / r;
if (jy > AXIS_TOLERANCE || jy < -AXIS_TOLERANCE)
dy = ((jy / 1000) * tx) / r;
}
- ticks = now;
+ _ticks = now;
if (dx || dy) {
int mx, my;
@@ -133,11 +133,11 @@ void JoystickCursorProcess::run() {
mx += dx;
my += dy;
app->setMouseCoords(mx, my);
- ++accel;
- if (accel > 10)
- accel = 10;
+ ++_accel;
+ if (_accel > 10)
+ _accel = 10;
} else {
- accel = 0;
+ _accel = 0;
}
#endif
}
diff --git a/engines/ultima/ultima8/kernel/joystick.h b/engines/ultima/ultima8/kernel/joystick.h
index 5e09612..492cb48 100644
--- a/engines/ultima/ultima8/kernel/joystick.h
+++ b/engines/ultima/ultima8/kernel/joystick.h
@@ -55,10 +55,10 @@ public:
protected:
void saveData(ODataSource *ods) override;
- Joystick js;
- int x_axis, y_axis;
- int ticks;
- int accel;
+ Joystick _js;
+ int _xAxis, _yAxis;
+ int _ticks;
+ int _accel;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/kernel.cpp b/engines/ultima/ultima8/kernel/kernel.cpp
index e506f3e..5e2d8a4 100644
--- a/engines/ultima/ultima8/kernel/kernel.cpp
+++ b/engines/ultima/ultima8/kernel/kernel.cpp
@@ -42,10 +42,10 @@ Kernel::Kernel() : loading(false) {
kernel = this;
pIDs = new idMan(1, 32766, 128);
current_process = processes.end();
- framenum = 0;
- paused = 0;
- runningprocess = 0;
- framebyframe = false;
+ _frameNum = 0;
+ _paused = 0;
+ _runningProcess = 0;
+ _frameByFrame = false;
}
Kernel::~Kernel() {
@@ -68,11 +68,11 @@ void Kernel::reset() {
pIDs->clearAll();
- paused = 0;
- runningprocess = 0;
+ _paused = 0;
+ _runningProcess = 0;
- // if we're in frame-by-frame mode, reset to a paused state
- if (framebyframe) paused = 1;
+ // if we're in frame-by-frame mode, reset to a _paused state
+ if (_frameByFrame) _paused = 1;
}
ProcId Kernel::assignPID(Process *proc) {
@@ -80,9 +80,9 @@ ProcId Kernel::assignPID(Process *proc) {
if (loading) return 0xFFFF;
// Get a pID
- proc->pid = pIDs->getNewID();
+ proc->_pid = pIDs->getNewID();
- return proc->pid;
+ return proc->_pid;
}
ProcId Kernel::addProcess(Process *proc) {
@@ -93,17 +93,17 @@ ProcId Kernel::addProcess(Process *proc) {
}
#endif
- assert(proc->pid != 0 && proc->pid != 0xFFFF);
+ assert(proc->_pid != 0 && proc->_pid != 0xFFFF);
#if 0
perr << "[Kernel] Adding process " << proc
- << ", pid = " << proc->pid << Std::endl;
+ << ", pid = " << proc->_pid << Std::endl;
#endif
// processes.push_back(proc);
// proc->active = true;
setNextProcess(proc);
- return proc->pid;
+ return proc->_pid;
}
ProcId Kernel::addProcessExec(Process *proc) {
@@ -114,22 +114,22 @@ ProcId Kernel::addProcessExec(Process *proc) {
}
#endif
- assert(proc->pid != 0 && proc->pid != 0xFFFF);
+ assert(proc->_pid != 0 && proc->_pid != 0xFFFF);
#if 0
perr << "[Kernel] Adding process " << proc
- << ", pid = " << proc->pid << Std::endl;
+ << ", pid = " << proc->_pid << Std::endl;
#endif
processes.push_back(proc);
- proc->flags |= Process::PROC_ACTIVE;
+ proc->_flags |= Process::PROC_ACTIVE;
- Process *oldrunning = runningprocess;
- runningprocess = proc;
+ Process *oldrunning = _runningProcess;
+ _runningProcess = proc;
proc->run();
- runningprocess = oldrunning;
+ _runningProcess = oldrunning;
- return proc->pid;
+ return proc->_pid;
}
void Kernel::removeProcess(Process *proc) {
@@ -142,14 +142,14 @@ void Kernel::removeProcess(Process *proc) {
for (ProcessIterator it = processes.begin(); it != processes.end(); ++it) {
if (*it == proc) {
- proc->flags &= ~Process::PROC_ACTIVE;
+ proc->_flags &= ~Process::PROC_ACTIVE;
perr << "[Kernel] Removing process " << proc << Std::endl;
processes.erase(it);
// Clear pid
- pIDs->clearID(proc->pid);
+ pIDs->clearID(proc->_pid);
return;
}
@@ -158,8 +158,8 @@ void Kernel::removeProcess(Process *proc) {
void Kernel::runProcesses() {
- if (!paused)
- framenum++;
+ if (!_paused)
+ _frameNum++;
if (processes.size() == 0) {
return;
@@ -174,27 +174,27 @@ void Kernel::runProcesses() {
while (current_process != processes.end()) {
Process *p = *current_process;
- if (!paused && ((p->flags & (Process::PROC_TERMINATED |
+ if (!_paused && ((p->_flags & (Process::PROC_TERMINATED |
Process::PROC_TERM_DEFERRED))
== Process::PROC_TERM_DEFERRED)) {
p->terminate();
}
if (!(p->is_terminated() || p->is_suspended()) &&
- (!paused || (p->flags & Process::PROC_RUNPAUSED))) {
- runningprocess = p;
+ (!_paused || (p->_flags & Process::PROC_RUNPAUSED))) {
+ _runningProcess = p;
p->run();
- if (!runningprocess)
+ if (!_runningProcess)
return; // If this happens then the list was reset so leave NOW!
- runningprocess = 0;
+ _runningProcess = 0;
}
- if (!paused && (p->flags & Process::PROC_TERMINATED)) {
+ if (!_paused && (p->_flags & Process::PROC_TERMINATED)) {
// process is killed, so remove it from the list
current_process = processes.erase(current_process);
// Clear pid
- pIDs->clearID(p->pid);
+ pIDs->clearID(p->_pid);
//! is this the right place to delete processes?
delete p;
@@ -202,13 +202,13 @@ void Kernel::runProcesses() {
++current_process;
}
- if (!paused && framebyframe) pause();
+ if (!_paused && _frameByFrame) pause();
}
void Kernel::setNextProcess(Process *proc) {
if (current_process != processes.end() && *current_process == proc) return;
- if (proc->flags & Process::PROC_ACTIVE) {
+ if (proc->_flags & Process::PROC_ACTIVE) {
for (ProcessIterator it = processes.begin();
it != processes.end(); ++it) {
if (*it == proc) {
@@ -217,7 +217,7 @@ void Kernel::setNextProcess(Process *proc) {
}
}
} else {
- proc->flags |= Process::PROC_ACTIVE;
+ proc->_flags |= Process::PROC_ACTIVE;
}
if (current_process == processes.end()) {
@@ -233,7 +233,7 @@ void Kernel::setNextProcess(Process *proc) {
Process *Kernel::getProcess(ProcId pid) {
for (ProcessIterator it = processes.begin(); it != processes.end(); ++it) {
Process *p = *it;
- if (p->pid == pid)
+ if (p->_pid == pid)
return p;
}
return 0;
@@ -278,7 +278,7 @@ void Kernel::ConCmd_listProcesses(const Console::ArgvType &argv) {
for (ProcessIterator it = kern->processes.begin();
it != kern->processes.end(); ++it) {
Process *p = *it;
- if (argv.size() == 1 || p->item_num == item)
+ if (argv.size() == 1 || p->_itemNum == item)
p->dumpInfo();
}
@@ -330,8 +330,8 @@ uint32 Kernel::getNumProcesses(ObjId objid, uint16 processtype) {
// Don't count us, we are not really here
if (p->is_terminated()) continue;
- if ((objid == 0 || objid == p->item_num) &&
- (processtype == 6 || processtype == p->type))
+ if ((objid == 0 || objid == p->_itemNum) &&
+ (processtype == 6 || processtype == p->_type))
count++;
}
@@ -345,8 +345,8 @@ Process *Kernel::findProcess(ObjId objid, uint16 processtype) {
// Don't count us, we are not really here
if (p->is_terminated()) continue;
- if ((objid == 0 || objid == p->item_num) &&
- (processtype == 6 || processtype == p->type)) {
+ if ((objid == 0 || objid == p->_itemNum) &&
+ (processtype == 6 || processtype == p->_type)) {
return p;
}
}
@@ -359,10 +359,10 @@ void Kernel::killProcesses(ObjId objid, uint16 processtype, bool fail) {
for (ProcessIterator it = processes.begin(); it != processes.end(); ++it) {
Process *p = *it;
- if (p->item_num != 0 && (objid == 0 || objid == p->item_num) &&
- (processtype == 6 || processtype == p->type) &&
- !(p->flags & Process::PROC_TERMINATED) &&
- !(p->flags & Process::PROC_TERM_DEFERRED)) {
+ if (p->_itemNum != 0 && (objid == 0 || objid == p->_itemNum) &&
+ (processtype == 6 || processtype == p->_type) &&
+ !(p->_flags & Process::PROC_TERMINATED) &&
+ !(p->_flags & Process::PROC_TERM_DEFERRED)) {
if (fail)
p->fail();
else
@@ -375,10 +375,10 @@ void Kernel::killProcessesNotOfType(ObjId objid, uint16 processtype, bool fail)
for (ProcessIterator it = processes.begin(); it != processes.end(); ++it) {
Process *p = *it;
- if (p->item_num != 0 && (objid == 0 || objid == p->item_num) &&
- (p->type != processtype) &&
- !(p->flags & Process::PROC_TERMINATED) &&
- !(p->flags & Process::PROC_TERM_DEFERRED)) {
+ if (p->_itemNum != 0 && (objid == 0 || objid == p->_itemNum) &&
+ (p->_type != processtype) &&
+ !(p->_flags & Process::PROC_TERMINATED) &&
+ !(p->_flags & Process::PROC_TERM_DEFERRED)) {
if (fail)
p->fail();
else
@@ -388,7 +388,7 @@ void Kernel::killProcessesNotOfType(ObjId objid, uint16 processtype, bool fail)
}
void Kernel::save(ODataSource *ods) {
- ods->write4(framenum);
+ ods->write4(_frameNum);
pIDs->save(ods);
ods->write4(processes.size());
for (ProcessIterator it = processes.begin(); it != processes.end(); ++it) {
@@ -397,7 +397,7 @@ void Kernel::save(ODataSource *ods) {
}
bool Kernel::load(IDataSource *ids, uint32 version) {
- framenum = ids->read4();
+ _frameNum = ids->read4();
if (!pIDs->load(ids, version)) return false;
diff --git a/engines/ultima/ultima8/kernel/kernel.h b/engines/ultima/ultima8/kernel/kernel.h
index e5a99dd..01f2523 100644
--- a/engines/ultima/ultima8/kernel/kernel.h
+++ b/engines/ultima/ultima8/kernel/kernel.h
@@ -62,7 +62,7 @@ public:
void setNextProcess(Process *proc);
Process *getRunningProcess() const {
- return runningprocess;
+ return _runningProcess;
}
// objid = 0 means any object, type = 6 means any type
@@ -98,20 +98,21 @@ public:
bool load(IDataSource *ids, uint32 version);
void pause() {
- paused++;
+ _paused++;
}
void unpause() {
- if (paused > 0) paused--;
+ if (_paused > 0)
+ _paused--;
}
bool isPaused() const {
- return paused > 0;
+ return _paused > 0;
}
void setFrameByFrame(bool fbf) {
- framebyframe = fbf;
+ _frameByFrame = fbf;
}
bool isFrameByFrame() const {
- return framebyframe;
+ return _frameByFrame;
}
void addProcessLoader(Std::string classname, ProcessLoadFunc func) {
@@ -119,7 +120,7 @@ public:
}
uint32 getFrameNum() const {
- return framenum;
+ return _frameNum;
};
//! "Kernel::processTypes" console command
@@ -148,11 +149,11 @@ private:
bool loading;
- uint32 framenum;
- unsigned int paused;
- bool framebyframe;
+ uint32 _frameNum;
+ unsigned int _paused;
+ bool _frameByFrame;
- Process *runningprocess;
+ Process *_runningProcess;
static Kernel *kernel;
};
diff --git a/engines/ultima/ultima8/kernel/memory_manager.cpp b/engines/ultima/ultima8/kernel/memory_manager.cpp
index 4a89a72..39572ea 100644
--- a/engines/ultima/ultima8/kernel/memory_manager.cpp
+++ b/engines/ultima/ultima8/kernel/memory_manager.cpp
@@ -27,35 +27,35 @@
namespace Ultima {
namespace Ultima8 {
-MemoryManager *MemoryManager::memorymanager;
+MemoryManager *MemoryManager::_memoryManager;
MemoryManager::MemoryManager() {
- memorymanager = this;
+ _memoryManager = this;
//!!! CONSTANT !!!!
- allocatorCount = 2;
+ _allocatorCount = 2;
// Tune these with averages from MemoryManager::MemInfo when needed
- allocators[0] = new SegmentedAllocator(192, 8500);
- allocators[1] = new SegmentedAllocator(4224, 25);
+ _allocators[0] = new SegmentedAllocator(192, 8500);
+ _allocators[1] = new SegmentedAllocator(4224, 25);
setAllocationFunctions(MemoryManager::allocate,
MemoryManager::deallocate);
}
MemoryManager::~MemoryManager() {
- memorymanager = 0;
+ _memoryManager = 0;
setAllocationFunctions(malloc, free);
- delete allocators[0];
- delete allocators[1];
+ delete _allocators[0];
+ delete _allocators[1];
}
void *MemoryManager::_allocate(size_t size) {
int i;
// get the memory from the first allocator that can hold "size"
- for (i = 0; i < allocatorCount; ++i) {
- if (allocators[i]->getCapacity() >= size) {
- return allocators[i]->allocate(size);
+ for (i = 0; i < _allocatorCount; ++i) {
+ if (_allocators[i]->getCapacity() >= size) {
+ return _allocators[i]->allocate(size);
}
}
@@ -71,8 +71,8 @@ void *MemoryManager::_allocate(size_t size) {
void MemoryManager::_deallocate(void *ptr) {
Pool *p;
int i;
- for (i = 0; i < allocatorCount; ++i) {
- p = allocators[i]->findPool(ptr);
+ for (i = 0; i < _allocatorCount; ++i) {
+ p = _allocators[i]->findPool(ptr);
if (p) {
p->deallocate(ptr);
return;
@@ -88,8 +88,8 @@ void MemoryManager::_deallocate(void *ptr) {
void MemoryManager::freeResources() {
int i;
- for (i = 0; i < allocatorCount; ++i) {
- allocators[i]->freeResources();
+ for (i = 0; i < _allocatorCount; ++i) {
+ _allocators[i]->freeResources();
}
}
diff --git a/engines/ultima/ultima8/kernel/memory_manager.h b/engines/ultima/ultima8/kernel/memory_manager.h
index fadc8e4..3155ba4 100644
--- a/engines/ultima/ultima8/kernel/memory_manager.h
+++ b/engines/ultima/ultima8/kernel/memory_manager.h
@@ -34,25 +34,25 @@ public:
~MemoryManager();
static MemoryManager *get_instance() {
- return memorymanager;
+ return _memoryManager;
}
//! Allocates memory with the default allocator or malloc
static void *allocate(size_t size) {
- return memorymanager ? memorymanager->_allocate(size) : 0;
+ return _memoryManager ? _memoryManager->_allocate(size) : 0;
}
//! Checks all known Allocators to free memory
static void deallocate(void *ptr) {
- memorymanager->_deallocate(ptr);
+ _memoryManager->_deallocate(ptr);
}
Allocator *getAllocator(uint16 index) {
- return index < allocatorCount ? allocators[index] : 0;
+ return index < _allocatorCount ? _allocators[index] : 0;
}
uint16 getAllocatorCount() {
- return allocatorCount;
+ return _allocatorCount;
}
void freeResources();
@@ -64,13 +64,13 @@ public:
static void ConCmd_test(const Console::ArgvType &argv);
private:
- Allocator *allocators[10];
- uint16 allocatorCount;
+ Allocator *_allocators[10];
+ uint16 _allocatorCount;
void *_allocate(size_t size);
void _deallocate(void *ptr);
- static MemoryManager *memorymanager;
+ static MemoryManager *_memoryManager;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/mouse.cpp b/engines/ultima/ultima8/kernel/mouse.cpp
index a7bba4a..3ab95ad 100644
--- a/engines/ultima/ultima8/kernel/mouse.cpp
+++ b/engines/ultima/ultima8/kernel/mouse.cpp
@@ -37,17 +37,17 @@
namespace Ultima {
namespace Ultima8 {
-Mouse *Mouse::instance;
+Mouse *Mouse::_instance;
Mouse::Mouse() : _flashingCursorTime(0), _mouseOverGump(0), _defaultMouse(0),
_dragging(DRAG_NOT), _dragging_objId(0), _draggingItem_startGump(0),
_draggingItem_lastGump(0) {
- instance = this;
+ _instance = this;
for (int i = 0; i < Shared::MOUSE_LAST; ++i) {
- _mouseButton[i].downGump = 0;
- _mouseButton[i].lastDown = 0;
- _mouseButton[i].state = MBS_HANDLED;
+ _mouseButton[i]._downGump = 0;
+ _mouseButton[i]._lastDown = 0;
+ _mouseButton[i]._state = MBS_HANDLED;
}
}
@@ -71,32 +71,32 @@ bool Mouse::buttonDown(Shared::MouseButton button) {
Gump *desktopGump = Ultima8Engine::get_instance()->getDesktopGump();
Gump *mousedowngump = desktopGump->OnMouseDown(button, _mousePos.x, _mousePos.y);
if (mousedowngump) {
- _mouseButton[button].downGump = mousedowngump->getObjId();
+ _mouseButton[button]._downGump = mousedowngump->getObjId();
handled = true;
} else {
- _mouseButton[button].downGump = 0;
+ _mouseButton[button]._downGump = 0;
}
- _mouseButton[button].curDown = now;
- _mouseButton[button].downX = _mousePos.x;
- _mouseButton[button].downY = _mousePos.y;
- _mouseButton[button].state |= MBS_DOWN;
- _mouseButton[button].state &= ~MBS_HANDLED;
+ _mouseButton[button]._curDown = now;
+ _mouseButton[button]._downX = _mousePos.x;
+ _mouseButton[button]._downY = _mousePos.y;
+ _mouseButton[button]._state |= MBS_DOWN;
+ _mouseButton[button]._state &= ~MBS_HANDLED;
- if (now - _mouseButton[button].lastDown < DOUBLE_CLICK_TIMEOUT) {
+ if (now - _mouseButton[button]._lastDown < DOUBLE_CLICK_TIMEOUT) {
if (_dragging == Mouse::DRAG_NOT) {
- Gump *gump = getGump(_mouseButton[button].downGump);
+ Gump *gump = getGump(_mouseButton[button]._downGump);
if (gump) {
int32 mx2 = _mousePos.x, my2 = _mousePos.y;
Gump *parent = gump->GetParent();
if (parent) parent->ScreenSpaceToGump(mx2, my2);
gump->OnMouseDouble(button, mx2, my2);
}
- _mouseButton[button].state |= MBS_HANDLED;
- _mouseButton[button].lastDown = 0;
+ _mouseButton[button]._state |= MBS_HANDLED;
+ _mouseButton[button]._lastDown = 0;
}
}
- _mouseButton[button].lastDown = now;
+ _mouseButton[button]._lastDown = now;
return handled;
}
@@ -105,15 +105,15 @@ bool Mouse::buttonUp(Shared::MouseButton button) {
assert(button != Shared::MOUSE_LAST);
bool handled = false;
- _mouseButton[button].state &= ~MBS_DOWN;
+ _mouseButton[button]._state &= ~MBS_DOWN;
// Need to store the last down position of the mouse
// when the button is released.
- _mouseButton[button].downX = _mousePos.x;
- _mouseButton[button].downY = _mousePos.y;
+ _mouseButton[button]._downX = _mousePos.x;
+ _mouseButton[button]._downY = _mousePos.y;
// Always send mouse up to the gump
- Gump *gump = getGump(_mouseButton[button].downGump);
+ Gump *gump = getGump(_mouseButton[button]._downGump);
if (gump) {
int32 mx2 = _mousePos.x, my2 = _mousePos.y;
Gump *parent = gump->GetParent();
@@ -137,7 +137,7 @@ void Mouse::popAllCursors() {
}
bool Mouse::isMouseDownEvent(Shared::MouseButton button) {
- return (_mouseButton[button].state & MBS_DOWN);
+ return (_mouseButton[button]._state & MBS_DOWN);
}
int Mouse::getMouseLength(int mx, int my) {
@@ -313,9 +313,9 @@ void Mouse::setMouseCoords(int mx, int my) {
}
if (_dragging == DRAG_NOT) {
- if (_mouseButton[Shared::BUTTON_LEFT].state & MBS_DOWN) {
- int startx = _mouseButton[Shared::BUTTON_LEFT].downX;
- int starty = _mouseButton[Shared::BUTTON_LEFT].downY;
+ if (_mouseButton[Shared::BUTTON_LEFT]._state & MBS_DOWN) {
+ int startx = _mouseButton[Shared::BUTTON_LEFT]._downX;
+ int starty = _mouseButton[Shared::BUTTON_LEFT]._downY;
if (ABS(startx - mx) > 2 ||
ABS(starty - my) > 2) {
startDragging(startx, starty);
@@ -401,7 +401,7 @@ void Mouse::startDragging(int startx, int starty) {
// pause the kernel
Kernel::get_instance()->pause();
- _mouseButton[Shared::BUTTON_LEFT].state |= MBS_HANDLED;
+ _mouseButton[Shared::BUTTON_LEFT]._state |= MBS_HANDLED;
if (_dragging == DRAG_INVALID) {
setMouseCursor(MOUSE_CROSS);
@@ -503,12 +503,12 @@ void Mouse::handleDelayedEvents() {
uint32 now = g_system->getMillis();
for (int button = 0; button < Shared::MOUSE_LAST; ++button) {
- if (!(_mouseButton[button].state & (MBS_HANDLED | MBS_DOWN)) &&
- now - _mouseButton[button].lastDown > DOUBLE_CLICK_TIMEOUT) {
- Gump *gump = getGump(_mouseButton[button].downGump);
+ if (!(_mouseButton[button]._state & (MBS_HANDLED | MBS_DOWN)) &&
+ now - _mouseButton[button]._lastDown > DOUBLE_CLICK_TIMEOUT) {
+ Gump *gump = getGump(_mouseButton[button]._downGump);
if (gump) {
- int32 mx = _mouseButton[button].downX;
- int32 my = _mouseButton[button].downY;
+ int32 mx = _mouseButton[button]._downX;
+ int32 my = _mouseButton[button]._downY;
Gump *parent = gump->GetParent();
if (parent)
parent->ScreenSpaceToGump(mx, my);
@@ -516,8 +516,8 @@ void Mouse::handleDelayedEvents() {
gump->OnMouseClick(button, mx, my);
}
- _mouseButton[button].downGump = 0;
- _mouseButton[button].state |= MBS_HANDLED;
+ _mouseButton[button]._downGump = 0;
+ _mouseButton[button]._state |= MBS_HANDLED;
}
}
}
diff --git a/engines/ultima/ultima8/kernel/mouse.h b/engines/ultima/ultima8/kernel/mouse.h
index 597718e..4906903 100644
--- a/engines/ultima/ultima8/kernel/mouse.h
+++ b/engines/ultima/ultima8/kernel/mouse.h
@@ -34,11 +34,11 @@ namespace Ultima8 {
const unsigned int DOUBLE_CLICK_TIMEOUT = 200;
struct MButton {
- uint16 downGump;
- uint32 lastDown;
- uint32 curDown;
- int downX, downY;
- int state;
+ uint16 _downGump;
+ uint32 _lastDown;
+ uint32 _curDown;
+ int _downX, _downY;
+ int _state;
};
enum MouseButtonState {
@@ -70,7 +70,7 @@ public:
DRAG_TEMPFAIL = 3
};
private:
- static Mouse *instance;
+ static Mouse *_instance;
Common::Stack<MouseCursor> _cursors;
Texture *_defaultMouse; //!< Default Pentagram mouse for when there is no GameData
@@ -95,7 +95,7 @@ private:
void moveDragging(int mx, int my);
void stopDragging(int mx, int my);
public:
- static Mouse *get_instance() { return instance; }
+ static Mouse *get_instance() { return _instance; }
public:
Mouse();
diff --git a/engines/ultima/ultima8/kernel/object.cpp b/engines/ultima/ultima8/kernel/object.cpp
index a10e012..d77d3fe 100644
--- a/engines/ultima/ultima8/kernel/object.cpp
+++ b/engines/ultima/ultima8/kernel/object.cpp
@@ -21,13 +21,11 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/kernel/object.h"
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/kernel/object_manager.h"
#include "ultima/ultima8/world/world.h"
#include "ultima/ultima8/kernel/memory_manager.h"
-
#include "ultima/ultima8/usecode/uc_process.h"
#include "ultima/ultima8/usecode/uc_machine.h"
#include "ultima/ultima8/filesys/idata_source.h"
@@ -42,23 +40,23 @@ DEFINE_RUNTIME_CLASSTYPE_CODE_BASE_CLASS(Object)
DEFINE_CUSTOM_MEMORY_ALLOCATION(Object)
Object::~Object() {
- if (objid != 0xFFFF)
- ObjectManager::get_instance()->clearObjId(objid);
+ if (_objId != 0xFFFF)
+ ObjectManager::get_instance()->clearObjId(_objId);
}
ObjId Object::assignObjId() {
- if (objid == 0xFFFF)
- objid = ObjectManager::get_instance()->assignObjId(this);
- return objid;
+ if (_objId == 0xFFFF)
+ _objId = ObjectManager::get_instance()->assignObjId(this);
+ return _objId;
}
void Object::clearObjId() {
// On clearObjId we kill all processes that belonged to us
- Kernel::get_instance()->killProcesses(objid, 6, true);
+ Kernel::get_instance()->killProcesses(_objId, 6, true);
- if (objid != 0xFFFF)
- ObjectManager::get_instance()->clearObjId(objid);
- objid = 0xFFFF;
+ if (_objId != 0xFFFF)
+ ObjectManager::get_instance()->clearObjId(_objId);
+ _objId = 0xFFFF;
}
void Object::dumpInfo() {
@@ -91,11 +89,11 @@ void Object::saveData(ODataSource *ods) {
// note: Object is unversioned. If we ever want to version it,
// increase the global savegame version
- ods->write2(objid);
+ ods->write2(_objId);
}
bool Object::loadData(IDataSource *ids, uint32 version) {
- objid = ids->read2();
+ _objId = ids->read2();
return true;
}
diff --git a/engines/ultima/ultima8/kernel/object.h b/engines/ultima/ultima8/kernel/object.h
index 542ae2a..a614b75 100644
--- a/engines/ultima/ultima8/kernel/object.h
+++ b/engines/ultima/ultima8/kernel/object.h
@@ -34,7 +34,7 @@ class IDataSource;
class Object {
public:
- Object() : objid(0xFFFF) {}
+ Object() : _objId(0xFFFF) {}
virtual ~Object();
// p_dynamic_cast stuff
@@ -45,7 +45,7 @@ public:
//! get this Object's objID
inline ObjId getObjId() const {
- return objid;
+ return _objId;
}
//! Assign self and contents (if any) an objID
@@ -80,7 +80,7 @@ protected:
//! save the actual Object data
virtual void saveData(ODataSource *ods);
- ObjId objid;
+ ObjId _objId;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/object_manager.cpp b/engines/ultima/ultima8/kernel/object_manager.cpp
index a6ada93..d109b13 100644
--- a/engines/ultima/ultima8/kernel/object_manager.cpp
+++ b/engines/ultima/ultima8/kernel/object_manager.cpp
@@ -32,7 +32,6 @@
#include "ultima/ultima8/filesys/odata_source.h"
#include "ultima/ultima8/world/item_factory.h"
#include "ultima/ultima8/ultima8.h"
-
#include "ultima/ultima8/world/actors/main_actor.h"
#include "ultima/ultima8/world/egg.h"
#include "ultima/ultima8/world/monster_egg.h"
@@ -79,11 +78,11 @@ ObjectManager::ObjectManager() {
setupLoaders();
- objects.resize(65536);
+ _objects.resize(65536);
//!CONSTANTS
- objIDs = new idMan(256, 32766, 8192); // Want range of 256 to 32766
- actorIDs = new idMan(1, 255, 255);
+ _objIDs = new idMan(256, 32766, 8192); // Want range of 256 to 32766
+ _actorIDs = new idMan(1, 255, 255);
}
ObjectManager::~ObjectManager() {
@@ -92,8 +91,8 @@ ObjectManager::~ObjectManager() {
objectmanager = 0;
- delete objIDs;
- delete actorIDs;
+ delete _objIDs;
+ delete _actorIDs;
}
void ObjectManager::reset() {
@@ -101,28 +100,28 @@ void ObjectManager::reset() {
unsigned int i;
- for (i = 0; i < objects.size(); ++i) {
- if (objects[i] == 0) continue;
+ for (i = 0; i < _objects.size(); ++i) {
+ if (_objects[i] == 0) continue;
#if 0
- Item *item = p_dynamic_cast<Item *>(objects[i]);
+ Item *item = p_dynamic_cast<Item *>(_objects[i]);
if (item && item->getParent()) continue; // will be deleted by parent
#endif
- Gump *gump = p_dynamic_cast<Gump *>(objects[i]);
+ Gump *gump = p_dynamic_cast<Gump *>(_objects[i]);
if (gump && gump->GetParent()) continue; // will be deleted by parent
- delete objects[i];
+ delete _objects[i];
}
- for (i = 0; i < objects.size(); ++i) {
- assert(objects[i] == 0);
+ for (i = 0; i < _objects.size(); ++i) {
+ assert(_objects[i] == 0);
}
//!CONSTANTS
- objects.clear();
- objects.resize(65536);
- objIDs->clearAll(32766);
- objIDs->reserveID(666); // 666 is reserved for the Guardian Bark hack
- actorIDs->clearAll();
+ _objects.clear();
+ _objects.resize(65536);
+ _objIDs->clearAll(32766);
+ _objIDs->reserveID(666); // 666 is reserved for the Guardian Bark hack
+ _actorIDs->clearAll();
}
void ObjectManager::objectStats() {
@@ -130,11 +129,11 @@ void ObjectManager::objectStats() {
//!constants
for (i = 1; i < 256; i++) {
- if (objects[i] != 0)
+ if (_objects[i] != 0)
npccount++;
}
- for (i = 256; i < objects.size(); i++) {
- if (objects[i] != 0)
+ for (i = 256; i < _objects.size(); i++) {
+ if (_objects[i] != 0)
objcount++;
}
@@ -146,8 +145,8 @@ void ObjectManager::objectStats() {
void ObjectManager::objectTypes() {
pout << "Current object types:" << Std::endl;
Std::map<Common::String, unsigned int> objecttypes;
- for (unsigned int i = 1; i < objects.size(); ++i) {
- Object *o = objects[i];
+ for (unsigned int i = 1; i < _objects.size(); ++i) {
+ Object *o = _objects[i];
if (!o) continue;
objecttypes[o->GetClassType().class_name]++;
}
@@ -176,9 +175,9 @@ void ObjectManager::ConCmd_objectInfo(const Console::ArgvType &argv) {
if (obj == 0) {
bool reserved = false;
if (objid >= 256) // CONSTANT!
- reserved = objman->objIDs->isIDUsed(objid);
+ reserved = objman->_objIDs->isIDUsed(objid);
else
- reserved = objman->actorIDs->isIDUsed(objid);
+ reserved = objman->_actorIDs->isIDUsed(objid);
if (reserved)
pout << "Reserved objid: " << objid << Std::endl;
else
@@ -191,65 +190,65 @@ void ObjectManager::ConCmd_objectInfo(const Console::ArgvType &argv) {
uint16 ObjectManager::assignObjId(Object *obj, ObjId new_objid) {
if (new_objid == 0xFFFF)
- new_objid = objIDs->getNewID();
+ new_objid = _objIDs->getNewID();
else
- objIDs->reserveID(new_objid);
+ _objIDs->reserveID(new_objid);
// failure???
if (new_objid != 0) {
- assert(objects[new_objid] == 0);
- objects[new_objid] = obj;
+ assert(_objects[new_objid] == 0);
+ _objects[new_objid] = obj;
}
return new_objid;
}
uint16 ObjectManager::assignActorObjId(Actor *actor, ObjId new_objid) {
if (new_objid == 0xFFFF)
- new_objid = actorIDs->getNewID();
+ new_objid = _actorIDs->getNewID();
else
- actorIDs->reserveID(new_objid);
+ _actorIDs->reserveID(new_objid);
// failure???
if (new_objid != 0) {
- assert(objects[new_objid] == 0);
- objects[new_objid] = actor;
+ assert(_objects[new_objid] == 0);
+ _objects[new_objid] = actor;
}
return new_objid;
}
bool ObjectManager::reserveObjId(ObjId objid) {
if (objid >= 256) // !constant
- return objIDs->reserveID(objid);
+ return _objIDs->reserveID(objid);
else
- return actorIDs->reserveID(objid);
+ return _actorIDs->reserveID(objid);
}
void ObjectManager::clearObjId(ObjId objid) {
// need to make this assert check only permanent NPCs
// assert(objid >= 256); // !constant
if (objid >= 256) // !constant
- objIDs->clearID(objid);
+ _objIDs->clearID(objid);
else
- actorIDs->clearID(objid);
+ _actorIDs->clearID(objid);
- objects[objid] = 0;
+ _objects[objid] = 0;
}
Object *ObjectManager::getObject(ObjId objid) const {
- return objects[objid];
+ return _objects[objid];
}
void ObjectManager::allow64kObjects() {
- objIDs->setNewMax(65534);
+ _objIDs->setNewMax(65534);
}
void ObjectManager::save(ODataSource *ods) {
- objIDs->save(ods);
- actorIDs->save(ods);
+ _objIDs->save(ods);
+ _actorIDs->save(ods);
- for (unsigned int i = 0; i < objects.size(); ++i) {
- Object *object = objects[i];
+ for (unsigned int i = 0; i < _objects.size(); ++i) {
+ Object *object = _objects[i];
if (!object) continue;
// child items/gumps are saved by their parent.
@@ -259,7 +258,7 @@ void ObjectManager::save(ODataSource *ods) {
// don't save Gumps with DONT_SAVE and Gumps with parents, unless
// the parent is a core gump
- // FIXME: This leaks objIDs. See comment in ObjectManager::load().
+ // FIXME: This leaks _objIDs. See comment in ObjectManager::load().
if (gump && !gump->mustSave(true)) continue;
object->save(ods);
@@ -270,8 +269,8 @@ void ObjectManager::save(ODataSource *ods) {
bool ObjectManager::load(IDataSource *ids, uint32 version) {
- if (!objIDs->load(ids, version)) return false;
- if (!actorIDs->load(ids, version)) return false;
+ if (!_objIDs->load(ids, version)) return false;
+ if (!_actorIDs->load(ids, version)) return false;
do {
// peek ahead for terminator
@@ -296,29 +295,29 @@ bool ObjectManager::load(IDataSource *ids, uint32 version) {
} while (true);
// ObjectManager::save() doesn't save Gumps with the DONT_SAVE flag, but
- // their IDs are still marked in use in objIDs.
- // As a workaround, we clear all IDs still in use without actual objects.
+ // their IDs are still marked in use in _objIDs.
+ // As a workaround, we clear all IDs still in use without actual _objects.
// We only do this with IDs >= 1024 because below there are truly reserved
- // objIDs (up to 511 is reserved by U8Game, 666 is reserved for Guardian
+ // _objIDs (up to 511 is reserved by U8Game, 666 is reserved for Guardian
// barks).
// FIXME: Properly fix this objID leak and increment the savegame number.
// This check can then be turned into an savegame corruption check
// for saves with the new savegame version.
- // We also fail loading when we're out of objIDs since this could
- // have caused serious issues when critical objects haven't been created.
- if (objIDs->isFull()) {
- perr << "Savegame has been corrupted by running out of objIDs."
+ // We also fail loading when we're out of _objIDs since this could
+ // have caused serious issues when critical _objects haven't been created.
+ if (_objIDs->isFull()) {
+ perr << "Savegame has been corrupted by running out of _objIDs."
<< Std::endl;
return false;
}
unsigned int count = 0;
- for (unsigned int i = 1024; i < objects.size(); i++) {
- if (objects[i] == 0 && objIDs->isIDUsed(i)) {
- objIDs->clearID(i);
+ for (unsigned int i = 1024; i < _objects.size(); i++) {
+ if (_objects[i] == 0 && _objIDs->isIDUsed(i)) {
+ _objIDs->clearID(i);
count++;
}
}
- pout << "Reclaimed " << count << " objIDs on load." << Std::endl;
+ pout << "Reclaimed " << count << " _objIDs on load." << Std::endl;
return true;
}
@@ -338,9 +337,9 @@ Object *ObjectManager::loadObject(IDataSource *ids, uint32 version) {
Object *ObjectManager::loadObject(IDataSource *ids, Std::string classname,
uint32 version) {
Std::map<Common::String, ObjectLoadFunc>::iterator iter;
- iter = objectloaders.find(classname);
+ iter = _objectLoaders.find(classname);
- if (iter == objectloaders.end()) {
+ if (iter == _objectLoaders.end()) {
perr << "Unknown Object class: " << classname << Std::endl;
return 0;
}
@@ -354,12 +353,12 @@ Object *ObjectManager::loadObject(IDataSource *ids, Std::string classname,
uint16 objid = obj->getObjId();
if (objid != 0xFFFF) {
- objects[objid] = obj;
+ _objects[objid] = obj;
bool used;
if (objid >= 256)
- used = objIDs->isIDUsed(objid);
+ used = _objIDs->isIDUsed(objid);
else
- used = actorIDs->isIDUsed(objid);
+ used = _actorIDs->isIDUsed(objid);
if (!used) {
perr << "Error: object ID " << objid
<< " used but marked available. " << Std::endl;
diff --git a/engines/ultima/ultima8/kernel/object_manager.h b/engines/ultima/ultima8/kernel/object_manager.h
index 7051083..80ed03e 100644
--- a/engines/ultima/ultima8/kernel/object_manager.h
+++ b/engines/ultima/ultima8/kernel/object_manager.h
@@ -75,17 +75,17 @@ public:
//! "ObjectManager::objectInfo" console command
static void ConCmd_objectInfo(const Console::ArgvType &argv);
- Std::vector<Object *> objects;
- idMan *objIDs;
- idMan *actorIDs;
+ Std::vector<Object *> _objects;
+ idMan *_objIDs;
+ idMan *_actorIDs;
private:
void setupLoaders();
void addObjectLoader(Std::string classname, ObjectLoadFunc func) {
- objectloaders[classname] = func;
+ _objectLoaders[classname] = func;
}
- Std::map<Common::String, ObjectLoadFunc> objectloaders;
+ Std::map<Common::String, ObjectLoadFunc> _objectLoaders;
static ObjectManager *objectmanager;
};
diff --git a/engines/ultima/ultima8/kernel/process.cpp b/engines/ultima/ultima8/kernel/process.cpp
index 0ce366b..76f3197 100644
--- a/engines/ultima/ultima8/kernel/process.cpp
+++ b/engines/ultima/ultima8/kernel/process.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/kernel/process.h"
#include "ultima/ultima8/kernel/kernel.h"
#include "ultima/ultima8/filesys/idata_source.h"
@@ -36,19 +35,19 @@ DEFINE_RUNTIME_CLASSTYPE_CODE_BASE_CLASS(Process)
DEFINE_CUSTOM_MEMORY_ALLOCATION(Process)
Process::Process(ObjId it, uint16 ty)
- : pid(0xFFFF), flags(0), item_num(it), type(ty), result(0) {
+ : _pid(0xFFFF), _flags(0), _itemNum(it), _type(ty), _result(0) {
Kernel::get_instance()->assignPID(this);
}
void Process::fail() {
- assert(!(flags & PROC_TERMINATED));
+ assert(!(_flags & PROC_TERMINATED));
- flags |= PROC_FAILED;
+ _flags |= PROC_FAILED;
terminate();
}
void Process::terminate() {
- assert(!(flags & PROC_TERMINATED));
+ assert(!(_flags & PROC_TERMINATED));
Kernel *kernel = Kernel::get_instance();
@@ -57,17 +56,17 @@ void Process::terminate() {
i != waiting.end(); ++i) {
Process *p = kernel->getProcess(*i);
if (p)
- p->wakeUp(result);
+ p->wakeUp(_result);
}
waiting.clear();
- flags |= PROC_TERMINATED;
+ _flags |= PROC_TERMINATED;
}
void Process::wakeUp(uint32 result_) {
- result = result_;
+ _result = result_;
- flags &= ~PROC_SUSPENDED;
+ _flags &= ~PROC_SUSPENDED;
Kernel::get_instance()->setNextProcess(this);
}
@@ -79,10 +78,10 @@ void Process::waitFor(ProcId pid_) {
// add this process to waiting list of process pid_
Process *p = kernel->getProcess(pid_);
assert(p);
- p->waiting.push_back(pid);
+ p->waiting.push_back(_pid);
}
- flags |= PROC_SUSPENDED;
+ _flags |= PROC_SUSPENDED;
}
void Process::waitFor(Process *proc) {
@@ -93,21 +92,21 @@ void Process::waitFor(Process *proc) {
}
void Process::suspend() {
- flags |= PROC_SUSPENDED;
+ _flags |= PROC_SUSPENDED;
}
void Process::dumpInfo() {
Common::String info = Common::String::format(
- "Process %d class %s, item %d, type %x, status ",
- getPid(), GetClassType().class_name, item_num, type);
+ "Process %d class %s, item %d, _type %x, status ",
+ getPid(), GetClassType().class_name, _itemNum, _type);
pout << info.c_str();
- if (flags & PROC_ACTIVE) pout << "A";
- if (flags & PROC_SUSPENDED) pout << "S";
- if (flags & PROC_TERMINATED) pout << "T";
- if (flags & PROC_TERM_DEFERRED) pout << "t";
- if (flags & PROC_FAILED) pout << "F";
- if (flags & PROC_RUNPAUSED) pout << "R";
+ if (_flags & PROC_ACTIVE) pout << "A";
+ if (_flags & PROC_SUSPENDED) pout << "S";
+ if (_flags & PROC_TERMINATED) pout << "T";
+ if (_flags & PROC_TERM_DEFERRED) pout << "t";
+ if (_flags & PROC_FAILED) pout << "F";
+ if (_flags & PROC_RUNPAUSED) pout << "R";
if (!waiting.empty()) {
pout << ", notify: ";
for (Std::vector<ProcId>::iterator i = waiting.begin();
@@ -133,22 +132,22 @@ void Process::writeProcessHeader(ODataSource *ods) {
}
void Process::saveData(ODataSource *ods) {
- ods->write2(pid);
- ods->write4(flags);
- ods->write2(item_num);
- ods->write2(type);
- ods->write4(result);
+ ods->write2(_pid);
+ ods->write4(_flags);
+ ods->write2(_itemNum);
+ ods->write2(_type);
+ ods->write4(_result);
ods->write4(static_cast<uint32>(waiting.size()));
for (unsigned int i = 0; i < waiting.size(); ++i)
ods->write2(waiting[i]);
}
bool Process::loadData(IDataSource *ids, uint32 version) {
- pid = ids->read2();
- flags = ids->read4();
- item_num = ids->read2();
- type = ids->read2();
- result = ids->read4();
+ _pid = ids->read2();
+ _flags = ids->read4();
+ _itemNum = ids->read2();
+ _type = ids->read2();
+ _result = ids->read4();
uint32 waitcount = ids->read4();
waiting.resize(waitcount);
for (unsigned int i = 0; i < waitcount; ++i)
diff --git a/engines/ultima/ultima8/kernel/process.h b/engines/ultima/ultima8/kernel/process.h
index c7be2bd..62bcd95 100644
--- a/engines/ultima/ultima8/kernel/process.h
+++ b/engines/ultima/ultima8/kernel/process.h
@@ -38,7 +38,7 @@ public:
virtual void run() = 0;
- Process(ObjId item_num = 0, uint16 type = 0);
+ Process(ObjId _itemNum = 0, uint16 type = 0);
virtual ~Process() { }
// p_dynamic_cast stuff
@@ -48,17 +48,17 @@ public:
ENABLE_CUSTOM_MEMORY_ALLOCATION()
uint32 getProcessFlags() const {
- return flags;
+ return _flags;
}
bool is_active() const {
- return (flags & PROC_ACTIVE);
+ return (_flags & PROC_ACTIVE);
}
bool is_terminated() const {
- return (flags & (PROC_TERMINATED |
+ return (_flags & (PROC_TERMINATED |
PROC_TERM_DEFERRED)) != 0;
}
bool is_suspended() const {
- return (flags & PROC_SUSPENDED) != 0;
+ return (_flags & PROC_SUSPENDED) != 0;
}
//! terminate the process and recursively fail all processes waiting for it
@@ -69,11 +69,11 @@ public:
//! terminate next frame
void terminateDeferred() {
- flags |= PROC_TERM_DEFERRED;
+ _flags |= PROC_TERM_DEFERRED;
}
- //! suspend until process 'pid' returns. If pid is 0, suspend indefinitely
- void waitFor(ProcId pid);
+ //! suspend until process '_pid' returns. If _pid is 0, suspend indefinitely
+ void waitFor(ProcId _pid);
//! suspend until process returns. If proc is 0, suspend indefinitely
void waitFor(Process *proc);
@@ -84,20 +84,20 @@ public:
void wakeUp(uint32 result);
void setItemNum(ObjId it) {
- item_num = it;
+ _itemNum = it;
}
void setType(uint16 ty) {
- type = ty;
+ _type = ty;
}
ProcId getPid() const {
- return pid;
+ return _pid;
}
ObjId getItemNum() const {
- return item_num;
+ return _itemNum;
}
uint16 getType() const {
- return type;
+ return _type;
}
//! dump some info about this process to pout
@@ -116,16 +116,16 @@ protected:
void writeProcessHeader(ODataSource *ods);
//! process id
- ProcId pid;
+ ProcId _pid;
- uint32 flags;
+ uint32 _flags;
//! item we are assigned to
- ObjId item_num;
- uint16 type;
+ ObjId _itemNum;
+ uint16 _type;
//! process result
- uint32 result;
+ uint32 _result;
//! Processes waiting for this one to finish.
//! When this process terminates, awaken them and pass them the result val.
diff --git a/engines/ultima/ultima8/kernel/segmented_allocator.cpp b/engines/ultima/ultima8/kernel/segmented_allocator.cpp
index 74242f4..d4e3c05 100644
--- a/engines/ultima/ultima8/kernel/segmented_allocator.cpp
+++ b/engines/ultima/ultima8/kernel/segmented_allocator.cpp
@@ -28,41 +28,41 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(SegmentedAllocator, Allocator)
-SegmentedAllocator::SegmentedAllocator(size_t nodeCapacity_, uint32 nodes_): Allocator(), nodes(nodes_) {
- pools.push_back(new SegmentedPool(nodeCapacity_, nodes_));
- nodeCapacity = pools[0]->getNodeCapacity();
-// pout << "Initial Pool Created: Nodes - " << nodes << ", Node Capacity - "
-// << nodeCapacity << Std::endl;
+SegmentedAllocator::SegmentedAllocator(size_t nodeCapacity, uint32 nodes): Allocator(), _nodes(nodes) {
+ _pools.push_back(new SegmentedPool(nodeCapacity, nodes));
+ _nodeCapacity = _pools[0]->getNodeCapacity();
+// pout << "Initial Pool Created: Nodes - " << _nodes << ", Node Capacity - "
+// << _nodeCapacity << Std::endl;
}
SegmentedAllocator::~SegmentedAllocator() {
Std::vector<SegmentedPool *>::iterator i;
- for (i = pools.begin(); i != pools.end(); ++i) {
+ for (i = _pools.begin(); i != _pools.end(); ++i) {
delete *i;
}
- pools.clear();
+ _pools.clear();
}
void *SegmentedAllocator::allocate(size_t size) {
Std::vector<SegmentedPool *>::iterator i;
SegmentedPool *p;
- if (size > nodeCapacity)
+ if (size > _nodeCapacity)
return 0;
- for (i = pools.begin(); i != pools.end(); ++i) {
+ for (i = _pools.begin(); i != _pools.end(); ++i) {
if (!(*i)->isFull())
return (*i)->allocate(size);
}
// else we need a new pool
- p = new SegmentedPool(nodeCapacity, nodes);
+ p = new SegmentedPool(_nodeCapacity, _nodes);
if (p) {
-// pout << "New Pool Created: Nodes - " << nodes << ", Node Capacity - "
-// << nodeCapacity << Std::endl;
+// pout << "New Pool Created: Nodes - " << _nodes << ", Node Capacity - "
+// << _nodeCapacity << Std::endl;
- pools.push_back(p);
+ _pools.push_back(p);
return p->allocate(size);
}
@@ -72,7 +72,7 @@ void *SegmentedAllocator::allocate(size_t size) {
Pool *SegmentedAllocator::findPool(void *ptr) {
Std::vector<SegmentedPool *>::iterator i;
- for (i = pools.begin(); i != pools.end(); ++i) {
+ for (i = _pools.begin(); i != _pools.end(); ++i) {
if ((*i)->inPool(ptr))
return *i;
}
@@ -80,15 +80,15 @@ Pool *SegmentedAllocator::findPool(void *ptr) {
}
void SegmentedAllocator::freeResources() {
- if (pools.empty())
+ if (_pools.empty())
return;
// Pop back only -- it should suffice.
- while (pools.back()->isEmpty()) {
- delete pools.back();
- pools.pop_back();
+ while (_pools.back()->isEmpty()) {
+ delete _pools.back();
+ _pools.pop_back();
- if (pools.empty())
+ if (_pools.empty())
return;
}
}
@@ -97,8 +97,8 @@ void SegmentedAllocator::printInfo() {
Std::vector<SegmentedPool *>::iterator it;
int i = 0;
- pout << "Pools: " << pools.size() << Std::endl;
- for (it = pools.begin(); it != pools.end(); ++it) {
+ pout << "Pools: " << _pools.size() << Std::endl;
+ for (it = _pools.begin(); it != _pools.end(); ++it) {
pout << " Pool " << i++ << ":" << Std::endl;
(*it)->printInfo();
}
diff --git a/engines/ultima/ultima8/kernel/segmented_allocator.h b/engines/ultima/ultima8/kernel/segmented_allocator.h
index 65014e0..ecd39e0 100644
--- a/engines/ultima/ultima8/kernel/segmented_allocator.h
+++ b/engines/ultima/ultima8/kernel/segmented_allocator.h
@@ -45,16 +45,16 @@ public:
void freeResources() override;
size_t getCapacity() override {
- return nodeCapacity;
+ return _nodeCapacity;
}
void printInfo() override;
private:
- Std::vector<SegmentedPool *> pools;
+ Std::vector<SegmentedPool *> _pools;
- size_t nodeCapacity;
- uint32 nodes;
+ size_t _nodeCapacity;
+ uint32 _nodes;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/segmented_pool.cpp b/engines/ultima/ultima8/kernel/segmented_pool.cpp
index bf70231..90b2077 100644
--- a/engines/ultima/ultima8/kernel/segmented_pool.cpp
+++ b/engines/ultima/ultima8/kernel/segmented_pool.cpp
@@ -55,33 +55,32 @@ struct SegmentedPoolNode {
// We pad both the PoolNode and the memory to align it.
-SegmentedPool::SegmentedPool(size_t nodeCapacity_, uint32 nodes_)
- : Pool(), nodes(nodes_), freeNodeCount(nodes_) {
+SegmentedPool::SegmentedPool(size_t nodeCapacity_, uint32 nodes)
+ : Pool(), _nodes(nodes), _freeNodeCount(nodes) {
uint32 i;
// Give it its real capacity.
// One redzone is added after the memory block.
- nodeCapacity = OFFSET_ALIGN(nodeCapacity_ + redzoneSize);
- nodes = nodes_;
+ _nodeCapacity = OFFSET_ALIGN(nodeCapacity_ + redzoneSize);
+ _nodes = nodes;
// Node offsets are aligned to the next uintptr offset after the real size.
// Another redzone is added between the node and the memory block.
- nodeOffset = OFFSET_ALIGN(sizeof(SegmentedPoolNode) + redzoneSize)
- + nodeCapacity;
+ _nodeOffset = OFFSET_ALIGN(sizeof(SegmentedPoolNode) + redzoneSize) + _nodeCapacity;
- startOfPool = new uint8[nodeOffset * nodes_];
- endOfPool = startOfPool + (nodeOffset * nodes_);
+ _startOfPool = new uint8[_nodeOffset * nodes];
+ _endOfPool = _startOfPool + (_nodeOffset * nodes);
- VALGRIND_CREATE_MEMPOOL(startOfPool, redzoneSize, 0);
+ VALGRIND_CREATE_MEMPOOL(_startOfPool, redzoneSize, 0);
- firstFree = reinterpret_cast<SegmentedPoolNode *>(startOfPool);
+ firstFree = reinterpret_cast<SegmentedPoolNode *>(_startOfPool);
firstFree->pool = this;
firstFree->size = 0;
lastFree = firstFree;
- for (i = 1; i < nodes_; ++i) {
- lastFree->nextFree = reinterpret_cast<SegmentedPoolNode *>(startOfPool + i * nodeOffset);
+ for (i = 1; i < nodes; ++i) {
+ lastFree->nextFree = reinterpret_cast<SegmentedPoolNode *>(_startOfPool + i * _nodeOffset);
lastFree = lastFree->nextFree;
lastFree->pool = this;
@@ -94,18 +93,18 @@ SegmentedPool::SegmentedPool(size_t nodeCapacity_, uint32 nodes_)
SegmentedPool::~SegmentedPool() {
assert(isEmpty());
- VALGRIND_DESTROY_MEMPOOL(startOfPool);
+ VALGRIND_DESTROY_MEMPOOL(_startOfPool);
- delete [] startOfPool;
+ delete [] _startOfPool;
}
void *SegmentedPool::allocate(size_t size) {
SegmentedPoolNode *node;
- if (isFull() || size > nodeCapacity)
+ if (isFull() || size > _nodeCapacity)
return 0;
- --freeNodeCount;
+ --_freeNodeCount;
node = firstFree;
node->size = size;
@@ -122,7 +121,7 @@ void *SegmentedPool::allocate(size_t size) {
uint8 *p = reinterpret_cast<uint8 *>(node) +
OFFSET_ALIGN(sizeof(SegmentedPoolNode) + redzoneSize);
- VALGRIND_MEMPOOL_ALLOC(startOfPool, p, size);
+ VALGRIND_MEMPOOL_ALLOC(_startOfPool, p, size);
#ifdef USE_VALGRIND
node->valgrind_handle = VALGRIND_CREATE_BLOCK(p, size,
"SegmentedPoolBlock");
@@ -139,7 +138,7 @@ void SegmentedPool::deallocate(void *ptr) {
node->size = 0;
assert(node->pool == this);
- VALGRIND_MEMPOOL_FREE(startOfPool, ptr);
+ VALGRIND_MEMPOOL_FREE(_startOfPool, ptr);
VALGRIND_DISCARD(node->valgrind_handle);
// con->Printf("Free Node 0x%08X\n", node);
@@ -150,7 +149,7 @@ void SegmentedPool::deallocate(void *ptr) {
lastFree->nextFree = node;
lastFree = lastFree->nextFree;
}
- ++freeNodeCount;
+ ++_freeNodeCount;
}
}
@@ -160,18 +159,18 @@ void SegmentedPool::printInfo() {
SegmentedPoolNode *node;
con->Printf(" start address 0x%X\tend address 0x%X\tnodeOffset 0x%X\n",
- startOfPool, endOfPool, nodeOffset);
- con->Printf(" nodeCapacity %d b\n total nodes %d\tfree nodes %d\n",
- nodeCapacity, nodes, freeNodeCount);
+ _startOfPool, _endOfPool, _nodeOffset);
+ con->Printf(" _nodeCapacity %d b\n total _nodes %d\tfree _nodes %d\n",
+ _nodeCapacity, _nodes, _freeNodeCount);
con->Printf(" total memory: %d\tfree memory: %d\n",
- nodeCapacity * nodes, nodeCapacity * freeNodeCount);
+ _nodeCapacity * _nodes, _nodeCapacity * _freeNodeCount);
max = 0;
- min = nodeCapacity;
+ min = _nodeCapacity;
total = 0;
- for (i = 0; i < nodes; ++i) {
- node = reinterpret_cast<SegmentedPoolNode *>(startOfPool + i * nodeOffset);
+ for (i = 0; i < _nodes; ++i) {
+ node = reinterpret_cast<SegmentedPoolNode *>(_startOfPool + i * _nodeOffset);
if (node->size > 0) {
max = node->size > max ? node->size : max;
min = node->size < min ? node->size : min;
@@ -179,17 +178,17 @@ void SegmentedPool::printInfo() {
}
}
- if (nodes > freeNodeCount) {
+ if (_nodes > _freeNodeCount) {
con->Printf(" smallest node: %d b\tlargest node: %d b\taverage size: %d b\n",
- min, max, total / (nodes - freeNodeCount));
+ min, max, total / (_nodes - _freeNodeCount));
} else {
con->Printf(" Empty pool!!!\n");
}
}
SegmentedPoolNode *SegmentedPool::getPoolNode(void *ptr) {
- uint32 pos = (reinterpret_cast<uint8 *>(ptr) - startOfPool) / nodeOffset;
- return reinterpret_cast<SegmentedPoolNode *>(startOfPool + pos * nodeOffset);
+ uint32 pos = (reinterpret_cast<uint8 *>(ptr) - _startOfPool) / _nodeOffset;
+ return reinterpret_cast<SegmentedPoolNode *>(_startOfPool + pos * _nodeOffset);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/kernel/segmented_pool.h b/engines/ultima/ultima8/kernel/segmented_pool.h
index 4fc7fe5..663cc1a 100644
--- a/engines/ultima/ultima8/kernel/segmented_pool.h
+++ b/engines/ultima/ultima8/kernel/segmented_pool.h
@@ -52,31 +52,31 @@ public:
void deallocate(void *ptr) override;
bool isFull() override {
- return freeNodeCount == 0;
+ return _freeNodeCount == 0;
}
bool isEmpty() override {
- return freeNodeCount == nodes;
+ return _freeNodeCount == _nodes;
}
bool inPool(void *ptr) override {
- return (ptr > startOfPool && ptr < endOfPool);
+ return (ptr > _startOfPool && ptr < _endOfPool);
}
void printInfo() override;
size_t getNodeCapacity() {
- return nodeCapacity;
+ return _nodeCapacity;
}
SegmentedPoolNode *getPoolNode(void *ptr);
private:
- uint8 *startOfPool;
- uint8 *endOfPool;
+ uint8 *_startOfPool;
+ uint8 *_endOfPool;
- size_t nodeOffset;
- size_t nodeCapacity;
- uint32 nodes;
- uint32 freeNodeCount;
+ size_t _nodeOffset;
+ size_t _nodeCapacity;
+ uint32 _nodes;
+ uint32 _freeNodeCount;
SegmentedPoolNode *firstFree;
SegmentedPoolNode *lastFree;
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 0eaee68..5ff49df 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -134,7 +134,7 @@ Ultima8Engine::Ultima8Engine(OSystem *syst, const Ultima::UltimaGameDescription
_avatarInStasis(false), _paintEditorItems(false), _inversion(0), _painting(false),
_showTouching(false), _timeOffset(0), _hasCheated(false), _cheatsEnabled(false),
_drawRenderStats(false), _ttfOverrides(false), _audioMixer(0) {
- application = this;
+ _application = this;
for (uint16 key = 0; key < HID_LAST; ++key) {
_lastDown[key] = false;
@@ -337,10 +337,10 @@ void Ultima8Engine::startup() {
CoreApp::startup();
bool dataoverride;
- if (!settingman->get("dataoverride", dataoverride,
+ if (!_settingMan->get("dataoverride", dataoverride,
SettingManager::DOM_GLOBAL))
dataoverride = false;
- filesystem->initBuiltinData(dataoverride);
+ _fileSystem->initBuiltinData(dataoverride);
_kernel = new Kernel();
_memoryManager = new MemoryManager();
@@ -448,7 +448,7 @@ void Ultima8Engine::startup() {
void Ultima8Engine::startupGame() {
con->SetAutoPaint(conAutoPaint);
- pout << Std::endl << "-- Initializing Game: " << gameinfo->name << " --" << Std::endl;
+ pout << Std::endl << "-- Initializing Game: " << _gameInfo->name << " --" << Std::endl;
GraphicSysInit();
@@ -492,7 +492,7 @@ void Ultima8Engine::startupGame() {
con->AddConsoleCommand("MainActor::toggleCombat",
MainActor::ConCmd_toggleCombat);
- _gameData = new GameData(gameinfo);
+ _gameData = new GameData(_gameInfo);
Std::string bindingsfile;
if (GAME_IS_U8) {
@@ -502,7 +502,7 @@ void Ultima8Engine::startupGame() {
}
if (!bindingsfile.empty()) {
// system-wide config
- if (configfileman->readConfigFile(bindingsfile,
+ if (_configFileMan->readConfigFile(bindingsfile,
"bindings", true))
con->Printf(MM_INFO, "%s... Ok\n", bindingsfile.c_str());
else
@@ -528,20 +528,20 @@ void Ultima8Engine::startupGame() {
_game = Game::createGame(getGameInfo());
- settingman->setDefault("ttf", false);
- settingman->get("ttf", _ttfOverrides);
+ _settingMan->setDefault("ttf", false);
+ _settingMan->get("ttf", _ttfOverrides);
- settingman->setDefault("_frameSkip", false);
- settingman->get("_frameSkip", _frameSkip);
+ _settingMan->setDefault("_frameSkip", false);
+ _settingMan->get("_frameSkip", _frameSkip);
- settingman->setDefault("_frameLimit", true);
- settingman->get("_frameLimit", _frameLimit);
+ _settingMan->setDefault("_frameLimit", true);
+ _settingMan->get("_frameLimit", _frameLimit);
- settingman->setDefault("_interpolate", true);
- settingman->get("_interpolate", _interpolate);
+ _settingMan->setDefault("_interpolate", true);
+ _settingMan->get("_interpolate", _interpolate);
- settingman->setDefault("cheat", false);
- settingman->get("cheat", _cheatsEnabled);
+ _settingMan->setDefault("cheat", false);
+ _settingMan->get("cheat", _cheatsEnabled);
_game->loadFiles();
_gameData->setupFontOverrides();
@@ -567,7 +567,7 @@ void Ultima8Engine::startupPentagramMenu() {
pout << Std::endl << "-- Initializing Pentagram Menu -- " << Std::endl;
setupGame(getGameInfo("pentagram"));
- assert(gameinfo);
+ assert(_gameInfo);
GraphicSysInit();
@@ -692,7 +692,7 @@ void Ultima8Engine::changeGame(istring newgame) {
void Ultima8Engine::menuInitMinimal(istring gamename) {
// Only if in the pentagram menu
- if (gameinfo->name != "pentagram") return;
+ if (_gameInfo->name != "pentagram") return;
GameInfo *info = getGameInfo(gamename);
if (!info) info = getGameInfo("pentagram");
assert(info);
@@ -724,12 +724,12 @@ void Ultima8Engine::DeclareArgs() {
}
void Ultima8Engine::runGame() {
- isRunning = true;
+ _isRunning = true;
int32 next_ticks = g_system->getMillis() * 3; // Next time is right now!
Common::Event event;
- while (isRunning) {
+ while (_isRunning) {
_inBetweenFrame = true; // Will get set false if it's not an _inBetweenFrame
if (!_frameLimit) {
@@ -771,7 +771,7 @@ void Ultima8Engine::runGame() {
}
// get & handle all events in queue
- while (isRunning && _events->pollEvent(event)) {
+ while (_isRunning && _events->pollEvent(event)) {
handleEvent(event);
}
handleDelayedEvents();
@@ -887,17 +887,17 @@ void Ultima8Engine::paint() {
}
void Ultima8Engine::GraphicSysInit() {
- settingman->setDefault("_fullScreen", false);
- settingman->setDefault("width", SCREEN_WIDTH);
- settingman->setDefault("height", SCREEN_HEIGHT);
- settingman->setDefault("bpp", 32);
+ _settingMan->setDefault("_fullScreen", false);
+ _settingMan->setDefault("width", SCREEN_WIDTH);
+ _settingMan->setDefault("height", SCREEN_HEIGHT);
+ _settingMan->setDefault("bpp", 32);
bool new_fullscreen;
int width, height, bpp;
- settingman->get("_fullScreen", new_fullscreen);
- settingman->get("width", width);
- settingman->get("height", height);
- settingman->get("bpp", bpp);
+ _settingMan->get("_fullScreen", new_fullscreen);
+ _settingMan->get("width", width);
+ _settingMan->get("height", height);
+ _settingMan->get("bpp", bpp);
#ifdef UNDER_CE
width = 240;
@@ -906,10 +906,10 @@ void Ultima8Engine::GraphicSysInit() {
#if 0
// store values in user's config file
- settingman->set("width", width);
- settingman->set("height", height);
- settingman->set("bpp", bpp);
- settingman->set("_fullScreen", new_fullscreen);
+ _settingMan->set("width", width);
+ _settingMan->set("height", height);
+ _settingMan->set("bpp", bpp);
+ _settingMan->set("_fullScreen", new_fullscreen);
#endif
if (_screen) {
@@ -953,7 +953,7 @@ void Ultima8Engine::GraphicSysInit() {
Std::string alt_confont;
bool confont_loaded = false;
- if (settingman->get("console_font", alt_confont)) {
+ if (_settingMan->get("console_font", alt_confont)) {
con->Print(MM_INFO, "Alternate console font found...\n");
confont_loaded = LoadConsoleFont(alt_confont);
}
@@ -989,8 +989,8 @@ void Ultima8Engine::GraphicSysInit() {
showSplashScreen();
bool ttf_antialiasing = true;
- settingman->setDefault("ttf_antialiasing", true);
- settingman->get("ttf_antialiasing", ttf_antialiasing);
+ _settingMan->setDefault("ttf_antialiasing", true);
+ _settingMan->get("ttf_antialiasing", ttf_antialiasing);
_fontManager = new FontManager(ttf_antialiasing);
_paletteManager = new PaletteManager(new_screen);
@@ -1002,20 +1002,20 @@ void Ultima8Engine::GraphicSysInit() {
_fontManager->loadTTFont(2, "Vera.ttf", 8, 0xA0A0A0, 0);
bool faded_modal = true;
- settingman->setDefault("fadedModal", faded_modal);
- settingman->get("fadedModal", faded_modal);
+ _settingMan->setDefault("fadedModal", faded_modal);
+ _settingMan->get("fadedModal", faded_modal);
DesktopGump::SetFadedModal(faded_modal);
paint();
}
void Ultima8Engine::changeVideoMode(int width, int height, int new_fullscreen) {
- if (new_fullscreen == -2) settingman->set("_fullScreen", !_fullScreen);
- else if (new_fullscreen == 0) settingman->set("_fullScreen", false);
- else if (new_fullscreen == 1) settingman->set("_fullScreen", true);
+ if (new_fullscreen == -2) _settingMan->set("_fullScreen", !_fullScreen);
+ else if (new_fullscreen == 0) _settingMan->set("_fullScreen", false);
+ else if (new_fullscreen == 1) _settingMan->set("_fullScreen", true);
- if (width > 0) settingman->set("width", width);
- if (height > 0) settingman->set("height", height);
+ if (width > 0) _settingMan->set("width", width);
+ if (height > 0) _settingMan->set("height", height);
GraphicSysInit();
}
@@ -1023,7 +1023,7 @@ void Ultima8Engine::changeVideoMode(int width, int height, int new_fullscreen) {
bool Ultima8Engine::LoadConsoleFont(Std::string confontini) {
// try to load the file
con->Printf(MM_INFO, "Loading console font config: %s... ", confontini.c_str());
- if (configfileman->readConfigFile(confontini, "confont", true))
+ if (_configFileMan->readConfigFile(confontini, "confont", true))
pout << "Ok" << Std::endl;
else {
pout << "Failed" << Std::endl;
@@ -1128,7 +1128,7 @@ void Ultima8Engine::handleEvent(const Common::Event &event) {
break;
case Common::EVENT_QUIT:
- isRunning = false;
+ _isRunning = false;
break;
default:
@@ -1326,7 +1326,7 @@ bool Ultima8Engine::saveGame(int slot, const Std::string &desc, bool ignore_moda
return false;
}
- settingman->set("lastSave", slot);
+ _settingMan->set("lastSave", slot);
return saveGameState(slot, desc).getCode() == Common::kNoError;
}
@@ -1344,7 +1344,7 @@ Common::Error Ultima8Engine::saveGameStream(Common::WriteStream *stream, bool is
// We'll make it 2KB initially
OAutoBufferDataSource buf(2048);
- gameinfo->save(&buf);
+ _gameInfo->save(&buf);
sgw->writeFile("GAME", &buf);
buf.clear();
@@ -1517,7 +1517,7 @@ bool Ultima8Engine::newGame(int saveSlot) {
_game->startInitialUsecode(saveSlot);
- settingman->set("lastSave", saveSlot);
+ _settingMan->set("lastSave", saveSlot);
return true;
}
@@ -1538,14 +1538,14 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
if (state == SavegameReader::SAVE_CORRUPT) {
Error("Invalid or corrupt savegame", "Error Loading savegame");
delete sg;
- settingman->set("lastSave", "");
+ _settingMan->set("lastSave", "");
return Common::kReadingFailed;
}
if (state != SavegameReader::SAVE_VALID) {
Error("Unsupported savegame version", "Error Loading savegame");
delete sg;
- settingman->set("lastSave", "");
+ _settingMan->set("lastSave", "");
return Common::kReadingFailed;
}
@@ -1561,15 +1561,15 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
return Common::kReadingFailed;
}
- if (!gameinfo->match(saveinfo)) {
+ if (!_gameInfo->match(saveinfo)) {
Std::string message = "Game mismatch\n";
- message += "Running _game: " + gameinfo->getPrintDetails() + "\n";
+ message += "Running _game: " + _gameInfo->getPrintDetails() + "\n";
message += "Savegame : " + saveinfo.getPrintDetails();
#ifdef DEBUG
bool ignore;
- settingman->setDefault("ignore_savegame_mismatch", false);
- settingman->get("ignore_savegame_mismatch", ignore);
+ _settingMan->setDefault("ignore_savegame_mismatch", false);
+ _settingMan->get("ignore_savegame_mismatch", ignore);
if (!ignore) {
Error(message, "Error Loading savegame " + filename);
@@ -1578,7 +1578,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
}
perr << message << Std::endl;
#else
- settingman->set("lastSave", "");
+ _settingMan->set("lastSave", "");
Error(message, "Error Loading savegame");
return Common::kReadingFailed;
#endif
@@ -1669,7 +1669,7 @@ Common::Error Ultima8Engine::loadGameStream(Common::SeekableReadStream *stream)
pout << "Done" << Std::endl;
- settingman->set("lastSave", -1);
+ _settingMan->set("lastSave", -1);
delete sg;
return Common::kNoError;
@@ -1804,7 +1804,7 @@ void Ultima8Engine::ConCmd_newGame(const Console::ArgvType &argv) {
}
void Ultima8Engine::ConCmd_quit(const Console::ArgvType &argv) {
- Ultima8Engine::get_instance()->isRunning = false;
+ Ultima8Engine::get_instance()->_isRunning = false;
}
void Ultima8Engine::ConCmd_drawRenderStats(const Console::ArgvType &argv) {
@@ -1824,7 +1824,7 @@ void Ultima8Engine::ConCmd_engineStats(const Console::ArgvType &argv) {
void Ultima8Engine::ConCmd_changeGame(const Console::ArgvType &argv) {
if (argv.size() == 1) {
- pout << "Current _game is: " << Ultima8Engine::get_instance()->gameinfo->name << Std::endl;
+ pout << "Current _game is: " << Ultima8Engine::get_instance()->_gameInfo->name << Std::endl;
} else {
Ultima8Engine::get_instance()->changeGame(argv[1]);
}
@@ -1833,7 +1833,7 @@ void Ultima8Engine::ConCmd_changeGame(const Console::ArgvType &argv) {
void Ultima8Engine::ConCmd_listGames(const Console::ArgvType &argv) {
Ultima8Engine *app = Ultima8Engine::get_instance();
Std::vector<istring> games;
- games = app->settingman->listGames();
+ games = app->_settingMan->listGames();
Std::vector<istring>::iterator iter;
for (iter = games.begin(); iter != games.end(); ++iter) {
istring _game = *iter;
@@ -1934,10 +1934,10 @@ void Ultima8Engine::ConCmd_memberVar(const Console::ArgvType &argv) {
// Set config value
if (argv.size() >= 4 && ini && *ini && (argv[3] == "yes" || argv[3] == "true")) {
- if (b) g->settingman->set(ini, *b);
- else if (istr) g->settingman->set(ini, *istr);
- else if (i) g->settingman->set(ini, *i);
- else if (str) g->settingman->set(ini, *str);
+ if (b) g->_settingMan->set(ini, *b);
+ else if (istr) g->_settingMan->set(ini, *istr);
+ else if (i) g->_settingMan->set(ini, *i);
+ else if (str) g->_settingMan->set(ini, *str);
}
}
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index f669485..fd0c8ae 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -221,7 +221,7 @@ public:
void GUIError(const Common::String &msg);
static Ultima8Engine *get_instance() {
- return p_dynamic_cast<Ultima8Engine *>(application);
+ return p_dynamic_cast<Ultima8Engine *>(_application);
}
void startup();
diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index d0b972a..3e42cb0 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -165,9 +165,9 @@ void UCMachine::execProcess(UCProcess *p) {
cs.seek(p->ip);
#ifdef DEBUG
- if (trace_show(p->pid, p->item_num, p->classid)) {
- pout << Std::hex << "running process " << p->pid
- << ", item " << p->item_num << ", type " << p->type
+ if (trace_show(p->_pid, p->_itemNum, p->classid)) {
+ pout << Std::hex << "running process " << p->_pid
+ << ", item " << p->_itemNum << ", type " << p->type
<< ", class " << p->classid << ", offset " << p->ip
<< Std::dec << Std::endl;
}
@@ -184,8 +184,8 @@ void UCMachine::execProcess(UCProcess *p) {
#ifdef DEBUG
uint16 trace_classid = p->classid;
- ObjId trace_objid = p->item_num;
- ProcId trace_pid = p->pid;
+ ObjId trace_objid = p->_itemNum;
+ ProcId trace_pid = p->_pid;
#endif
LOGPF(("sp = %02X; %04X:%04X: %02X\t",
@@ -248,7 +248,7 @@ void UCMachine::execProcess(UCProcess *p) {
//! probably a member of the Process?
//! is the result in 0x08 and 0x6D the same var?
LOGPF(("pop dword\tprocess result\n"));
- p->result = p->stack.pop4();
+ p->_result = p->stack.pop4();
break;
case 0x09:
@@ -1134,7 +1134,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 4B xx
// push 32 bit pointer address of BP+XX
si8a = static_cast<int8>(cs.read1());
- p->stack.push4(stackToPtr(p->pid, p->bp + si8a));
+ p->stack.push4(stackToPtr(p->_pid, p->bp + si8a));
LOGPF(("push addr\t%s\n", print_bp(si8a)));
break;
@@ -1277,13 +1277,13 @@ void UCMachine::execProcess(UCProcess *p) {
// this seems to link two processes (two pids are popped)
// the '01 01' variety most likely causes one process
// to wait for the other to finish.
- // the first pid pushed is often the current pid in U8
+ // the first _pid pushed is often the current _pid in U8
// question: can multiple processes be waiting for a single proc?
// can a process be waiting for multiple processes?
// 'implies' seems to push a value too, although it is very
- // often ignored. It looks like it's a pid, but which one?
+ // often ignored. It looks like it's a _pid, but which one?
// additionally, it is possible that 'implies' puts the result
// of a process in the 'process result' variable,
@@ -1296,7 +1296,7 @@ void UCMachine::execProcess(UCProcess *p) {
cs.read2(); // skip the 01 01
ui16a = p->stack.pop2();
ui16b = p->stack.pop2();
- p->stack.push2(ui16a); //!! which pid do we need to push!?
+ p->stack.push2(ui16a); //!! which _pid do we need to push!?
LOGPF(("implies\n"));
Process *proc = Kernel::get_instance()->getProcess(ui16b);
@@ -1355,9 +1355,9 @@ void UCMachine::execProcess(UCProcess *p) {
p->temp32 = Kernel::get_instance()->addProcessExec(newproc);
#ifdef DEBUG
- if (trace_show(p->pid, p->item_num, p->classid)) {
- pout << Std::hex << "(still) running process " << p->pid
- << ", item " << p->item_num << ", type " << p->type
+ if (trace_show(p->_pid, p->_itemNum, p->classid)) {
+ pout << Std::hex << "(still) running process " << p->_pid
+ << ", item " << p->_itemNum << ", type " << p->type
<< ", class " << p->classid << ", offset " << p->ip
<< Std::dec << Std::endl;
}
@@ -1399,9 +1399,9 @@ void UCMachine::execProcess(UCProcess *p) {
uint16 newpid = Kernel::get_instance()->addProcessExec(newproc);
#ifdef DEBUG
- if (trace_show(p->pid, p->item_num, p->classid)) {
- pout << Std::hex << "(still) running process " << p->pid
- << ", item " << p->item_num << ", class " << p->classid
+ if (trace_show(p->_pid, p->_itemNum, p->classid)) {
+ pout << Std::hex << "(still) running process " << p->_pid
+ << ", item " << p->_itemNum << ", class " << p->classid
<< ", offset " << p->ip << Std::dec << Std::endl;
}
#endif
@@ -1409,7 +1409,7 @@ void UCMachine::execProcess(UCProcess *p) {
// as with 'spawn', run execute the spawned process once
// immediately
- p->stack.push2(newpid); //! push pid of newproc?
+ p->stack.push2(newpid); //! push _pid of newproc?
// cede = true;
}
@@ -1418,8 +1418,8 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x59:
// 59
// push process id
- p->stack.push2(p->pid);
- LOGPF(("push\t\tpid = %04Xh\n", p->pid));
+ p->stack.push2(p->_pid);
+ LOGPF(("push\t\tpid = %04Xh\n", p->_pid));
break;
case 0x5A:
@@ -1555,7 +1555,7 @@ void UCMachine::execProcess(UCProcess *p) {
// and add it to the "Free Me" list of the process
si8a = cs.read1(); // index
ui8a = cs.read1(); // type
- LOGPF(("param pid chg\t%s, type=%u\n", print_bp(si8a), ui8a));
+ LOGPF(("param _pid chg\t%s, type=%u\n", print_bp(si8a), ui8a));
ui16a = p->stack.access2(p->bp + si8a);
switch (ui8a) {
@@ -1579,7 +1579,7 @@ void UCMachine::execProcess(UCProcess *p) {
break;
default:
ui16b = 0;
- perr << "Error: invalid param pid change type (" << ui8a
+ perr << "Error: invalid param _pid change type (" << ui8a
<< ")" << Std::endl;
error = true;
}
@@ -1593,7 +1593,7 @@ void UCMachine::execProcess(UCProcess *p) {
// (of which process? pop anything?)
// (also see comment for 0x54 'implies')
LOGPF(("push dword\tprocess result\n"));
- p->stack.push4(p->result);
+ p->stack.push4(p->_result);
break;
case 0x6E:
@@ -1610,7 +1610,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 6F xx
// push 32 pointer address of SP-xx
si8a = static_cast<int8>(cs.read1());
- p->stack.push4(stackToPtr(p->pid, static_cast<uint16>(p->stack.getSP() - si8a)));
+ p->stack.push4(stackToPtr(p->_pid, static_cast<uint16>(p->stack.getSP() - si8a)));
LOGPF(("push addr\t%s\n", print_sp(-si8a)));
break;
@@ -1934,7 +1934,7 @@ void UCMachine::execProcess(UCProcess *p) {
LOGPF(("process exclude"));
if (Kernel::get_instance()->
- getNumProcesses(p->item_num, p->type) > 1) {
+ getNumProcesses(p->_itemNum, p->_type) > 1) {
// another process with this (object,type) is already running
p->terminateDeferred();
LOGPF(("\t(terminating)\n"));
@@ -1972,13 +1972,13 @@ void UCMachine::execProcess(UCProcess *p) {
p->ip = static_cast<uint16>(cs.getPos()); // TRUNCATES!
// check if we suspended ourselves
- if ((p->flags & Process::PROC_SUSPENDED) != 0)
+ if ((p->_flags & Process::PROC_SUSPENDED) != 0)
cede = true;
} // while(!cede && !error && !p->terminated && !p->terminate_deferred)
if (error) {
perr.Print("Process %d caused an error at %04X:%04X. Killing process.\n",
- p->pid, p->classid, p->ip);
+ p->_pid, p->classid, p->ip);
p->terminateDeferred();
}
}
@@ -2079,8 +2079,8 @@ uint32 UCMachine::stringToPtr(uint16 s) {
}
//static
-uint32 UCMachine::stackToPtr(uint16 pid, uint16 offset) {
- uint32 ptr = SEG_STACK + pid;
+uint32 UCMachine::stackToPtr(uint16 _pid, uint16 offset) {
+ uint32 ptr = SEG_STACK + _pid;
ptr <<= 16;
ptr += offset;
return ptr;
@@ -2117,11 +2117,11 @@ bool UCMachine::assignPointer(uint32 ptr, const uint8 *data, uint32 size) {
UCProcess *proc = p_dynamic_cast<UCProcess *>
(Kernel::get_instance()->getProcess(segment));
- // reference to the stack of pid 'segment'
+ // reference to the stack of _pid 'segment'
if (!proc) {
// segfault :-)
perr << "Trying to access stack of non-existent "
- << "process (pid: " << segment << ")" << Std::endl;
+ << "process (_pid: " << segment << ")" << Std::endl;
return false;
} else {
proc->stack.assign(offset, data, size);
@@ -2154,11 +2154,11 @@ bool UCMachine::dereferencePointer(uint32 ptr, uint8 *data, uint32 size) {
UCProcess *proc = p_dynamic_cast<UCProcess *>
(Kernel::get_instance()->getProcess(segment));
- // reference to the stack of pid 'segment'
+ // reference to the stack of _pid 'segment'
if (!proc) {
// segfault :-)
perr << "Trying to access stack of non-existent "
- << "process (pid: " << segment << ")" << Std::endl;
+ << "process (_pid: " << segment << ")" << Std::endl;
return false;
} else {
Std::memcpy(data, proc->stack.access(offset), size);
@@ -2193,11 +2193,11 @@ uint16 UCMachine::ptrToObject(uint32 ptr) {
UCProcess *proc = p_dynamic_cast<UCProcess *>
(Kernel::get_instance()->getProcess(segment));
- // reference to the stack of pid 'segment'
+ // reference to the stack of _pid 'segment'
if (!proc) {
// segfault :-)
perr << "Trying to access stack of non-existent "
- << "process (pid: " << segment << ")" << Std::endl;
+ << "process (_pid: " << segment << ")" << Std::endl;
return 0;
} else {
return proc->stack.access2(offset);
@@ -2394,17 +2394,17 @@ void UCMachine::ConCmd_setGlobal(const Console::ArgvType &argv) {
void UCMachine::ConCmd_tracePID(const Console::ArgvType &argv) {
if (argv.size() != 2) {
- pout << "Usage: UCMachine::tracePID pid" << Std::endl;
+ pout << "Usage: UCMachine::tracePID _pid" << Std::endl;
return;
}
- uint16 pid = static_cast<uint16>(strtol(argv[1].c_str(), 0, 0));
+ uint16 _pid = static_cast<uint16>(strtol(argv[1].c_str(), 0, 0));
UCMachine *uc = UCMachine::get_instance();
uc->tracing_enabled = true;
- uc->trace_PIDs.insert(pid);
+ uc->trace_PIDs.insert(_pid);
- pout << "UCMachine: tracing process " << pid << Std::endl;
+ pout << "UCMachine: tracing process " << _pid << Std::endl;
}
void UCMachine::ConCmd_traceObjID(const Console::ArgvType &argv) {
diff --git a/engines/ultima/ultima8/usecode/uc_process.cpp b/engines/ultima/ultima8/usecode/uc_process.cpp
index 4962252..496cb24 100644
--- a/engines/ultima/ultima8/usecode/uc_process.cpp
+++ b/engines/ultima/ultima8/usecode/uc_process.cpp
@@ -78,14 +78,14 @@ void UCProcess::load(uint16 classid_, uint16 offset_, uint32 this_ptr,
// then, push the new this pointer
if (thissp != 0)
- stack.push4(UCMachine::stackToPtr(pid, thissp));
+ stack.push4(UCMachine::stackToPtr(_pid, thissp));
// finally, call the specified function
call(classid_, offset_);
}
void UCProcess::run() {
- if (flags & PROC_SUSPENDED)
+ if (_flags & PROC_SUSPENDED)
return;
// pass to UCMachine for execution
diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index c4f547e..e9b1de1 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -76,16 +76,16 @@ Actor::~Actor() {
}
uint16 Actor::assignObjId() {
- if (objid == 0xFFFF)
- objid = ObjectManager::get_instance()->assignActorObjId(this);
+ if (_objId == 0xFFFF)
+ _objId = ObjectManager::get_instance()->assignActorObjId(this);
Std::list<Item *>::iterator iter;
for (iter = contents.begin(); iter != contents.end(); ++iter) {
(*iter)->assignObjId();
- (*iter)->setParent(objid);
+ (*iter)->setParent(_objId);
}
- return objid;
+ return _objId;
}
int16 Actor::getMaxMana() const {
@@ -183,7 +183,7 @@ bool Actor::giveTreasure() {
Item::FLG_DISPOSABLE,//flags
0, // npcnum,
0, // mapnum
- 0, true); // ext.flags,objid
+ 0, true); // ext.flags,_objId
item->moveToContainer(this);
item->randomGumpLocation();
break;
@@ -303,7 +303,7 @@ bool Actor::giveTreasure() {
Item::FLG_DISPOSABLE, // flags
0, // npcnum,
0, // mapnum
- 0, true); // ext. flags, objid
+ 0, true); // ext. flags, _objId
item->moveToContainer(this);
item->randomGumpLocation();
item->callUsecodeEvent_combine(); // this sets the right frame
@@ -344,7 +344,7 @@ bool Actor::giveTreasure() {
Item::FLG_DISPOSABLE, // flags
0, // npcnum,
0, // mapnum
- 0, true); // ext. flags, objid
+ 0, true); // ext. flags, _objId
item->moveToContainer(this);
item->randomGumpLocation();
}
@@ -426,7 +426,7 @@ void Actor::teleport(int newmap, int32 newx, int32 newy, int32 newz) {
}
// Move it to another map
else {
- World::get_instance()->etherealRemove(objid);
+ World::get_instance()->etherealRemove(_objId);
x = newx;
y = newy;
z = newz;
@@ -618,7 +618,7 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
pout << "Damage: " << damage << Std::endl;
}
- if (damage >= 4 && objid == 1 && attacker) {
+ if (damage >= 4 && _objId == 1 && attacker) {
// play blood sprite
int start = 0, end = 12;
if (dir > 2) {
@@ -642,7 +642,7 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
setHP(getMaxHP());
AudioProcess *audioproc = AudioProcess::get_instance();
- if (audioproc) audioproc->playSFX(59, 0x60, objid, 0);
+ if (audioproc) audioproc->playSFX(59, 0x60, _objId, 0);
clearActorFlag(ACT_WITHSTANDDEATH);
} else {
die(damage_type);
@@ -655,7 +655,7 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
}
ProcId fallingprocid = 0;
- if (objid == 1 && damage > 0) {
+ if (_objId == 1 && damage > 0) {
if ((damage_type & WeaponInfo::DMG_FALLING) && damage >= 6) {
// high falling damage knocks you down
doAnim(Animation::fallBackwards, 8);
@@ -669,7 +669,7 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
}
// if avatar was blocking; do a quick stopBlock/startBlock and play SFX
- if (objid == 1 && getLastAnim() == Animation::startBlock) {
+ if (_objId == 1 && getLastAnim() == Animation::startBlock) {
ProcId anim1pid = doAnim(Animation::stopBlock, 8);
ProcId anim2pid = doAnim(Animation::startBlock, 8);
@@ -685,13 +685,13 @@ void Actor::receiveHit(uint16 other, int dir, int damage, uint16 damage_type) {
else
sfx = 20 + (getRandom() % 3); // constants!
AudioProcess *audioproc = AudioProcess::get_instance();
- if (audioproc) audioproc->playSFX(sfx, 0x60, objid, 0);
+ if (audioproc) audioproc->playSFX(sfx, 0x60, _objId, 0);
return;
}
// TODO: target needs to stumble/fall/call for help/...(?)
- if (objid != 1) {
+ if (_objId != 1) {
ObjId target = 1;
if (attacker)
target = attacker->getObjId();
@@ -797,7 +797,7 @@ ProcId Actor::die(uint16 damageType) {
Item::FLG_FAST_ONLY, //flags,
0, // npcnum
0, // mapnum
- 0, true // ext. flags, objid
+ 0, true // ext. flags, _objId
);
piece->move(x - 128 + 32 * (getRandom() % 6),
y - 128 + 32 * (getRandom() % 6),
@@ -819,7 +819,7 @@ void Actor::killAllButCombatProcesses() {
for (; iter != endproc; ++iter) {
Process *p = *iter;
if (!p) continue;
- if (p->getItemNum() != objid) continue;
+ if (p->getItemNum() != _objId) continue;
if (p->is_terminated()) continue;
uint16 type = p->getType();
@@ -838,7 +838,7 @@ ProcId Actor::killAllButFallAnims(bool death) {
if (death) {
// if dead, we want to kill everything but animations
- kernel->killProcessesNotOfType(objid, 0xF0, true);
+ kernel->killProcessesNotOfType(_objId, 0xF0, true);
} else {
// otherwise, need to focus on combat, so kill everything else
killAllButCombatProcesses();
@@ -850,7 +850,7 @@ ProcId Actor::killAllButFallAnims(bool death) {
for (; iter != endproc; ++iter) {
ActorAnimProcess *p = p_dynamic_cast<ActorAnimProcess *>(*iter);
if (!p) continue;
- if (p->getItemNum() != objid) continue;
+ if (p->getItemNum() != _objId) continue;
if (p->is_terminated()) continue;
Animation::Sequence action = p->getAction();
@@ -969,7 +969,7 @@ int Actor::calculateAttackDamage(uint16 other, int damage, uint16 damage_type) {
}
CombatProcess *Actor::getCombatProcess() {
- Process *p = Kernel::get_instance()->findProcess(objid, 0xF2); // CONSTANT!
+ Process *p = Kernel::get_instance()->findProcess(_objId, 0xF2); // CONSTANT!
if (!p) return 0;
CombatProcess *cp = p_dynamic_cast<CombatProcess *>(p);
assert(cp);
diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
index 85be0f7..44ec711 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
@@ -62,36 +62,36 @@ static const int watchactor = WATCHACTOR;
// p_dynamic_cast stuff
DEFINE_RUNTIME_CLASSTYPE_CODE(ActorAnimProcess, Process)
-ActorAnimProcess::ActorAnimProcess() : Process(), tracker(0) {
+ActorAnimProcess::ActorAnimProcess() : Process(), _tracker(0) {
}
ActorAnimProcess::ActorAnimProcess(Actor *actor_, Animation::Sequence action_,
uint32 dir_, uint32 steps_) {
assert(actor_);
- item_num = actor_->getObjId();
- dir = dir_;
- action = action_;
- steps = steps_;
-
- type = 0x00F0; // CONSTANT !
- firstframe = true;
- tracker = 0;
- currentstep = 0;
+ _itemNum = actor_->getObjId();
+ _dir = dir_;
+ _action = action_;
+ _steps = steps_;
+
+ _type = 0x00F0; // CONSTANT !
+ _firstFrame = true;
+ _tracker = 0;
+ _currentStep = 0;
}
bool ActorAnimProcess::init() {
- repeatcounter = 0;
- animAborted = false;
- attackedSomething = false;
+ _repeatCounter = 0;
+ _animAborted = false;
+ _attackedSomething = false;
- Actor *actor = getActor(item_num);
+ Actor *actor = getActor(_itemNum);
assert(actor);
- if (dir == 8)
- dir = actor->getDir();
+ if (_dir == 8)
+ _dir = actor->getDir();
- if (dir > 7) {
+ if (_dir > 7) {
// invalid direction
return false;
}
@@ -108,30 +108,30 @@ bool ActorAnimProcess::init() {
//! Or maybe wait until the previous one finishes?
perr << "ActorAnimProcess [" << getPid() << "]: ANIMLOCK set on actor "
- << item_num << Std::endl;
+ << _itemNum << Std::endl;
// for now, just don't play this one.
return false;
}
- tracker = new AnimationTracker();
- if (!tracker->init(actor, action, dir)) {
- delete tracker;
- tracker = 0;
+ _tracker = new AnimationTracker();
+ if (!_tracker->init(actor, _action, _dir)) {
+ delete _tracker;
+ _tracker = 0;
return false;
}
actor->setActorFlag(Actor::ACT_ANIMLOCK);
- actor->lastanim = action;
- actor->direction = dir;
+ actor->lastanim = _action;
+ actor->direction = _dir;
#ifdef WATCHACTOR
- if (item_num == watchactor)
+ if (_itemNum == watchactor)
pout << "Animation [" << Kernel::get_instance()->getFrameNum()
<< "] ActorAnimProcess " << getPid() << " created ("
- << action << "," << dir << ") steps " << steps << Std::endl;
+ << _action << "," << _dir << ") _steps " << _steps << Std::endl;
#endif
return true;
@@ -139,7 +139,7 @@ bool ActorAnimProcess::init() {
void ActorAnimProcess::run() {
- if (firstframe) {
+ if (_firstFrame) {
bool ret = init();
if (!ret) {
// initialization failed
@@ -148,26 +148,26 @@ void ActorAnimProcess::run() {
}
}
- if (animAborted) {
+ if (_animAborted) {
terminate();
return;
}
- assert(tracker);
+ assert(_tracker);
- if (!firstframe)
- repeatcounter++;
- if (repeatcounter > tracker->getAnimAction()->framerepeat)
- repeatcounter = 0;
+ if (!_firstFrame)
+ _repeatCounter++;
+ if (_repeatCounter > _tracker->getAnimAction()->framerepeat)
+ _repeatCounter = 0;
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a) {
// actor gone
terminate();
return;
}
- firstframe = false;
+ _firstFrame = false;
if (!(a->getFlags() & Item::FLG_FASTAREA)) {
// not in the fast area? Kill the animation then.
@@ -178,7 +178,7 @@ void ActorAnimProcess::run() {
// in fast area (still may need to pause when
// AnimationTracker is done.)
#ifdef WATCHACTOR
- if (item_num == watchactor)
+ if (_itemNum == watchactor)
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
<< "] ActorAnimProcess left fastarea; terminating"
@@ -189,21 +189,21 @@ void ActorAnimProcess::run() {
}
bool resultVal = true;
- if (repeatcounter == 0) {
+ if (_repeatCounter == 0) {
// next step:
int32 x, y, z;
a->getLocation(x, y, z);
- resultVal = tracker->stepFrom(x, y, z);
- tracker->updateActorFlags();
- currentstep++;
+ resultVal = _tracker->stepFrom(x, y, z);
+ _tracker->updateActorFlags();
+ _currentStep++;
if (!resultVal) {
// check possible error conditions
- if (tracker->isDone() || (steps && currentstep >= steps)) {
+ if (_tracker->isDone() || (_steps && _currentStep >= _steps)) {
// all done
#ifdef WATCHACTOR
- if (item_num == watchactor)
+ if (_itemNum == watchactor)
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
<< "] ActorAnimProcess done; terminating"
@@ -211,16 +211,16 @@ void ActorAnimProcess::run() {
#endif
// TODO: there are _three_ places where we can fall; clean up
- if (tracker->isUnsupported()) {
+ if (_tracker->isUnsupported()) {
#ifdef WATCHACTOR
- if (item_num == watchactor) {
+ if (_itemNum == watchactor) {
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
<< "] falling" << Std::endl;
}
#endif
int32 dx, dy, dz;
- tracker->getSpeed(dx, dy, dz);
+ _tracker->getSpeed(dx, dy, dz);
a->hurl(dx, dy, dz, 2);
}
@@ -229,23 +229,23 @@ void ActorAnimProcess::run() {
}
- if (tracker->isBlocked() &&
- !(tracker->getAnimAction()->flags & AnimAction::AAF_UNSTOPPABLE)) {
- // FIXME: For blocked large steps we may still want to do
+ if (_tracker->isBlocked() &&
+ !(_tracker->getAnimAction()->flags & AnimAction::AAF_UNSTOPPABLE)) {
+ // FIXME: For blocked large _steps we may still want to do
// a partial move. (But how would that work with
// repeated frames?)
#ifdef WATCHACTOR
- if (item_num == watchactor)
+ if (_itemNum == watchactor)
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
<< "] ActorAnimProcess blocked; terminating"
<< Std::endl;
#endif
- if (tracker->isUnsupported()) {
+ if (_tracker->isUnsupported()) {
#ifdef WATCHACTOR
- if (item_num == watchactor) {
+ if (_itemNum == watchactor) {
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
<< "] falling" << Std::endl;
@@ -261,14 +261,14 @@ void ActorAnimProcess::run() {
}
}
- AnimFrame *curframe = tracker->getAnimFrame();
+ AnimFrame *curframe = _tracker->getAnimFrame();
if (curframe && curframe->sfx) {
AudioProcess *audioproc = AudioProcess::get_instance();
- if (audioproc) audioproc->playSFX(curframe->sfx, 0x60, item_num, 0);
+ if (audioproc) audioproc->playSFX(curframe->sfx, 0x60, _itemNum, 0);
}
if (curframe && (curframe->flags & AnimFrame::AFF_SPECIAL)) {
- // Flag to trigger a special action
+ // Flag to trigger a special _action
// E.g.: play draw/sheathe SFX for avatar when weapon equipped,
// throw skull-fireball when ghost attacks, ...
doSpecial();
@@ -276,13 +276,13 @@ void ActorAnimProcess::run() {
// attacking?
- if (!attackedSomething) {
- ObjId hit = tracker->hitSomething();
+ if (!_attackedSomething) {
+ ObjId hit = _tracker->hitSomething();
if (hit) {
- attackedSomething = true;
+ _attackedSomething = true;
Item *hit_item = getItem(hit);
assert(hit_item);
- hit_item->receiveHit(item_num, (dir + 4) % 8, 0, 0);
+ hit_item->receiveHit(_itemNum, (_dir + 4) % 8, 0, 0);
doHitSpecial(hit_item);
}
}
@@ -290,14 +290,14 @@ void ActorAnimProcess::run() {
int32 x, y, z, x2, y2, z2;
a->getLocation(x, y, z);
- tracker->getInterpolatedPosition(x2, y2, z2, repeatcounter);
+ _tracker->getInterpolatedPosition(x2, y2, z2, _repeatCounter);
if (x == x2 && y == y2 && z == z2) {
- tracker->getInterpolatedPosition(x, y, z, repeatcounter + 1);
+ _tracker->getInterpolatedPosition(x, y, z, _repeatCounter + 1);
a->collideMove(x, y, z, false, true); // forced move
- a->setFrame(tracker->getFrame());
+ a->setFrame(_tracker->getFrame());
} else {
#ifdef WATCHACTOR
- if (item_num == watchactor) {
+ if (_itemNum == watchactor) {
pout << "Animation [" << Kernel::get_instance()->getFrameNum()
<< "] moved, so aborting this frame." << Std::endl;
}
@@ -307,7 +307,7 @@ void ActorAnimProcess::run() {
// Did we just leave the fast area?
if (!(a->getFlags() & Item::FLG_FASTAREA)) {
#ifdef WATCHACTOR
- if (item_num == watchactor)
+ if (_itemNum == watchactor)
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
<< "] ActorAnimProcess left fastarea; terminating"
@@ -318,35 +318,35 @@ void ActorAnimProcess::run() {
}
#ifdef WATCHACTOR
- if (item_num == watchactor) {
+ if (_itemNum == watchactor) {
pout << "Animation [" << Kernel::get_instance()->getFrameNum()
<< "] showing frame (" << x << "," << y << "," << z << ")"
- << " shape (" << a->getShape() << "," << tracker->getFrame()
- << ") sfx " << tracker->getAnimFrame()->sfx
- << " rep " << repeatcounter << " ";
-
- if (tracker->isDone()) pout << "D";
- if (tracker->isBlocked()) pout << "B";
- if (tracker->isUnsupported()) pout << "U";
- if (tracker->hitSomething()) pout << "H";
+ << " shape (" << a->getShape() << "," << _tracker->getFrame()
+ << ") sfx " << _tracker->getAnimFrame()->sfx
+ << " rep " << _repeatCounter << " ";
+
+ if (_tracker->isDone()) pout << "D";
+ if (_tracker->isBlocked()) pout << "B";
+ if (_tracker->isUnsupported()) pout << "U";
+ if (_tracker->hitSomething()) pout << "H";
pout << Std::endl;
}
#endif
- if (repeatcounter == tracker->getAnimAction()->framerepeat) {
- if (tracker->isUnsupported()) {
- animAborted = true;
+ if (_repeatCounter == _tracker->getAnimAction()->framerepeat) {
+ if (_tracker->isUnsupported()) {
+ _animAborted = true;
#ifdef WATCHACTOR
- if (item_num == watchactor) {
+ if (_itemNum == watchactor) {
pout << "Animation [" << Kernel::get_instance()->getFrameNum()
<< "] falling" << Std::endl;
}
#endif
int32 dx, dy, dz;
- tracker->getSpeed(dx, dy, dz);
+ _tracker->getSpeed(dx, dy, dz);
a->hurl(dx, dy, dz, 2);
// Note: do not wait for the fall to finish: this breaks
@@ -357,12 +357,12 @@ void ActorAnimProcess::run() {
}
void ActorAnimProcess::doSpecial() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
assert(a);
// play SFX when Avatar draws/sheathes weapon
- if (item_num == 1 && (action == Animation::readyWeapon ||
- action == Animation::unreadyWeapon) &&
+ if (_itemNum == 1 && (_action == Animation::readyWeapon ||
+ _action == Animation::unreadyWeapon) &&
a->getEquip(ShapeInfo::SE_WEAPON) != 0) {
int sfx = (getRandom() % 2) ? 0x51 : 0x52; // constants!
AudioProcess *audioproc = AudioProcess::get_instance();
@@ -373,7 +373,7 @@ void ActorAnimProcess::doSpecial() {
// ghosts
if (a->getShape() == 0x19b) {
Actor *hostile = 0;
- if (action == Animation::attack) {
+ if (_action == Animation::attack) {
// fireball on attack
unsigned int skullcount = a->countNearby(0x19d, 6 * 256);
if (skullcount > 5) return;
@@ -433,7 +433,7 @@ void ActorAnimProcess::doSpecial() {
SettingManager *settingman = SettingManager::get_instance();
bool playavfootsteps;
settingman->get("footsteps", playavfootsteps);
- if (item_num != 1 || playavfootsteps) {
+ if (_itemNum != 1 || playavfootsteps) {
UCList itemlist(2);
LOOPSCRIPT(script, LS_TOKEN_TRUE);
CurrentMap *cm = World::get_instance()->getCurrentMap();
@@ -446,7 +446,7 @@ void ActorAnimProcess::doSpecial() {
assert(f);
uint32 floor = f->getShape();
- bool running = (action == Animation::run);
+ bool running = (_action == Animation::run);
bool splash = false;
int sfx = 0;
switch (floor) { // lots of constants!!
@@ -476,7 +476,7 @@ void ActorAnimProcess::doSpecial() {
if (sfx) {
AudioProcess *audioproc = AudioProcess::get_instance();
- if (audioproc) audioproc->playSFX(sfx, 0x60, item_num, 0, false, 0x10000 + (getRandom() & 0x1FFF) - 0x1000);
+ if (audioproc) audioproc->playSFX(sfx, 0x60, _itemNum, 0, false, 0x10000 + (getRandom() & 0x1FFF) - 0x1000);
}
if (splash) {
@@ -491,12 +491,12 @@ void ActorAnimProcess::doSpecial() {
void ActorAnimProcess::doHitSpecial(Item *hit) {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
assert(a);
Actor *attacked = p_dynamic_cast<Actor *>(hit);
- if (item_num == 1 && action == Animation::attack) {
+ if (_itemNum == 1 && _action == Animation::attack) {
// some magic weapons have some special effects
AudioProcess *audioproc = AudioProcess::get_instance();
@@ -551,8 +551,8 @@ void ActorAnimProcess::doHitSpecial(Item *hit) {
Kernel *kernel = Kernel::get_instance();
int32 fx, fy, fz;
- fx = x + 96 * x_fact[dir];
- fy = y + 96 * y_fact[dir];
+ fx = x + 96 * x_fact[_dir];
+ fy = y + 96 * y_fact[_dir];
fz = z;
// CONSTANTS!! (lots of them)
@@ -598,23 +598,23 @@ void ActorAnimProcess::doHitSpecial(Item *hit) {
void ActorAnimProcess::terminate() {
#ifdef WATCHACTOR
- if (item_num == watchactor)
+ if (_itemNum == watchactor)
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
<< "] ActorAnimProcess terminating"
<< Std::endl;
#endif
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (a) {
- if (tracker) { // if we were really animating...
+ if (_tracker) { // if we were really animating...
a->clearActorFlag(Actor::ACT_ANIMLOCK);
- if (tracker->getAnimAction()->flags & AnimAction::AAF_DESTROYACTOR) {
+ if (_tracker->getAnimAction()->flags & AnimAction::AAF_DESTROYACTOR) {
// destroy the actor
#ifdef WATCHACTOR
- if (item_num == watchactor)
+ if (_itemNum == watchactor)
pout << "Animation ["
<< Kernel::get_instance()->getFrameNum()
- << "] ActorAnimProcess destroying actor " << item_num
+ << "] ActorAnimProcess destroying actor " << _itemNum
<< Std::endl;
#endif
Process *vanishproc = new DestroyItemProcess(a);
@@ -625,34 +625,34 @@ void ActorAnimProcess::terminate() {
}
}
- delete tracker;
+ delete _tracker;
Process::terminate();
}
void ActorAnimProcess::dumpInfo() {
Process::dumpInfo();
- pout << "action: " << action << ", dir: " << dir << Std::endl;
+ pout << "_action: " << _action << ", _dir: " << _dir << Std::endl;
}
void ActorAnimProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- uint8 ff = firstframe ? 1 : 0;
+ uint8 ff = _firstFrame ? 1 : 0;
ods->write1(ff);
- uint8 ab = animAborted ? 1 : 0;
+ uint8 ab = _animAborted ? 1 : 0;
ods->write1(ab);
- uint8 attacked = attackedSomething ? 1 : 0;
+ uint8 attacked = _attackedSomething ? 1 : 0;
ods->write1(attacked);
- ods->write1(static_cast<uint8>(dir));
- ods->write2(static_cast<uint16>(action));
- ods->write2(static_cast<uint16>(steps));
- ods->write2(static_cast<uint16>(repeatcounter));
- ods->write2(static_cast<uint16>(currentstep));
+ ods->write1(static_cast<uint8>(_dir));
+ ods->write2(static_cast<uint16>(_action));
+ ods->write2(static_cast<uint16>(_steps));
+ ods->write2(static_cast<uint16>(_repeatCounter));
+ ods->write2(static_cast<uint16>(_currentStep));
- if (tracker) {
+ if (_tracker) {
ods->write1(1);
- tracker->save(ods);
+ _tracker->save(ods);
} else
ods->write1(0);
}
@@ -660,19 +660,19 @@ void ActorAnimProcess::saveData(ODataSource *ods) {
bool ActorAnimProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- firstframe = (ids->read1() != 0);
- animAborted = (ids->read1() != 0);
- attackedSomething = (ids->read1() != 0);
- dir = ids->read1();
- action = static_cast<Animation::Sequence>(ids->read2());
- steps = ids->read2();
- repeatcounter = ids->read2();
- currentstep = ids->read2();
+ _firstFrame = (ids->read1() != 0);
+ _animAborted = (ids->read1() != 0);
+ _attackedSomething = (ids->read1() != 0);
+ _dir = ids->read1();
+ _action = static_cast<Animation::Sequence>(ids->read2());
+ _steps = ids->read2();
+ _repeatCounter = ids->read2();
+ _currentStep = ids->read2();
- assert(tracker == 0);
+ assert(_tracker == 0);
if (ids->read1() != 0) {
- tracker = new AnimationTracker();
- if (!tracker->load(ids, version))
+ _tracker = new AnimationTracker();
+ if (!_tracker->load(ids, version))
return false;
}
diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.h b/engines/ultima/ultima8/world/actors/actor_anim_process.h
index a0e2251..96c365b 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.h
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.h
@@ -51,7 +51,7 @@ public:
void dumpInfo() override;
Animation::Sequence getAction() const {
- return action;
+ return _action;
}
bool loadData(IDataSource *ids, uint32 version);
@@ -66,19 +66,19 @@ protected:
//! perform special action when hitting an opponent
void doHitSpecial(Item *hit);
- Animation::Sequence action;
- uint32 dir;
- uint32 steps;
+ Animation::Sequence _action;
+ uint32 _dir;
+ uint32 _steps;
- AnimationTracker *tracker;
- int repeatcounter;
- uint32 currentstep;
+ AnimationTracker *_tracker;
+ int _repeatCounter;
+ uint32 _currentStep;
- bool firstframe;
+ bool _firstFrame;
- bool animAborted;
+ bool _animAborted;
- bool attackedSomething; // attacked and hit something with this animation
+ bool _attackedSomething; // attacked and hit something with this animation
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/actor_bark_notify_process.cpp b/engines/ultima/ultima8/world/actors/actor_bark_notify_process.cpp
index 05a857d..7c4a7e5 100644
--- a/engines/ultima/ultima8/world/actors/actor_bark_notify_process.cpp
+++ b/engines/ultima/ultima8/world/actors/actor_bark_notify_process.cpp
@@ -52,7 +52,7 @@ ActorBarkNotifyProcess::~ActorBarkNotifyProcess(void) {
void ActorBarkNotifyProcess::run() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a) return;
if (a->isDead() || !a->hasAnim(Animation::talk))
@@ -64,7 +64,7 @@ void ActorBarkNotifyProcess::run() {
Animation::Sequence lastanim = a->getLastAnim();
if (lastanim != Animation::stand && lastanim != Animation::talk)
doAnim = false;
- else if (Kernel::get_instance()->getNumProcesses(item_num, 0x00F0) > 0)
+ else if (Kernel::get_instance()->getNumProcesses(_itemNum, 0x00F0) > 0)
// if busy, don't do talk animation
doAnim = false;
diff --git a/engines/ultima/ultima8/world/actors/ambush_process.cpp b/engines/ultima/ultima8/world/actors/ambush_process.cpp
index 93452ce..1c4246b 100644
--- a/engines/ultima/ultima8/world/actors/ambush_process.cpp
+++ b/engines/ultima/ultima8/world/actors/ambush_process.cpp
@@ -42,20 +42,20 @@ AmbushProcess::AmbushProcess() : Process() {
AmbushProcess::AmbushProcess(Actor *actor_) {
assert(actor_);
- item_num = actor_->getObjId();
- type = 0x21E; // CONSTANT !
+ _itemNum = actor_->getObjId();
+ _type = 0x21E; // CONSTANT !
- delaycount = 0;
+ _delayCount = 0;
}
void AmbushProcess::run() {
- if (delaycount > 0) {
- delaycount--;
+ if (_delayCount > 0) {
+ _delayCount--;
return;
}
- delaycount = 10;
+ _delayCount = 10;
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
CombatProcess *cp = a->getCombatProcess();
if (!cp) {
// this shouldn't have happened
@@ -77,13 +77,13 @@ void AmbushProcess::run() {
void AmbushProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(delaycount);
+ ods->write4(_delayCount);
}
bool AmbushProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- delaycount = ids->read4();
+ _delayCount = ids->read4();
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/ambush_process.h b/engines/ultima/ultima8/world/actors/ambush_process.h
index 6be6aab..24eb571 100644
--- a/engines/ultima/ultima8/world/actors/ambush_process.h
+++ b/engines/ultima/ultima8/world/actors/ambush_process.h
@@ -44,7 +44,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- uint32 delaycount;
+ uint32 _delayCount;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/avatar_death_process.cpp b/engines/ultima/ultima8/world/actors/avatar_death_process.cpp
index e7ca628..7c01b60 100644
--- a/engines/ultima/ultima8/world/actors/avatar_death_process.cpp
+++ b/engines/ultima/ultima8/world/actors/avatar_death_process.cpp
@@ -42,8 +42,8 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(AvatarDeathProcess, Process)
AvatarDeathProcess::AvatarDeathProcess() : Process() {
- item_num = 1;
- type = 1; // CONSTANT !
+ _itemNum = 1;
+ _type = 1; // CONSTANT !
}
void AvatarDeathProcess::run() {
diff --git a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
index f3b2505..e3029d0 100644
--- a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
@@ -49,13 +49,13 @@ AvatarMoverProcess::AvatarMoverProcess() : Process() {
lastAttack = 0;
idleTime = 0;
lastHeadShakeAnim = Animation::lookLeft;
- mouseButton[0].state = MBS_HANDLED | MBS_RELHANDLED;
- mouseButton[1].state = MBS_HANDLED | MBS_RELHANDLED;
- mouseButton[0].curDown = 0;
- mouseButton[1].curDown = 0;
- mouseButton[0].lastDown = 0;
- mouseButton[1].lastDown = 0;
- type = 1; // CONSTANT! (type 1 = persistent)
+ mouseButton[0]._state = MBS_HANDLED | MBS_RELHANDLED;
+ mouseButton[1]._state = MBS_HANDLED | MBS_RELHANDLED;
+ mouseButton[0]._curDown = 0;
+ mouseButton[1]._curDown = 0;
+ mouseButton[0]._lastDown = 0;
+ mouseButton[1]._lastDown = 0;
+ _type = 1; // CONSTANT! (type 1 = persistent)
}
@@ -112,28 +112,28 @@ void AvatarMoverProcess::handleHangingMode() {
bool m0clicked = false;
//bool m1clicked = false;
- if (!(mouseButton[0].state & MBS_HANDLED) &&
- now - mouseButton[0].curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(mouseButton[0]._state & MBS_HANDLED) &&
+ now - mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
m0clicked = true;
- mouseButton[0].state |= MBS_HANDLED;
+ mouseButton[0]._state |= MBS_HANDLED;
}
- if (!(mouseButton[1].state & MBS_HANDLED) &&
- now - mouseButton[1].curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(mouseButton[1]._state & MBS_HANDLED) &&
+ now - mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
//m1clicked = true;
- mouseButton[1].state |= MBS_HANDLED;
+ mouseButton[1]._state |= MBS_HANDLED;
}
- if (!(mouseButton[0].state & MBS_RELHANDLED))
- mouseButton[0].state |= MBS_RELHANDLED;
- if (!(mouseButton[1].state & MBS_RELHANDLED))
- mouseButton[1].state |= MBS_RELHANDLED;
+ if (!(mouseButton[0]._state & MBS_RELHANDLED))
+ mouseButton[0]._state |= MBS_RELHANDLED;
+ if (!(mouseButton[1]._state & MBS_RELHANDLED))
+ mouseButton[1]._state |= MBS_RELHANDLED;
// if left mouse is down, try to climb up
- if ((mouseButton[0].state & MBS_DOWN) &&
- (!(mouseButton[0].state & MBS_HANDLED) || m0clicked)) {
- mouseButton[0].state |= MBS_HANDLED;
- mouseButton[0].lastDown = 0;
+ if ((mouseButton[0]._state & MBS_DOWN) &&
+ (!(mouseButton[0]._state & MBS_HANDLED) || m0clicked)) {
+ mouseButton[0]._state |= MBS_HANDLED;
+ mouseButton[0]._lastDown = 0;
if (avatar->tryAnim(Animation::climb40, 8) == Animation::SUCCESS) {
avatar->ensureGravityProcess()->terminate();
@@ -171,7 +171,7 @@ void AvatarMoverProcess::handleCombatMode() {
// if we were blocking, and no longer holding the mouse, stop
if (lastanim == Animation::startBlock &&
- !(mouseButton[0].state & MBS_DOWN)) {
+ !(mouseButton[0]._state & MBS_DOWN)) {
// pout << "AvatarMover: combat stop blocking" << Std::endl;
waitFor(avatar->doAnim(Animation::stopBlock, direction));
return;
@@ -184,26 +184,26 @@ void AvatarMoverProcess::handleCombatMode() {
bool m0clicked = false;
bool m1clicked = false;
- if (!(mouseButton[0].state & MBS_HANDLED) &&
- now - mouseButton[0].curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(mouseButton[0]._state & MBS_HANDLED) &&
+ now - mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
m0clicked = true;
- mouseButton[0].state |= MBS_HANDLED;
+ mouseButton[0]._state |= MBS_HANDLED;
}
- if (!(mouseButton[1].state & MBS_HANDLED) &&
- now - mouseButton[1].curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(mouseButton[1]._state & MBS_HANDLED) &&
+ now - mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
m1clicked = true;
- mouseButton[1].state |= MBS_HANDLED;
+ mouseButton[1]._state |= MBS_HANDLED;
}
- if (!(mouseButton[0].state & MBS_RELHANDLED))
- mouseButton[0].state |= MBS_RELHANDLED;
+ if (!(mouseButton[0]._state & MBS_RELHANDLED))
+ mouseButton[0]._state |= MBS_RELHANDLED;
- if (!(mouseButton[1].state & MBS_RELHANDLED))
- mouseButton[1].state |= MBS_RELHANDLED;
+ if (!(mouseButton[1]._state & MBS_RELHANDLED))
+ mouseButton[1]._state |= MBS_RELHANDLED;
- if ((mouseButton[0].state & MBS_DOWN) &&
- (mouseButton[0].state & MBS_HANDLED) && mouseButton[0].lastDown > 0) {
+ if ((mouseButton[0]._state & MBS_DOWN) &&
+ (mouseButton[0]._state & MBS_HANDLED) && mouseButton[0]._lastDown > 0) {
// left click-and-hold = block
if (lastanim == Animation::startBlock)
return;
@@ -216,11 +216,11 @@ void AvatarMoverProcess::handleCombatMode() {
return;
}
- if ((mouseButton[0].state & MBS_DOWN) &&
- !(mouseButton[0].state & MBS_HANDLED) &&
- mouseButton[0].curDown - mouseButton[0].lastDown <= DOUBLE_CLICK_TIMEOUT) {
- mouseButton[0].state |= MBS_HANDLED;
- mouseButton[0].lastDown = 0;
+ if ((mouseButton[0]._state & MBS_DOWN) &&
+ !(mouseButton[0]._state & MBS_HANDLED) &&
+ mouseButton[0]._curDown - mouseButton[0]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
+ mouseButton[0]._state |= MBS_HANDLED;
+ mouseButton[0]._lastDown = 0;
if (canAttack()) {
// double left click = attack
@@ -239,11 +239,11 @@ void AvatarMoverProcess::handleCombatMode() {
return;
}
- if ((mouseButton[1].state & MBS_DOWN) &&
- !(mouseButton[1].state & MBS_HANDLED) &&
- mouseButton[1].curDown - mouseButton[1].lastDown <= DOUBLE_CLICK_TIMEOUT) {
- mouseButton[1].state |= MBS_HANDLED;
- mouseButton[1].lastDown = 0;
+ if ((mouseButton[1]._state & MBS_DOWN) &&
+ !(mouseButton[1]._state & MBS_HANDLED) &&
+ mouseButton[1]._curDown - mouseButton[1]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
+ mouseButton[1]._state |= MBS_HANDLED;
+ mouseButton[1]._lastDown = 0;
Gump *desktopgump = Ultima8Engine::get_instance()->getDesktopGump();
if (desktopgump->TraceObjId(mx, my) == 1) {
@@ -270,8 +270,8 @@ void AvatarMoverProcess::handleCombatMode() {
return;
}
- if ((mouseButton[1].state & MBS_DOWN) &&
- (mouseButton[1].state & MBS_HANDLED) && mouseButton[1].lastDown > 0) {
+ if ((mouseButton[1]._state & MBS_DOWN) &&
+ (mouseButton[1]._state & MBS_HANDLED) && mouseButton[1]._lastDown > 0) {
// right mouse button is down long enough to act on it
// if facing right direction, walk
//!! TODO: check if you can actually take this step
@@ -370,24 +370,24 @@ void AvatarMoverProcess::handleNormalMode() {
bool m1clicked = false;
// check mouse state to see what needs to be done
- if (!(mouseButton[0].state & MBS_HANDLED) &&
- now - mouseButton[0].curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(mouseButton[0]._state & MBS_HANDLED) &&
+ now - mouseButton[0]._curDown > DOUBLE_CLICK_TIMEOUT) {
m0clicked = true;
- mouseButton[0].state |= MBS_HANDLED;
+ mouseButton[0]._state |= MBS_HANDLED;
}
- if (!(mouseButton[1].state & MBS_HANDLED) &&
- now - mouseButton[1].curDown > DOUBLE_CLICK_TIMEOUT) {
+ if (!(mouseButton[1]._state & MBS_HANDLED) &&
+ now - mouseButton[1]._curDown > DOUBLE_CLICK_TIMEOUT) {
m1clicked = true;
- mouseButton[1].state |= MBS_HANDLED;
+ mouseButton[1]._state |= MBS_HANDLED;
}
// see if mouse was just released
- if (!(mouseButton[0].state & MBS_RELHANDLED))
- mouseButton[0].state |= MBS_RELHANDLED; // don't care about left
+ if (!(mouseButton[0]._state & MBS_RELHANDLED))
+ mouseButton[0]._state |= MBS_RELHANDLED; // don't care about left
- if (!(mouseButton[1].state & MBS_RELHANDLED)) {
- mouseButton[1].state |= MBS_RELHANDLED;
+ if (!(mouseButton[1]._state & MBS_RELHANDLED)) {
+ mouseButton[1]._state |= MBS_RELHANDLED;
// if we were running in combat mode, slow to a walk, draw weapon
// (even in stasis)
@@ -427,19 +427,19 @@ void AvatarMoverProcess::handleNormalMode() {
return;
// both mouse buttons down
- if (!(mouseButton[0].state & MBS_HANDLED) &&
- !(mouseButton[1].state & MBS_HANDLED)) {
+ if (!(mouseButton[0]._state & MBS_HANDLED) &&
+ !(mouseButton[1]._state & MBS_HANDLED)) {
// notice these are all unsigned.
- uint32 down = mouseButton[1].curDown;
- if (mouseButton[0].curDown < down) {
- down = down - mouseButton[0].curDown;
+ uint32 down = mouseButton[1]._curDown;
+ if (mouseButton[0]._curDown < down) {
+ down = down - mouseButton[0]._curDown;
} else {
- down = mouseButton[0].curDown - down;
+ down = mouseButton[0]._curDown - down;
}
if (down < DOUBLE_CLICK_TIMEOUT) {
- mouseButton[0].state |= MBS_HANDLED;
- mouseButton[1].state |= MBS_HANDLED;
+ mouseButton[0]._state |= MBS_HANDLED;
+ mouseButton[1]._state |= MBS_HANDLED;
// We got a left mouse down.
// Note that this automatically means right was down too.
@@ -477,9 +477,9 @@ void AvatarMoverProcess::handleNormalMode() {
}
}
- if ((!(mouseButton[0].state & MBS_HANDLED) || m0clicked) &&
- (mouseButton[1].state & MBS_DOWN)) {
- mouseButton[0].state |= MBS_HANDLED;
+ if ((!(mouseButton[0]._state & MBS_HANDLED) || m0clicked) &&
+ (mouseButton[1]._state & MBS_DOWN)) {
+ mouseButton[0]._state |= MBS_HANDLED;
// We got a left mouse down.
// Note that this automatically means right was down at the time too.
@@ -505,14 +505,14 @@ void AvatarMoverProcess::handleNormalMode() {
// CHECKME: check what needs to happen when keeping left pressed
}
- if ((mouseButton[1].state & MBS_DOWN) &&
- !(mouseButton[1].state & MBS_HANDLED) &&
- mouseButton[1].curDown - mouseButton[1].lastDown <= DOUBLE_CLICK_TIMEOUT) {
+ if ((mouseButton[1]._state & MBS_DOWN) &&
+ !(mouseButton[1]._state & MBS_HANDLED) &&
+ mouseButton[1]._curDown - mouseButton[1]._lastDown <= DOUBLE_CLICK_TIMEOUT) {
Gump *desktopgump = Ultima8Engine::get_instance()->getDesktopGump();
if (desktopgump->TraceObjId(mx, my) == 1) {
// double right click on avatar = toggle combat mode
- mouseButton[1].state |= MBS_HANDLED;
- mouseButton[1].lastDown = 0;
+ mouseButton[1]._state |= MBS_HANDLED;
+ mouseButton[1]._lastDown = 0;
avatar->toggleInCombat();
waitFor(avatar->doAnim(Animation::readyWeapon, direction));
@@ -520,8 +520,8 @@ void AvatarMoverProcess::handleNormalMode() {
}
}
- if ((mouseButton[1].state & MBS_DOWN) &&
- (mouseButton[1].state & MBS_HANDLED)) {
+ if ((mouseButton[1]._state & MBS_DOWN) &&
+ (mouseButton[1]._state & MBS_HANDLED)) {
// right mouse button is down long enough to act on it
// if facing right direction, walk
@@ -797,10 +797,10 @@ void AvatarMoverProcess::OnMouseDown(int button, int32 mx, int32 my) {
break;
};
- mouseButton[bid].lastDown = mouseButton[bid].curDown;
- mouseButton[bid].curDown = g_system->getMillis();
- mouseButton[bid].state |= MBS_DOWN;
- mouseButton[bid].state &= ~MBS_HANDLED;
+ mouseButton[bid]._lastDown = mouseButton[bid]._curDown;
+ mouseButton[bid]._curDown = g_system->getMillis();
+ mouseButton[bid]._state |= MBS_DOWN;
+ mouseButton[bid]._state &= ~MBS_HANDLED;
}
void AvatarMoverProcess::OnMouseUp(int button) {
@@ -814,8 +814,8 @@ void AvatarMoverProcess::OnMouseUp(int button) {
CANT_HAPPEN_MSG("invalid MouseUp passed to AvatarMoverProcess");
}
- mouseButton[bid].state &= ~MBS_DOWN;
- mouseButton[bid].state &= ~MBS_RELHANDLED;
+ mouseButton[bid]._state &= ~MBS_DOWN;
+ mouseButton[bid]._state &= ~MBS_RELHANDLED;
}
diff --git a/engines/ultima/ultima8/world/actors/clear_feign_death_process.cpp b/engines/ultima/ultima8/world/actors/clear_feign_death_process.cpp
index c10404c..0dbebee 100644
--- a/engines/ultima/ultima8/world/actors/clear_feign_death_process.cpp
+++ b/engines/ultima/ultima8/world/actors/clear_feign_death_process.cpp
@@ -42,13 +42,13 @@ ClearFeignDeathProcess::ClearFeignDeathProcess() : Process() {
ClearFeignDeathProcess::ClearFeignDeathProcess(Actor *actor_) {
assert(actor_);
- item_num = actor_->getObjId();
+ _itemNum = actor_->getObjId();
- type = 0x243; // constant !
+ _type = 0x243; // constant !
}
void ClearFeignDeathProcess::run() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a) {
// actor gone?
@@ -59,7 +59,7 @@ void ClearFeignDeathProcess::run() {
a->clearActorFlag(Actor::ACT_FEIGNDEATH);
AudioProcess *audioproc = AudioProcess::get_instance();
- if (audioproc) audioproc->playSFX(59, 0x60, item_num, 0);
+ if (audioproc) audioproc->playSFX(59, 0x60, _itemNum, 0);
// done
terminate();
diff --git a/engines/ultima/ultima8/world/actors/combat_process.cpp b/engines/ultima/ultima8/world/actors/combat_process.cpp
index 3058926..23ca4a4 100644
--- a/engines/ultima/ultima8/world/actors/combat_process.cpp
+++ b/engines/ultima/ultima8/world/actors/combat_process.cpp
@@ -54,16 +54,16 @@ CombatProcess::CombatProcess() : Process() {
CombatProcess::CombatProcess(Actor *actor_) {
assert(actor_);
- item_num = actor_->getObjId();
+ _itemNum = actor_->getObjId();
- type = 0x00F2; // CONSTANT !
+ _type = 0x00F2; // CONSTANT !
target = 0;
fixedTarget = 0;
combatmode = CM_WAITING;
}
void CombatProcess::terminate() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (a)
a->clearActorFlag(Actor::ACT_INCOMBAT);
@@ -76,7 +76,7 @@ void CombatProcess::run() {
// next to them, or maybe only when you are attacking them.
// They should not try to approach.
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!(a->getFlags() & Item::FLG_FASTAREA))
return;
@@ -92,7 +92,7 @@ void CombatProcess::run() {
return;
}
- pout << "[COMBAT " << item_num << "] target found: "
+ pout << "[COMBAT " << _itemNum << "] target found: "
<< target << Std::endl;
combatmode = CM_WAITING;
}
@@ -106,7 +106,7 @@ void CombatProcess::run() {
if (inAttackRange()) {
combatmode = CM_ATTACKING;
- pout << "[COMBAT " << item_num << "] target (" << target
+ pout << "[COMBAT " << _itemNum << "] target (" << target
<< ") in range" << Std::endl;
bool hasidle1 = a->hasAnim(Animation::idle1);
@@ -181,7 +181,7 @@ void CombatProcess::setTarget(ObjId newtarget) {
bool CombatProcess::isValidTarget(Actor *target_) {
assert(target_);
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a) return false; // uh oh
// don't target_ self
@@ -207,14 +207,14 @@ bool CombatProcess::isValidTarget(Actor *target_) {
bool CombatProcess::isEnemy(Actor *target_) {
assert(target_);
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a) return false; // uh oh
return ((a->getEnemyAlignment() & target_->getAlignment()) != 0);
}
ObjId CombatProcess::seekTarget() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a) return 0; // uh oh
if (fixedTarget) {
@@ -242,14 +242,14 @@ ObjId CombatProcess::seekTarget() {
}
int CombatProcess::getTargetDirection() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
Actor *t = getActor(target);
return a->getDirToItemCentre(*t);
}
void CombatProcess::turnToDirection(int direction) {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
int curdir = a->getDir();
int step = 1;
if ((curdir - direction + 8) % 8 < 4) step = -1;
@@ -278,7 +278,7 @@ void CombatProcess::turnToDirection(int direction) {
}
bool CombatProcess::inAttackRange() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
ShapeInfo *shapeinfo = a->getShapeInfo();
MonsterInfo *mi = 0;
if (shapeinfo) mi = shapeinfo->monsterinfo;
@@ -301,7 +301,7 @@ bool CombatProcess::inAttackRange() {
}
void CombatProcess::waitForTarget() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
ShapeInfo *shapeinfo = a->getShapeInfo();
MonsterInfo *mi = 0;
if (shapeinfo) mi = shapeinfo->monsterinfo;
diff --git a/engines/ultima/ultima8/world/actors/grant_peace_process.cpp b/engines/ultima/ultima8/world/actors/grant_peace_process.cpp
index f15bbdf..d1b243a 100644
--- a/engines/ultima/ultima8/world/actors/grant_peace_process.cpp
+++ b/engines/ultima/ultima8/world/actors/grant_peace_process.cpp
@@ -54,15 +54,15 @@ GrantPeaceProcess::GrantPeaceProcess() : Process() {
GrantPeaceProcess::GrantPeaceProcess(Actor *caster) {
assert(caster);
- item_num = caster->getObjId();
+ _itemNum = caster->getObjId();
- type = 0x21d; // CONSTANT !
+ _type = 0x21d; // CONSTANT !
havetarget = false;
}
void GrantPeaceProcess::run() {
- Actor *caster = getActor(item_num);
+ Actor *caster = getActor(_itemNum);
if (!caster) {
terminate();
return;
@@ -79,8 +79,8 @@ void GrantPeaceProcess::run() {
return;
}
- // get target result
- ObjId targetid = static_cast<ObjId>(result);
+ // get target _result
+ ObjId targetid = static_cast<ObjId>(_result);
Actor *target = getActor(targetid);
if (targetid == 1 || !target) {
@@ -117,7 +117,7 @@ void GrantPeaceProcess::run() {
// undead?
if (t->getDefenseType() & WeaponInfo::DMG_UNDEAD) {
- t->receiveHit(item_num, 8, target->getHP(),
+ t->receiveHit(_itemNum, 8, target->getHP(),
(WeaponInfo::DMG_MAGIC |
WeaponInfo::DMG_PIERCE |
WeaponInfo::DMG_FIRE));
@@ -158,7 +158,7 @@ void GrantPeaceProcess::run() {
Actor::ACT_IMMORTAL |
Actor::ACT_INVINCIBLE))) {
if (getRandom() % 10 == 0) {
- target->receiveHit(item_num, 8, target->getHP(),
+ target->receiveHit(_itemNum, 8, target->getHP(),
(WeaponInfo::DMG_MAGIC |
WeaponInfo::DMG_PIERCE |
WeaponInfo::DMG_FIRE));
diff --git a/engines/ultima/ultima8/world/actors/heal_process.cpp b/engines/ultima/ultima8/world/actors/heal_process.cpp
index 2e7c2fb..58530e4 100644
--- a/engines/ultima/ultima8/world/actors/heal_process.cpp
+++ b/engines/ultima/ultima8/world/actors/heal_process.cpp
@@ -39,8 +39,8 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(HealProcess, Process)
HealProcess::HealProcess() : Process() {
hungerCounter = 0;
healCounter = 0;
- item_num = 0;
- type = 0x222; // CONSTANT!
+ _itemNum = 0;
+ _type = 0x222; // CONSTANT!
}
void HealProcess::run() {
diff --git a/engines/ultima/ultima8/world/actors/loiter_process.cpp b/engines/ultima/ultima8/world/actors/loiter_process.cpp
index 9338490..577e6fc 100644
--- a/engines/ultima/ultima8/world/actors/loiter_process.cpp
+++ b/engines/ultima/ultima8/world/actors/loiter_process.cpp
@@ -42,10 +42,10 @@ LoiterProcess::LoiterProcess() : Process() {
LoiterProcess::LoiterProcess(Actor *actor_, int32 c) {
assert(actor_);
- item_num = actor_->getObjId();
+ _itemNum = actor_->getObjId();
count = c;
- type = 0x205; // CONSTANT!
+ _type = 0x205; // CONSTANT!
}
void LoiterProcess::run() {
@@ -56,7 +56,7 @@ void LoiterProcess::run() {
if (count > 0)
count--;
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a || a->isDead()) {
// dead?
diff --git a/engines/ultima/ultima8/world/actors/main_actor.cpp b/engines/ultima/ultima8/world/actors/main_actor.cpp
index 379f4ac..b9cd9c1 100644
--- a/engines/ultima/ultima8/world/actors/main_actor.cpp
+++ b/engines/ultima/ultima8/world/actors/main_actor.cpp
@@ -82,7 +82,7 @@ bool MainActor::CanAddItem(Item *item, bool checkwghtvol) {
const unsigned int backpack_shape = 529; //!! *cough* constant
if (!Actor::CanAddItem(item, checkwghtvol)) return false;
- if (item->getParent() == objid) return true; // already in here
+ if (item->getParent() == _objId) return true; // already in here
// now check 'equipment slots'
// we can have one item of each equipment type, plus one backpack
diff --git a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
index 5e380c3..0beabff 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder_process.cpp
@@ -45,15 +45,15 @@ PathfinderProcess::PathfinderProcess() : Process() {
PathfinderProcess::PathfinderProcess(Actor *actor_, ObjId item_, bool hit) {
assert(actor_);
- item_num = actor_->getObjId();
- type = 0x0204; // CONSTANT !
+ _itemNum = actor_->getObjId();
+ _type = 0x0204; // CONSTANT !
Item *item = getItem(item_);
if (!item) {
perr << "PathfinderProcess: non-existent target" << Std::endl;
// can't get there...
- result = PATH_FAILED;
+ _result = PATH_FAILED;
terminateDeferred();
return;
}
@@ -72,10 +72,10 @@ PathfinderProcess::PathfinderProcess(Actor *actor_, ObjId item_, bool hit) {
bool ok = pf.pathfind(path);
if (!ok) {
- perr << "PathfinderProcess: actor " << item_num
+ perr << "PathfinderProcess: actor " << _itemNum
<< " failed to find path" << Std::endl;
// can't get there...
- result = PATH_FAILED;
+ _result = PATH_FAILED;
terminateDeferred();
return;
}
@@ -87,7 +87,7 @@ PathfinderProcess::PathfinderProcess(Actor *actor_, ObjId item_, bool hit) {
PathfinderProcess::PathfinderProcess(Actor *actor_,
int32 x, int32 y, int32 z) {
assert(actor_);
- item_num = actor_->getObjId();
+ _itemNum = actor_->getObjId();
targetx = x;
targety = y;
@@ -103,10 +103,10 @@ PathfinderProcess::PathfinderProcess(Actor *actor_,
bool ok = pf.pathfind(path);
if (!ok) {
- perr << "PathfinderProcess: actor " << item_num
+ perr << "PathfinderProcess: actor " << _itemNum
<< " failed to find path" << Std::endl;
// can't get there...
- result = PATH_FAILED;
+ _result = PATH_FAILED;
terminateDeferred();
return;
}
@@ -120,7 +120,7 @@ PathfinderProcess::~PathfinderProcess() {
}
void PathfinderProcess::terminate() {
- Actor *actor = getActor(item_num);
+ Actor *actor = getActor(_itemNum);
if (actor) {
// TODO: only clear if it was set by us?
// (slightly more complicated if we kill other pathfinders on startup)
@@ -131,7 +131,7 @@ void PathfinderProcess::terminate() {
}
void PathfinderProcess::run() {
- Actor *actor = getActor(item_num);
+ Actor *actor = getActor(_itemNum);
assert(actor);
// if not in the fastarea, do nothing
if (!(actor->getFlags() & Item::FLG_FASTAREA)) return;
@@ -144,7 +144,7 @@ void PathfinderProcess::run() {
Item *item = getItem(targetitem);
if (!item) {
perr << "PathfinderProcess: target missing" << Std::endl;
- result = PATH_FAILED;
+ _result = PATH_FAILED;
terminate();
return;
}
@@ -162,7 +162,7 @@ void PathfinderProcess::run() {
#if 0
pout << "PathfinderProcess: done" << Std::endl;
#endif
- result = PATH_OK;
+ _result = PATH_OK;
terminate();
return;
}
@@ -217,10 +217,10 @@ void PathfinderProcess::run() {
currentstep = 0;
if (!ok) {
- perr << "PathfinderProcess: actor " << item_num
+ perr << "PathfinderProcess: actor " << _itemNum
<< " failed to find path" << Std::endl;
// can't get there anymore
- result = PATH_FAILED;
+ _result = PATH_FAILED;
terminate();
return;
}
@@ -231,7 +231,7 @@ void PathfinderProcess::run() {
pout << "PathfinderProcess: done" << Std::endl;
#endif
// done
- result = PATH_OK;
+ _result = PATH_OK;
terminate();
return;
}
diff --git a/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
index e6955e4..a2d2c731 100644
--- a/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/quick_avatar_mover_process.cpp
@@ -94,19 +94,19 @@ void QuickAvatarMoverProcess::run() {
while (dxv || dyv || dzv) {
uint32 shapeFlags = avatar->getShapeInfo()->flags;
- if (!clipping || cm->isValidPosition(x + dxv, y + dyv, z + dzv, ixd, iyd, izd, flags, 1, 0, 0)) {
+ if (!clipping || cm->isValidPosition(x + dxv, y + dyv, z + dzv, ixd, iyd, izd, _flags, 1, 0, 0)) {
if (clipping && !dzv) {
- if (cm->isValidPosition(x + dxv, y + dyv, z - 8, ixd, iyd, izd, flags, 1, 0, 0) &&
- !cm->isValidPosition(x, y, z - 8, ixd, iyd, izd, flags, 1, 0, 0)) {
+ if (cm->isValidPosition(x + dxv, y + dyv, z - 8, ixd, iyd, izd, _flags, 1, 0, 0) &&
+ !cm->isValidPosition(x, y, z - 8, ixd, iyd, izd, _flags, 1, 0, 0)) {
dzv = -8;
- } else if (cm->isValidPosition(x + dxv, y + dyv, z - 16, ixd, iyd, izd, flags, 1, 0, 0) &&
- !cm->isValidPosition(x, y, z - 16, ixd, iyd, izd, flags, 1, 0, 0)) {
+ } else if (cm->isValidPosition(x + dxv, y + dyv, z - 16, ixd, iyd, izd, _flags, 1, 0, 0) &&
+ !cm->isValidPosition(x, y, z - 16, ixd, iyd, izd, _flags, 1, 0, 0)) {
dzv = -16;
- } else if (cm->isValidPosition(x + dxv, y + dyv, z - 24, ixd, iyd, izd, flags, 1, 0, 0) &&
- !cm->isValidPosition(x, y, z - 24, ixd, iyd, izd, flags, 1, 0, 0)) {
+ } else if (cm->isValidPosition(x + dxv, y + dyv, z - 24, ixd, iyd, izd, _flags, 1, 0, 0) &&
+ !cm->isValidPosition(x, y, z - 24, ixd, iyd, izd, _flags, 1, 0, 0)) {
dzv = -24;
- } else if (cm->isValidPosition(x + dxv, y + dyv, z - 32, ixd, iyd, izd, flags, 1, 0, 0) &&
- !cm->isValidPosition(x, y, z - 32, ixd, iyd, izd, flags, 1, 0, 0)) {
+ } else if (cm->isValidPosition(x + dxv, y + dyv, z - 32, ixd, iyd, izd, _flags, 1, 0, 0) &&
+ !cm->isValidPosition(x, y, z - 32, ixd, iyd, izd, _flags, 1, 0, 0)) {
dzv = -32;
}
}
diff --git a/engines/ultima/ultima8/world/actors/resurrection_process.cpp b/engines/ultima/ultima8/world/actors/resurrection_process.cpp
index 1329b58..27b46f0 100644
--- a/engines/ultima/ultima8/world/actors/resurrection_process.cpp
+++ b/engines/ultima/ultima8/world/actors/resurrection_process.cpp
@@ -37,15 +37,15 @@ ResurrectionProcess::ResurrectionProcess() : Process() {
}
-ResurrectionProcess::ResurrectionProcess(Actor *actor_) {
- assert(actor_);
- item_num = actor_->getObjId();
+ResurrectionProcess::ResurrectionProcess(Actor *actor) {
+ assert(actor);
+ _itemNum = actor->getObjId();
- type = 0x229; // CONSTANT !
+ _type = 0x229; // CONSTANT !
}
void ResurrectionProcess::run() {
- Actor *a = getActor(item_num);
+ Actor *a = getActor(_itemNum);
if (!a) {
// actor gone... too late for resurrection now :-)
@@ -77,7 +77,7 @@ void ResurrectionProcess::run() {
a->setInCombat();
// we should already be killed by going into combat mode.
- if (!(flags & PROC_TERMINATED))
+ if (!(_flags & PROC_TERMINATED))
terminate();
}
diff --git a/engines/ultima/ultima8/world/actors/scheduler_process.cpp b/engines/ultima/ultima8/world/actors/scheduler_process.cpp
index 7bc3b98..7f28b12 100644
--- a/engines/ultima/ultima8/world/actors/scheduler_process.cpp
+++ b/engines/ultima/ultima8/world/actors/scheduler_process.cpp
@@ -39,7 +39,7 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(SchedulerProcess, Process)
SchedulerProcess::SchedulerProcess() : Process() {
lastRun = 0;
nextActor = 0;
- type = 0x245; // CONSTANT!
+ _type = 0x245; // CONSTANT!
}
void SchedulerProcess::run() {
diff --git a/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp b/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
index 4ab929d..28e31e4 100644
--- a/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/targeted_anim_process.cpp
@@ -48,7 +48,7 @@ bool TargetedAnimProcess::init() {
if (!ActorAnimProcess::init())
return false;
- tracker->setTargetedMode(x, y, z);
+ _tracker->setTargetedMode(x, y, z);
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp b/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
index c0d67b9..4e28824 100644
--- a/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
+++ b/engines/ultima/ultima8/world/actors/teleport_to_egg_process.cpp
@@ -41,7 +41,7 @@ TeleportToEggProcess::TeleportToEggProcess() : Process() {
TeleportToEggProcess::TeleportToEggProcess(int mapnum_, int teleport_id_)
: mapnum(mapnum_), teleport_id(teleport_id_) {
- type = 1; // CONSTANT! (type 1 = persistent)
+ _type = 1; // CONSTANT! (type 1 = persistent)
}
diff --git a/engines/ultima/ultima8/world/camera_process.cpp b/engines/ultima/ultima8/world/camera_process.cpp
index 25dfc09..6d21f4b 100644
--- a/engines/ultima/ultima8/world/camera_process.cpp
+++ b/engines/ultima/ultima8/world/camera_process.cpp
@@ -155,7 +155,7 @@ void CameraProcess::run() {
}
if (_time && elapsed > _time) {
- result = 0; // do we need this
+ _result = 0; // do we need this
CameraProcess::SetCameraProcess(0); // This will terminate us
return;
}
diff --git a/engines/ultima/ultima8/world/container.cpp b/engines/ultima/ultima8/world/container.cpp
index bb02829..3325a8c 100644
--- a/engines/ultima/ultima8/world/container.cpp
+++ b/engines/ultima/ultima8/world/container.cpp
@@ -53,8 +53,8 @@ Container::~Container() {
- // if we don't have an objid, we _must_ delete children
- if (objid == 0xFFFF) {
+ // if we don't have an _objId, we _must_ delete children
+ if (_objId == 0xFFFF) {
Std::list<Item *>::iterator iter;
for (iter = contents.begin(); iter != contents.end(); ++iter) {
delete(*iter);
@@ -148,7 +148,7 @@ bool Container::CanAddItem(Item *item, bool checkwghtvol) {
bool Container::addItem(Item *item, bool checkwghtvol) {
if (!CanAddItem(item, checkwghtvol)) return false;
- if (item->getParent() == objid) return true; // already in here
+ if (item->getParent() == _objId) return true; // already in here
contents.push_back(item);
return true;
@@ -326,7 +326,7 @@ bool Container::loadData(IDataSource *ids, uint32 version) {
if (!item) return false;
addItem(item);
- item->setParent(objid);
+ item->setParent(_objId);
}
return true;
diff --git a/engines/ultima/ultima8/world/create_item_process.cpp b/engines/ultima/ultima8/world/create_item_process.cpp
index 98bcca5..13a3588 100644
--- a/engines/ultima/ultima8/world/create_item_process.cpp
+++ b/engines/ultima/ultima8/world/create_item_process.cpp
@@ -59,7 +59,7 @@ void CreateItemProcess::run() {
npcnum, mapnum, extendedflags, true);
item->move(x, y, z);
- result = item->getObjId();
+ _result = item->getObjId();
terminate();
}
diff --git a/engines/ultima/ultima8/world/destroy_item_process.cpp b/engines/ultima/ultima8/world/destroy_item_process.cpp
index 8ff8b7c..5946508 100644
--- a/engines/ultima/ultima8/world/destroy_item_process.cpp
+++ b/engines/ultima/ultima8/world/destroy_item_process.cpp
@@ -41,21 +41,21 @@ DestroyItemProcess::DestroyItemProcess() : Process() {
DestroyItemProcess::DestroyItemProcess(Item *item_) {
if (item_)
- item_num = item_->getObjId();
+ _itemNum = item_->getObjId();
else
- item_num = 0;
+ _itemNum = 0;
- type = 0x232;
+ _type = 0x232;
}
void DestroyItemProcess::run() {
- if (item_num == 0) {
+ if (_itemNum == 0) {
// need to get ObjId to use from process result. (We were apparently
// waiting for a process which returned the ObjId to delete.)
- item_num = static_cast<ObjId>(result);
+ _itemNum = static_cast<ObjId>(_result);
}
- Item *it = getItem(item_num);
+ Item *it = getItem(_itemNum);
if (!it) {
// somebody did our work for us...
diff --git a/engines/ultima/ultima8/world/fireball_process.cpp b/engines/ultima/ultima8/world/fireball_process.cpp
index 9c98129..1c6d4d2 100644
--- a/engines/ultima/ultima8/world/fireball_process.cpp
+++ b/engines/ultima/ultima8/world/fireball_process.cpp
@@ -55,17 +55,17 @@ FireballProcess::FireballProcess(Item *item, Item *target_)
tail[1] = 0;
tail[2] = 0;
- item_num = item->getObjId();
+ _itemNum = item->getObjId();
target = target_->getObjId();
- type = 0x218; // CONSTANT!
+ _type = 0x218; // CONSTANT!
}
void FireballProcess::run() {
age++;
- Item *item = getItem(item_num);
+ Item *item = getItem(_itemNum);
if (!item) {
terminate();
return;
@@ -165,7 +165,7 @@ void FireballProcess::terminate() {
}
void FireballProcess::explode() {
- Item *item = getItem(item_num);
+ Item *item = getItem(_itemNum);
if (item) item->destroy();
for (unsigned int i = 0; i < 3; ++i) {
diff --git a/engines/ultima/ultima8/world/gravity_process.cpp b/engines/ultima/ultima8/world/gravity_process.cpp
index 5a35848..167f005 100644
--- a/engines/ultima/ultima8/world/gravity_process.cpp
+++ b/engines/ultima/ultima8/world/gravity_process.cpp
@@ -45,18 +45,18 @@ GravityProcess::GravityProcess()
}
-GravityProcess::GravityProcess(Item *item, int gravity_)
- : xspeed(0), yspeed(0), zspeed(0) {
+GravityProcess::GravityProcess(Item *item, int gravity)
+ : _xSpeed(0), _ySpeed(0), _zSpeed(0) {
assert(item);
- gravity = gravity_;
- item_num = item->getObjId();
+ _gravity = gravity;
+ _itemNum = item->getObjId();
- type = 0x203; // CONSTANT!
+ _type = 0x203; // CONSTANT!
}
void GravityProcess::init() {
- Item *item = getItem(item_num);
+ Item *item = getItem(_itemNum);
assert(item);
item->setGravityPID(getPid());
@@ -68,21 +68,21 @@ void GravityProcess::init() {
}
void GravityProcess::move(int xs, int ys, int zs) {
- xspeed += xs;
- yspeed += ys;
- zspeed += zs;
+ _xSpeed += xs;
+ _ySpeed += ys;
+ _zSpeed += zs;
}
-void GravityProcess::setGravity(int gravity_) {
- // only apply gravity if stronger than current gravity
+void GravityProcess::setGravity(int gravity) {
+ // only apply _gravity if stronger than current _gravity
//!!! is this correct?
- if (gravity_ > gravity)
- gravity = gravity_;
+ if (gravity > _gravity)
+ _gravity = gravity;
}
void GravityProcess::run() {
// move item in (xs,ys,zs) direction
- Item *item = getItem(item_num);
+ Item *item = getItem(_itemNum);
if (!item) {
terminate();
return;
@@ -108,9 +108,9 @@ void GravityProcess::run() {
item->getFootpadWorld(ixd, iyd, izd);
int32 tx, ty, tz;
- tx = ix + xspeed;
- ty = iy + yspeed;
- tz = iz + zspeed;
+ tx = ix + _xSpeed;
+ ty = iy + _ySpeed;
+ tz = iz + _zSpeed;
bool clipped = false;
@@ -119,21 +119,21 @@ void GravityProcess::run() {
if (tx < 0 && ix >= 0) {
int32 scale = (ix - tx) >> 0x8;
tx = 0;
- ty = iy + ((yspeed * scale) >> 0x2000);
- tz = iz + ((zspeed * scale) >> 0x2000);
+ ty = iy + ((_ySpeed * scale) >> 0x2000);
+ tz = iz + ((_zSpeed * scale) >> 0x2000);
clipped = true;
}
if (ty < 0 && iy >= 0) {
int32 scale = (iy - ty) >> 0x8;
- tx = ix + ((xspeed * scale) >> 0x2000);
+ tx = ix + ((_xSpeed * scale) >> 0x2000);
ty = 0;
- tz = iz + ((zspeed * scale) >> 0x2000);
+ tz = iz + ((_zSpeed * scale) >> 0x2000);
clipped = true;
}
if (tz < 0 && iz >= 0) {
int32 scale = (iz - tz) >> 0x8;
- tx = ix + ((xspeed * scale) >> 0x2000);
- ty = iy + ((yspeed * scale) >> 0x2000);
+ tx = ix + ((_xSpeed * scale) >> 0x2000);
+ ty = iy + ((_ySpeed * scale) >> 0x2000);
tz = 0;
clipped = true;
}
@@ -147,7 +147,7 @@ void GravityProcess::run() {
if (dist == 0x4000 && !clipped) {
// normal move
- zspeed -= gravity;
+ _zSpeed -= _gravity;
return;
}
@@ -165,34 +165,34 @@ void GravityProcess::run() {
// only blocked going down?
- if (dirs == 4 && zspeed < 0) {
+ if (dirs == 4 && _zSpeed < 0) {
// If it landed on top of hititem and hititem is not land, the item
// should always bounce.
bool terminate = true;
Item *hititem = getItem(hititemid);
- if (zspeed < -2 && !p_dynamic_cast<Actor *>(item)) {
+ if (_zSpeed < -2 && !p_dynamic_cast<Actor *>(item)) {
#ifdef BOUNCE_DIAG
- pout << "item " << item_num << " bounce ["
+ pout << "item " << _itemNum << " bounce ["
<< Kernel::get_instance()->getFrameNum()
<< "]: hit " << hititem->getObjId() << Std::endl;
#endif
- if (!hititem->getShapeInfo()->is_land() || zspeed < -2 * gravity) {
+ if (!hititem->getShapeInfo()->is_land() || _zSpeed < -2 * _gravity) {
// Bounce!
terminate = false;
#ifdef BOUNCE_DIAG
- int xspeedold = xspeed;
- int yspeedold = yspeed;
- int zspeedold = zspeed;
+ int xspeedold = _xSpeed;
+ int yspeedold = _ySpeed;
+ int zspeedold = _zSpeed;
#endif
- zspeed = 0 - zspeed / 3;
- int approx_v = ABS(xspeed) + ABS(yspeed) + zspeed;
+ _zSpeed = 0 - _zSpeed / 3;
+ int approx_v = ABS(_xSpeed) + ABS(_ySpeed) + _zSpeed;
// Apply an impulse on the x/y plane in a random direction
// in a 180 degree pie around the orginal vector in x/y
- double heading_r = atan2((double)yspeed, (double)xspeed);
+ double heading_r = atan2((double)_ySpeed, (double)_xSpeed);
double deltah_r = static_cast<double>(getRandom())
* M_PI / RAND_MAX - M_PI / 2;
#ifdef BOUNCE_DIAG
@@ -201,46 +201,46 @@ void GravityProcess::run() {
heading_r += deltah_r;
if (heading_r > M_PI) heading_r -= 2 * M_PI;
if (heading_r < -M_PI) heading_r += 2 * M_PI;
- yspeed += static_cast<int>(sin(heading_r) *
+ _ySpeed += static_cast<int>(sin(heading_r) *
static_cast<double>(approx_v));
- xspeed += static_cast<int>(cos(heading_r) *
+ _xSpeed += static_cast<int>(cos(heading_r) *
static_cast<double>(approx_v));
if (hititem->getShapeInfo()->is_land()) {
// Bouncing off land; this bounce approximates what's
// seen in the original U8 when the key thrown by
// Kilandra's daughters ghost lands on the grass.
- xspeed /= 4;
- yspeed /= 4;
- zspeed /= 2;
- if (zspeed == 0) terminate = true;
+ _xSpeed /= 4;
+ _ySpeed /= 4;
+ _zSpeed /= 2;
+ if (_zSpeed == 0) terminate = true;
} else {
// Not on land; this bounce approximates what's seen
// in the original U8 when Kilandra's daughters ghost
// throws a key at the Avatar's head
- if (ABS(yspeed) > 2) yspeed /= 2;
- if (ABS(xspeed) > 2) xspeed /= 2;
+ if (ABS(_ySpeed) > 2) _ySpeed /= 2;
+ if (ABS(_xSpeed) > 2) _xSpeed /= 2;
}
#ifdef BOUNCE_DIAG
- pout << "item " << item_num << " bounce ["
+ pout << "item " << _itemNum << " bounce ["
<< Kernel::get_instance()->getFrameNum()
<< "]: speed was (" << xspeedold << ","
- << yspeedold << "," << zspeedold << ") new zspeed "
- << zspeed << " heading " << headingold_r
+ << yspeedold << "," << zspeedold << ") new _zSpeed "
+ << _zSpeed << " heading " << headingold_r
<< " impulse " << heading_r << " ("
- << (xspeed - xspeedold) << "," << (yspeed - yspeedold)
+ << (_xSpeed - xspeedold) << "," << (_ySpeed - yspeedold)
<< "), terminate: " << terminate << Std::endl;
#endif
} else {
#ifdef BOUNCE_DIAG
- pout << "item " << item_num << " bounce ["
+ pout << "item " << _itemNum << " bounce ["
<< Kernel::get_instance()->getFrameNum()
<< "]: no bounce" << Std::endl;
#endif
}
} else {
#ifdef BOUNCE_DIAG
- pout << "item " << item_num << " bounce ["
+ pout << "item " << _itemNum << " bounce ["
<< Kernel::get_instance()->getFrameNum()
<< "]: slow hit" << Std::endl;
#endif
@@ -260,24 +260,24 @@ void GravityProcess::run() {
// invert and decrease speed in all blocked directions
#ifdef BOUNCE_DIAG
- int xspeedold = xspeed;
- int yspeedold = yspeed;
- int zspeedold = zspeed;
+ int xspeedold = _xSpeed;
+ int yspeedold = _ySpeed;
+ int zspeedold = _zSpeed;
#endif
if (dirs & 1)
- xspeed = -xspeed / 2;
+ _xSpeed = -_xSpeed / 2;
if (dirs & 2)
- yspeed = -yspeed / 2;
+ _ySpeed = -_ySpeed / 2;
if (dirs & 4)
- zspeed = -zspeed / 2;
+ _zSpeed = -_zSpeed / 2;
#ifdef BOUNCE_DIAG
- pout << "item " << item_num << " bounce ["
+ pout << "item " << _itemNum << " bounce ["
<< Kernel::get_instance()->getFrameNum()
<< "]: speed was (" << xspeedold << ","
<< yspeedold << "," << zspeedold << ") new speed ("
- << xspeed << "," << yspeed << "," << zspeed << ")" << Std::endl;
+ << _xSpeed << "," << _ySpeed << "," << _zSpeed << ")" << Std::endl;
#endif
item->setFlag(Item::FLG_BOUNCING);
@@ -288,7 +288,7 @@ void GravityProcess::run() {
void GravityProcess::terminate() {
//signal item GravityProcess is gone
- Item *item = getItem(item_num);
+ Item *item = getItem(_itemNum);
if (item) {
item->setGravityPID(0);
@@ -303,7 +303,7 @@ void GravityProcess::fallStopped() {
// actors take a hit if they fall
// CHECKME: might need to do a 'die' animation even if actor is dead
- Actor *actor = getActor(item_num);
+ Actor *actor = getActor(_itemNum);
if (actor && !actor->isDead()) {
int height = actor->getFallStart() - actor->getZ();
@@ -323,13 +323,13 @@ void GravityProcess::fallStopped() {
// 'ooof'
AudioProcess *audioproc = AudioProcess::get_instance();
- if (audioproc) audioproc->playSFX(51, 250, item_num, 0); // CONSTANT!
+ if (audioproc) audioproc->playSFX(51, 250, _itemNum, 0); // CONSTANT!
}
if (!actor->isDead() && actor->getLastAnim() != Animation::die) {
// play land animation, overriding other animations
- Kernel::get_instance()->killProcesses(item_num, 0xF0, false); // CONSTANT!
+ Kernel::get_instance()->killProcesses(_itemNum, 0xF0, false); // CONSTANT!
ProcId lpid = actor->doAnim(Animation::land, 8);
if (actor->isInCombat()) {
@@ -346,27 +346,27 @@ void GravityProcess::fallStopped() {
void GravityProcess::dumpInfo() {
Process::dumpInfo();
- pout << "gravity: " << gravity << ", speed: (" << xspeed << ","
- << yspeed << "," << zspeed << ")" << Std::endl;
+ pout << "_gravity: " << _gravity << ", speed: (" << _xSpeed << ","
+ << _ySpeed << "," << _zSpeed << ")" << Std::endl;
}
void GravityProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(static_cast<uint32>(gravity));
- ods->write4(static_cast<uint32>(xspeed));
- ods->write4(static_cast<uint32>(yspeed));
- ods->write4(static_cast<uint32>(zspeed));
+ ods->write4(static_cast<uint32>(_gravity));
+ ods->write4(static_cast<uint32>(_xSpeed));
+ ods->write4(static_cast<uint32>(_ySpeed));
+ ods->write4(static_cast<uint32>(_zSpeed));
}
bool GravityProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- gravity = static_cast<int>(ids->read4());
- xspeed = static_cast<int>(ids->read4());
- yspeed = static_cast<int>(ids->read4());
- zspeed = static_cast<int>(ids->read4());
+ _gravity = static_cast<int>(ids->read4());
+ _xSpeed = static_cast<int>(ids->read4());
+ _ySpeed = static_cast<int>(ids->read4());
+ _zSpeed = static_cast<int>(ids->read4());
return true;
}
diff --git a/engines/ultima/ultima8/world/gravity_process.h b/engines/ultima/ultima8/world/gravity_process.h
index 094a8a2..9e3fdf2 100644
--- a/engines/ultima/ultima8/world/gravity_process.h
+++ b/engines/ultima/ultima8/world/gravity_process.h
@@ -55,8 +55,8 @@ protected:
void fallStopped();
- int gravity;
- int xspeed, yspeed, zspeed;
+ int _gravity;
+ int _xSpeed, _ySpeed, _zSpeed;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index a4ecfe8..3f676d5 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -148,7 +148,7 @@ void Item::move(int32 X, int32 Y, int32 Z) {
if (flags & FLG_ETHEREAL) {
// Remove us from the ethereal void
- World::get_instance()->etherealRemove(objid);
+ World::get_instance()->etherealRemove(_objId);
}
// Remove from container (if contained or equiped)
@@ -251,7 +251,7 @@ bool Item::moveToContainer(Container *container, bool checkwghtvol) {
if (flags & FLG_ETHEREAL) {
// Remove us from the ethereal void
- World::get_instance()->etherealRemove(objid);
+ World::get_instance()->etherealRemove(_objId);
}
// Remove from container (if contained or equiped)
@@ -326,7 +326,7 @@ void Item::moveToEtherealVoid() {
if (flags & FLG_ETHEREAL) return;
// Add it to the ethereal void
- World::get_instance()->etherealPush(objid);
+ World::get_instance()->etherealPush(_objId);
// It's owned by something removed it from the something, but keep flags
if (flags & (FLG_CONTAINED | FLG_EQUIPPED)) {
@@ -862,8 +862,7 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
// Do the sweep test
Std::list<CurrentMap::SweepItem> collisions;
Std::list<CurrentMap::SweepItem>::iterator it;
- map->sweepTest(start, end, dims, getShapeInfo()->flags, objid,
- false, &collisions);
+ map->sweepTest(start, end, dims, getShapeInfo()->flags, _objId, false, &collisions);
// Ok, now to work out what to do
@@ -903,15 +902,15 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
}
// Hitting us at the end (call hit on us, got hit on them)
else if (it->end_time == 0x4000) {
- if (objid == 1 && guiapp->isShowTouchingItems())
+ if (_objId == 1 && guiapp->isShowTouchingItems())
item->setExtFlag(Item::EXT_HIGHLIGHT);
- item->callUsecodeEvent_gotHit(objid, hitforce);
+ item->callUsecodeEvent_gotHit(_objId, hitforce);
callUsecodeEvent_hit(item->getObjId(), hitforce);
}
// Hitting us at the start (call release on us and them)
else if (!parent && it->hit_time == 0x0000) {
- if (objid == 1) item->clearExtFlag(Item::EXT_HIGHLIGHT);
+ if (_objId == 1) item->clearExtFlag(Item::EXT_HIGHLIGHT);
we_were_released = true;
item->callUsecodeEvent_release();
}
@@ -969,16 +968,16 @@ int32 Item::collideMove(int32 dx, int32 dy, int32 dz, bool teleport, bool force,
// If hitting at start, we should have already
// called gotHit and hit.
if ((!it->touching || it->touching_floor) && it->hit_time >= 0) {
- if (objid == 1 && guiapp->isShowTouchingItems())
+ if (_objId == 1 && guiapp->isShowTouchingItems())
item->setExtFlag(Item::EXT_HIGHLIGHT);
- proc_gothit = item->callUsecodeEvent_gotHit(objid, hitforce);
+ proc_gothit = item->callUsecodeEvent_gotHit(_objId, hitforce);
callUsecodeEvent_hit(item->getObjId(), hitforce);
}
// If not hitting at end, we will need to call release
if (it->end_time < hit) {
- if (objid == 1) item->clearExtFlag(Item::EXT_HIGHLIGHT);
+ if (_objId == 1) item->clearExtFlag(Item::EXT_HIGHLIGHT);
we_were_released = true;
proc_rel = item->callUsecodeEvent_release();
}
@@ -1015,17 +1014,17 @@ unsigned int Item::countNearby(uint32 shape_, uint16 range) {
uint32 Item::callUsecodeEvent(uint32 event, const uint8 *args, int argsize) {
uint32 class_id = shape;
- // Non-monster NPCs use objid/npcnum + 1024
+ // Non-monster NPCs use _objId/npcnum + 1024
// Note: in the original, a non-monster NPC is specified with
// the FAST_ONLY flag. However, this causes some summoned monster which
// do not receive the FAST_ONLY flag to behave strangely. (Confirmed that
// happens in the original as well.) -wjp 20050128
- if (objid < 256 && (extendedflags & EXT_PERMANENT_NPC))
- class_id = objid + 1024;
+ if (_objId < 256 && (extendedflags & EXT_PERMANENT_NPC))
+ class_id = _objId + 1024;
// CHECKME: to make Pentagram behave as much like the original as possible,
// don't call any usecode if the original would call the wrong class
- if (objid < 256 && !(extendedflags & EXT_PERMANENT_NPC) &&
+ if (_objId < 256 && !(extendedflags & EXT_PERMANENT_NPC) &&
!(flags & FLG_FAST_ONLY))
return 0;
@@ -1040,7 +1039,7 @@ uint32 Item::callUsecodeEvent(uint32 event, const uint8 *args, int argsize) {
#ifdef DEBUG
if (UCMachine::get_instance()->trace_event()) {
pout.printf("Item: %d calling usecode event %d @ %04X:%04X\n",
- objid, event, class_id, offset);
+ _objId, event, class_id, offset);
}
#endif
@@ -1150,7 +1149,7 @@ uint32 Item::use() {
void Item::destroy(bool delnow) {
if (flags & FLG_ETHEREAL) {
// Remove us from the ether
- World::get_instance()->etherealRemove(objid);
+ World::get_instance()->etherealRemove(_objId);
} else if (parent) {
// we're in a container, so remove self from parent
//!! need to make sure this works for equipped items too...
@@ -1202,7 +1201,7 @@ void Item::setupLerp(int32 gametick) {
extendedflags &= ~EXT_LERP_NOPREV;
// Animate it, if needed
- if ((gametick % 3) == (objid % 3)) animateItem();
+ if ((gametick % 3) == (_objId % 3)) animateItem();
// Setup the prev values for lerping
if (!no_lerp) l_prev = l_next;
@@ -1234,7 +1233,7 @@ void Item::animateItem() {
int anim_data = info->animdata;
//bool dirty = false;
- if ((static_cast<int>(last_setup) % 6) != (objid % 6) && info->animtype != 1)
+ if ((static_cast<int>(last_setup) % 6) != (_objId % 6) && info->animtype != 1)
return;
switch (info->animtype) {
@@ -1359,10 +1358,10 @@ uint16 Item::openGump(uint32 gumpshape) {
ContainerGump *cgump;
if (getObjId() != 1) { //!! constant
- cgump = new ContainerGump(shapeP, 0, objid, Gump::FLAG_ITEM_DEPENDENT |
+ cgump = new ContainerGump(shapeP, 0, _objId, Gump::FLAG_ITEM_DEPENDENT |
Gump::FLAG_DRAGGABLE);
} else {
- cgump = new PaperdollGump(shapeP, 0, objid, Gump::FLAG_ITEM_DEPENDENT |
+ cgump = new PaperdollGump(shapeP, 0, _objId, Gump::FLAG_ITEM_DEPENDENT |
Gump::FLAG_DRAGGABLE);
}
//!!TODO: clean up the way this is set
@@ -1396,7 +1395,7 @@ void Item::clearGump() {
}
int32 Item::ascend(int delta) {
-// pout << "Ascend: objid=" << getObjId() << ", delta=" << delta << Std::endl;
+// pout << "Ascend: _objId=" << getObjId() << ", delta=" << delta << Std::endl;
if (delta == 0) return 0x4000;
@@ -1684,7 +1683,7 @@ bool Item::canReach(Item *other, int range,
World *world = World::get_instance();
CurrentMap *map = world->getCurrentMap();
map->sweepTest(start, end, dims, ShapeInfo::SI_SOLID,
- objid, false, &collisions);
+ _objId, false, &collisions);
if (checkLineOfSightCollisions(collisions, usingAlternatePos,
getObjId(), other->getObjId()))
return true;
@@ -1702,7 +1701,7 @@ bool Item::canReach(Item *other, int range,
collisions.clear();
map->sweepTest(start, end, dims, ShapeInfo::SI_SOLID,
- objid, false, &collisions);
+ _objId, false, &collisions);
if (checkLineOfSightCollisions(collisions, usingAlternatePos,
getObjId(), other->getObjId()))
return true;
@@ -1712,7 +1711,7 @@ bool Item::canReach(Item *other, int range,
collisions.clear();
map->sweepTest(start, end, dims, ShapeInfo::SI_SOLID,
- objid, false, &collisions);
+ _objId, false, &collisions);
return checkLineOfSightCollisions(collisions, usingAlternatePos,
getObjId(), other->getObjId());
}
@@ -2443,10 +2442,10 @@ uint32 Item::I_pop(const uint8 *args, unsigned int /*argsize*/) {
if (w->etherealEmpty()) return 0; // no items left on stack
- uint16 objid = w->etherealPeek();
- Item *item = getItem(objid);
+ uint16 _objId = w->etherealPeek();
+ Item *item = getItem(_objId);
if (!item) {
- w->etherealRemove(objid);
+ w->etherealRemove(_objId);
return 0; // top item was invalid
}
@@ -2458,7 +2457,7 @@ uint32 Item::I_pop(const uint8 *args, unsigned int /*argsize*/) {
//! Anything else?
- return objid;
+ return _objId;
}
uint32 Item::I_popToCoords(const uint8 *args, unsigned int /*argsize*/) {
@@ -2471,10 +2470,10 @@ uint32 Item::I_popToCoords(const uint8 *args, unsigned int /*argsize*/) {
if (w->etherealEmpty()) return 0; // no items left on stack
- uint16 objid = w->etherealPeek();
- Item *item = getItem(objid);
+ uint16 _objId = w->etherealPeek();
+ Item *item = getItem(_objId);
if (!item) {
- w->etherealRemove(objid);
+ w->etherealRemove(_objId);
return 0; // top item was invalid
}
@@ -2486,7 +2485,7 @@ uint32 Item::I_popToCoords(const uint8 *args, unsigned int /*argsize*/) {
//! Anything else?
- return objid;
+ return _objId;
}
uint32 Item::I_popToContainer(const uint8 *args, unsigned int /*argsize*/) {
@@ -2502,10 +2501,10 @@ uint32 Item::I_popToContainer(const uint8 *args, unsigned int /*argsize*/) {
if (w->etherealEmpty()) return 0; // no items left on stack
- uint16 objid = w->etherealPeek();
- Item *item = getItem(objid);
+ uint16 _objId = w->etherealPeek();
+ Item *item = getItem(_objId);
if (!item) {
- w->etherealRemove(objid);
+ w->etherealRemove(_objId);
return 0; // top item was invalid
}
@@ -2513,7 +2512,7 @@ uint32 Item::I_popToContainer(const uint8 *args, unsigned int /*argsize*/) {
//! Anything else?
- return objid;
+ return _objId;
}
uint32 Item::I_popToEnd(const uint8 *args, unsigned int /*argsize*/) {
@@ -2529,10 +2528,10 @@ uint32 Item::I_popToEnd(const uint8 *args, unsigned int /*argsize*/) {
if (w->etherealEmpty()) return 0; // no items left on stack
- uint16 objid = w->etherealPeek();
- Item *item = getItem(objid);
+ uint16 _objId = w->etherealPeek();
+ Item *item = getItem(_objId);
if (!item) {
- w->etherealRemove(objid);
+ w->etherealRemove(_objId);
return 0; // top item was invalid
}
@@ -2543,7 +2542,7 @@ uint32 Item::I_popToEnd(const uint8 *args, unsigned int /*argsize*/) {
//! This should probably be different from I_popToContainer, but
//! how exactly?
- return objid;
+ return _objId;
}
uint32 Item::I_move(const uint8 *args, unsigned int /*argsize*/) {
diff --git a/engines/ultima/ultima8/world/item_factory.cpp b/engines/ultima/ultima8/world/item_factory.cpp
index a93f04a..c493804 100644
--- a/engines/ultima/ultima8/world/item_factory.cpp
+++ b/engines/ultima/ultima8/world/item_factory.cpp
@@ -42,7 +42,7 @@ namespace Ultima8 {
Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
uint16 flags, uint16 npcnum, uint16 mapnum,
- uint32 extendedflags, bool objid) {
+ uint32 extendedflags, bool _objId) {
// check what class to create
ShapeInfo *info = GameData::get_instance()->getMainShapes()->
getShapeInfo(shape);
@@ -70,7 +70,7 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
item->npcnum = npcnum;
item->mapnum = mapnum;
item->extendedflags = extendedflags;
- if (objid) item->assignObjId();
+ if (_objId) item->assignObjId();
return item;
}
@@ -85,7 +85,7 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
container->npcnum = npcnum;
container->mapnum = mapnum;
container->extendedflags = extendedflags;
- if (objid) container->assignObjId();
+ if (_objId) container->assignObjId();
return container;
}
@@ -100,7 +100,7 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
globegg->npcnum = npcnum;
globegg->mapnum = mapnum;
globegg->extendedflags = extendedflags;
- if (objid) globegg->assignObjId();
+ if (_objId) globegg->assignObjId();
return globegg;
}
@@ -113,7 +113,7 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
egg->npcnum = npcnum;
egg->mapnum = mapnum;
egg->extendedflags = extendedflags;
- if (objid) egg->assignObjId();
+ if (_objId) egg->assignObjId();
return egg;
}
@@ -126,7 +126,7 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
egg->npcnum = npcnum;
egg->mapnum = mapnum;
egg->extendedflags = extendedflags;
- if (objid) egg->assignObjId();
+ if (_objId) egg->assignObjId();
return egg;
}
@@ -139,7 +139,7 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
egg->npcnum = npcnum;
egg->mapnum = mapnum;
egg->extendedflags = extendedflags;
- if (objid) egg->assignObjId();
+ if (_objId) egg->assignObjId();
return egg;
}
@@ -152,7 +152,7 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
Actor *ItemFactory::createActor(uint32 shape, uint32 frame, uint16 quality,
uint16 flags, uint16 npcnum, uint16 mapnum,
- uint32 extendedflags, bool objid) {
+ uint32 extendedflags, bool _objId) {
// this function should probably differentiate between the Avatar,
// NPCs, monsters?
@@ -174,7 +174,7 @@ Actor *ItemFactory::createActor(uint32 shape, uint32 frame, uint16 quality,
actor->flags = flags;
actor->npcnum = npcnum;
actor->mapnum = mapnum;
- actor->objid = 1;
+ actor->_objId = 1;
actor->extendedflags = extendedflags;
return actor;
}
@@ -188,8 +188,8 @@ Actor *ItemFactory::createActor(uint32 shape, uint32 frame, uint16 quality,
actor->npcnum = npcnum;
actor->mapnum = mapnum;
if (npcnum != 0) {
- actor->objid = static_cast<uint16>(npcnum);
- } else if (objid) {
+ actor->_objId = static_cast<uint16>(npcnum);
+ } else if (_objId) {
actor->assignObjId();
}
actor->extendedflags = extendedflags;
diff --git a/engines/ultima/ultima8/world/split_item_process.cpp b/engines/ultima/ultima8/world/split_item_process.cpp
index c422cce..2ebde00 100644
--- a/engines/ultima/ultima8/world/split_item_process.cpp
+++ b/engines/ultima/ultima8/world/split_item_process.cpp
@@ -47,14 +47,14 @@ SplitItemProcess::SplitItemProcess(Item *original, Item *target_) {
assert(original->getShapeInfo()->hasQuantity());
assert(target_->getShapeInfo()->hasQuantity());
- item_num = original->getObjId();
+ _itemNum = original->getObjId();
target = target_->getObjId();
// type = TODO
}
void SplitItemProcess::run() {
- Item *original = getItem(item_num);
+ Item *original = getItem(_itemNum);
Item *targetitem = getItem(target);
assert(original);
@@ -62,7 +62,7 @@ void SplitItemProcess::run() {
assert(original->getShapeInfo()->hasQuantity());
assert(targetitem->getShapeInfo()->hasQuantity());
- uint16 movecount = static_cast<uint16>(result);
+ uint16 movecount = static_cast<uint16>(_result);
assert(movecount <= original->getQuality());
@@ -88,7 +88,7 @@ void SplitItemProcess::run() {
original = 0;
}
- result = 0;
+ _result = 0;
if (!is_terminated())
terminate();
diff --git a/engines/ultima/ultima8/world/sprite_process.cpp b/engines/ultima/ultima8/world/sprite_process.cpp
index 2420244..669e44a 100644
--- a/engines/ultima/ultima8/world/sprite_process.cpp
+++ b/engines/ultima/ultima8/world/sprite_process.cpp
@@ -61,14 +61,14 @@ void SpriteProcess::init() {
}
SpriteProcess::~SpriteProcess(void) {
- Item *item = getItem(item_num);
+ Item *item = getItem(_itemNum);
if (item) item->destroy();
}
void SpriteProcess::run() {
if (!initialized) init();
- Item *item = getItem(item_num);
+ Item *item = getItem(_itemNum);
if (!item || (frame > last_frame && repeats == 1 && !delay_counter)) {
terminate();
Commit: 53acfaa556e6f634f5d760a7f2211f929057c846
https://github.com/scummvm/scummvm/commit/53acfaa556e6f634f5d760a7f2211f929057c846
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-15T21:39:28-08:00
Commit Message:
ULTIMA8: Renaming misc folder class fields
Changed paths:
engines/ultima/ultima8/kernel/kernel.cpp
engines/ultima/ultima8/kernel/object.cpp
engines/ultima/ultima8/kernel/object_manager.cpp
engines/ultima/ultima8/kernel/process.cpp
engines/ultima/ultima8/misc/box.h
engines/ultima/ultima8/misc/console.cpp
engines/ultima/ultima8/misc/console.h
engines/ultima/ultima8/misc/errors.h
engines/ultima/ultima8/misc/id_man.cpp
engines/ultima/ultima8/misc/id_man.h
engines/ultima/ultima8/misc/p_dynamic_cast.h
engines/ultima/ultima8/world/actors/loiter_process.cpp
engines/ultima/ultima8/world/actors/loiter_process.h
engines/ultima/ultima8/world/item.cpp
diff --git a/engines/ultima/ultima8/kernel/kernel.cpp b/engines/ultima/ultima8/kernel/kernel.cpp
index 5e2d8a4..8e9b052 100644
--- a/engines/ultima/ultima8/kernel/kernel.cpp
+++ b/engines/ultima/ultima8/kernel/kernel.cpp
@@ -249,7 +249,7 @@ void Kernel::processTypes() {
Std::map<Common::String, unsigned int> processtypes;
for (ProcessIterator it = processes.begin(); it != processes.end(); ++it) {
Process *p = *it;
- processtypes[p->GetClassType().class_name]++;
+ processtypes[p->GetClassType()._className]++;
}
Std::map<Common::String, unsigned int>::iterator iter;
for (iter = processtypes.begin(); iter != processtypes.end(); ++iter) {
diff --git a/engines/ultima/ultima8/kernel/object.cpp b/engines/ultima/ultima8/kernel/object.cpp
index d77d3fe..b6d4aa1 100644
--- a/engines/ultima/ultima8/kernel/object.cpp
+++ b/engines/ultima/ultima8/kernel/object.cpp
@@ -61,7 +61,7 @@ void Object::clearObjId() {
void Object::dumpInfo() {
pout << "Object " << getObjId() << " (class "
- << GetClassType().class_name << ")" << Std::endl;
+ << GetClassType()._className << ")" << Std::endl;
}
ProcId Object::callUsecode(uint16 classid, uint16 offset,
@@ -78,7 +78,7 @@ void Object::save(ODataSource *ods) {
}
void Object::writeObjectHeader(ODataSource *ods) {
- const char *cname = GetClassType().class_name; // note: virtual
+ const char *cname = GetClassType()._className; // note: virtual
uint16 clen = strlen(cname);
ods->write2(clen);
diff --git a/engines/ultima/ultima8/kernel/object_manager.cpp b/engines/ultima/ultima8/kernel/object_manager.cpp
index d109b13..8a8d6e2 100644
--- a/engines/ultima/ultima8/kernel/object_manager.cpp
+++ b/engines/ultima/ultima8/kernel/object_manager.cpp
@@ -148,7 +148,7 @@ void ObjectManager::objectTypes() {
for (unsigned int i = 1; i < _objects.size(); ++i) {
Object *o = _objects[i];
if (!o) continue;
- objecttypes[o->GetClassType().class_name]++;
+ objecttypes[o->GetClassType()._className]++;
}
Std::map<Common::String, unsigned int>::iterator iter;
diff --git a/engines/ultima/ultima8/kernel/process.cpp b/engines/ultima/ultima8/kernel/process.cpp
index 76f3197..6138148 100644
--- a/engines/ultima/ultima8/kernel/process.cpp
+++ b/engines/ultima/ultima8/kernel/process.cpp
@@ -98,7 +98,7 @@ void Process::suspend() {
void Process::dumpInfo() {
Common::String info = Common::String::format(
"Process %d class %s, item %d, _type %x, status ",
- getPid(), GetClassType().class_name, _itemNum, _type);
+ getPid(), GetClassType()._className, _itemNum, _type);
pout << info.c_str();
if (_flags & PROC_ACTIVE) pout << "A";
@@ -124,7 +124,7 @@ void Process::save(ODataSource *ods) {
}
void Process::writeProcessHeader(ODataSource *ods) {
- const char *cname = GetClassType().class_name; // virtual
+ const char *cname = GetClassType()._className; // virtual
uint16 clen = strlen(cname);
ods->write2(clen);
diff --git a/engines/ultima/ultima8/misc/box.h b/engines/ultima/ultima8/misc/box.h
index ba97dc7..09de8b6 100644
--- a/engines/ultima/ultima8/misc/box.h
+++ b/engines/ultima/ultima8/misc/box.h
@@ -25,21 +25,21 @@ namespace Ultima {
namespace Ultima8 {
struct Box {
- int32 x, y, z;
- int32 xd, yd, zd;
+ int32 _x, _y, _z;
+ int32 _xd, _yd, _zd;
- Box() : x(0), y(0), z(0), xd(0), yd(0), zd(0) {}
+ Box() : _x(0), _y(0), _z(0), _xd(0), _yd(0), _zd(0) {}
Box(int nx, int ny, int nz, int nxd, int nyd, int nzd)
- : x(nx), y(ny), z(nz), xd(nxd), yd(nyd), zd(nzd) {}
- Box(const Box &o) : x(o.x), y(o.y), z(o.z), xd(o.xd), yd(o.yd), zd(o.zd) {}
+ : _x(nx), _y(ny), _z(nz), _xd(nxd), _yd(nyd), _zd(nzd) {}
+ Box(const Box &o) : _x(o._x), _y(o._y), _z(o._z), _xd(o._xd), _yd(o._yd), _zd(o._zd) {}
void Set(int nx, int ny, int nz, int nxd, int nyd, int nzd) {
- x = nx;
- y = ny;
- z = nz;
- xd = nxd;
- yd = nyd;
- zd = nzd;
+ _x = nx;
+ _y = ny;
+ _z = nz;
+ _xd = nxd;
+ _yd = nyd;
+ _zd = nzd;
}
void Set(Box &o) {
*this = o;
@@ -47,55 +47,54 @@ struct Box {
// Check to see if a Box is 'valid'
bool IsValid() const {
- return xd > 0 && yd > 0 && zd > 0;
+ return _xd > 0 && _yd > 0 && _zd > 0;
}
// Check to see if a point is within the Box
bool InBox(int px, int py, int pz) const {
- return (px >= (x - xd) && py >= (y - yd) && pz >= z &&
- px < x && py < y && pz < (z + zd));
+ return (px >= (_x - _xd) && py >= (_y - _yd) && pz >= _z &&
+ px < _x && py < _y && pz < (_z + _zd));
}
// Move the Box (Relative)
void MoveRel(int32 dx, int32 dy, int32 dz) {
- x += dx;
- y += dy;
- z += dz;
+ _x += dx;
+ _y += dy;
+ _z += dz;
}
// Move the Box (Absolute)
void MoveAbs(int32 nx, int32 ny, int32 nz) {
- x = nx;
- y = ny;
- z = nz;
+ _x = nx;
+ _y = ny;
+ _z = nz;
}
// Resize the Box (Relative)
void ResizeRel(int32 dxd, int32 dyd, int32 dzd) {
- xd += dxd;
- yd += dyd;
- zd += dzd;
+ _xd += dxd;
+ _yd += dyd;
+ _zd += dzd;
}
// Resize the Box (Absolute)
void ResizeAbs(int32 nxd, int32 nyd, int32 nzd) {
- xd = nxd;
- yd = nyd;
- zd = nzd;
+ _xd = nxd;
+ _yd = nyd;
+ _zd = nzd;
}
bool Overlaps(const Box &o) const {
- if (x <= o.x - o.xd || o.x <= x - xd) return false;
- if (y <= o.y - o.yd || o.y <= y - yd) return false;
- if (z + zd <= o.z || o.z + o.zd <= z) return false;
+ if (_x <= o._x - o._xd || o._x <= _x - _xd) return false;
+ if (_y <= o._y - o._yd || o._y <= _y - _yd) return false;
+ if (_z + _zd <= o._z || o._z + o._zd <= _z) return false;
return true;
}
bool operator == (const Box &o) const {
- return (x == o.x && y == o.y && z == o.z &&
- xd == o.xd && yd == o.yd && zd == o.zd);
+ return (_x == o._x && _y == o._y && _z == o._z &&
+ _xd == o._xd && _yd == o._yd && _zd == o._zd);
}
-
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/misc/console.cpp b/engines/ultima/ultima8/misc/console.cpp
index 3336e16..23a0f25 100644
--- a/engines/ultima/ultima8/misc/console.cpp
+++ b/engines/ultima/ultima8/misc/console.cpp
@@ -57,18 +57,18 @@ console_err_ostream<char> *pperr = 0;
//
// Constructor
//
-Console::Console() : current(0), xoff(0), display(0), linewidth(-1),
- totallines(0), vislines(0), wordwrap(true), cr(false),
- putchar_count(0), std_output_enabled(0xFFFFFFFF),
- stdout_redir(0), stderr_redir(0), confont(0),
- auto_paint(0), msgMask(MM_ALL), framenum(0),
+Console::Console() : _current(0), _xOff(0), _display(0), _lineWidth(-1),
+ _totalLines(0), _visLines(0), _wordWrap(true), _cr(false),
+ _putChar_count(0), _stdOutputEnabled(0xFFFFFFFF),
+ _stdout_redir(0), _stderr_redir(0), _conFont(0),
+ _autoPaint(0), _msgMask(MM_ALL), _frameNum(0),
commandCursorPos(0), commandInsert(true), commandHistoryPos(0) {
con = this;
- linewidth = -1;
+ _lineWidth = -1;
CheckResize(0);
- Std::memset(times, 0, sizeof(times));
+ Std::memset(_times, 0, sizeof(_times));
// Lets try adding a Console command!
AddConsoleCommand("Console::CmdList", ConCmd_CmdList);
@@ -94,8 +94,8 @@ Con_Clear_f
================
*/
void Console::Clear() {
- Std::memset(text, ' ', CON_TEXTSIZE);
- putchar_count = 0;
+ Std::memset(_text, ' ', CON_TEXTSIZE);
+ _putChar_count = 0;
}
@@ -115,7 +115,7 @@ void Console::Dump(const char *name) {
// Need to do this first
PrintPutchar();
- Printf("Dumped console text to %s.\n", name);
+ Printf("Dumped console _text to %s.\n", name);
if (!f.open(name)) {
Print("ERROR: couldn't open.\n");
@@ -123,21 +123,21 @@ void Console::Dump(const char *name) {
}
// skip empty lines
- for (l = current - totallines + 1 ; l <= current ; l++) {
- line = text + (l % totallines) * linewidth;
- for (x = 0 ; x < linewidth ; x++)
+ for (l = _current - _totalLines + 1 ; l <= _current ; l++) {
+ line = _text + (l % _totalLines) * _lineWidth;
+ for (x = 0 ; x < _lineWidth ; x++)
if (line[x] != ' ')
break;
- if (x != linewidth)
+ if (x != _lineWidth)
break;
}
// write the remaining lines
- buffer[linewidth] = 0;
- for (; l <= current ; l++) {
- line = text + (l % totallines) * linewidth;
- Std::strncpy(buffer, line, linewidth);
- for (x = linewidth - 1 ; x >= 0 ; x--) {
+ buffer[_lineWidth] = 0;
+ for (; l <= _current ; l++) {
+ line = _text + (l % _totalLines) * _lineWidth;
+ Std::strncpy(buffer, line, _lineWidth);
+ for (x = _lineWidth - 1 ; x >= 0 ; x--) {
if (buffer[x] == ' ')
buffer[x] = 0;
else
@@ -168,48 +168,48 @@ void Console::CheckResize(int scrwidth) {
// Need to do this first
PrintPutchar();
- if (!confont)
+ if (!_conFont)
width = (scrwidth >> 3) - 2;
else
- width = (scrwidth / confont->width) - 2;
+ width = (scrwidth / _conFont->width) - 2;
- if (width == linewidth)
+ if (width == _lineWidth)
return;
if (width < 1) { // video hasn't been initialized yet
width = 78;
- linewidth = width;
- totallines = CON_TEXTSIZE / linewidth;
- Std::memset(text, ' ', CON_TEXTSIZE);
+ _lineWidth = width;
+ _totalLines = CON_TEXTSIZE / _lineWidth;
+ Std::memset(_text, ' ', CON_TEXTSIZE);
} else {
- oldwidth = linewidth;
- linewidth = width;
- oldtotallines = totallines;
- totallines = CON_TEXTSIZE / linewidth;
+ oldwidth = _lineWidth;
+ _lineWidth = width;
+ oldtotallines = _totalLines;
+ _totalLines = CON_TEXTSIZE / _lineWidth;
numlines = oldtotallines;
- if (totallines < numlines)
- numlines = totallines;
+ if (_totalLines < numlines)
+ numlines = _totalLines;
numchars = oldwidth;
- if (linewidth < numchars)
- numchars = linewidth;
+ if (_lineWidth < numchars)
+ numchars = _lineWidth;
- Std::memcpy(tbuf, text, CON_TEXTSIZE);
- Std::memset(text, ' ', CON_TEXTSIZE);
+ Std::memcpy(tbuf, _text, CON_TEXTSIZE);
+ Std::memset(_text, ' ', CON_TEXTSIZE);
for (i = 0 ; i < numlines ; i++) {
for (j = 0 ; j < numchars ; j++) {
- text[(totallines - 1 - i) * linewidth + j] =
- tbuf[((current - i + oldtotallines) %
+ _text[(_totalLines - 1 - i) * _lineWidth + j] =
+ tbuf[((_current - i + oldtotallines) %
oldtotallines) * oldwidth + j];
}
}
}
- current = totallines - 1;
- display = current;
+ _current = _totalLines - 1;
+ _display = _current;
}
@@ -217,7 +217,7 @@ void Console::CheckResize(int scrwidth) {
// Internal Methods
//
-// Print a text string to the console
+// Print a _text string to the console
void Console::PrintInternal(const char *txt) {
int y;
int c, l;
@@ -226,52 +226,52 @@ void Console::PrintInternal(const char *txt) {
PrintPutchar();
while (0 != (c = *txt)) {
- if (wordwrap) {
+ if (_wordWrap) {
// count word length
- for (l = 0 ; l < linewidth ; l++)
+ for (l = 0 ; l < _lineWidth ; l++)
if (txt[l] <= ' ')
break;
// word wrap
- if (l != linewidth && (xoff + l > linewidth))
- xoff = 0;
+ if (l != _lineWidth && (_xOff + l > _lineWidth))
+ _xOff = 0;
}
txt++;
- if (cr) {
- current--;
- cr = false;
+ if (_cr) {
+ _current--;
+ _cr = false;
}
- if (!xoff) {
+ if (!_xOff) {
Linefeed();
// mark time for transparent overlay
- if (current >= 0) times[current % CON_NUM_TIMES] = framenum;
+ if (_current >= 0) _times[_current % CON_NUM_TIMES] = _frameNum;
}
switch (c) {
case '\n':
- xoff = 0;
+ _xOff = 0;
break;
case '\r':
- xoff = 0;
- cr = true;
+ _xOff = 0;
+ _cr = true;
break;
- default: // display character and advance
- y = current % totallines;
- text[y * linewidth + xoff] = static_cast<char>(c);
- xoff++;
- if (xoff >= linewidth) xoff = 0;
+ default: // _display character and advance
+ y = _current % _totalLines;
+ _text[y * _lineWidth + _xOff] = static_cast<char>(c);
+ _xOff++;
+ if (_xOff >= _lineWidth) _xOff = 0;
break;
}
}
}
-// Print a text string to the console
+// Print a _text string to the console
void Console::PrintRawInternal(const char *txt, int n) {
int y;
int c, l;
@@ -282,44 +282,44 @@ void Console::PrintRawInternal(const char *txt, int n) {
for (int i = 0; i < n; i++) {
c = *txt;
- if (wordwrap) {
+ if (_wordWrap) {
// count word length
- for (l = 0 ; l < linewidth && l < n; l++)
+ for (l = 0 ; l < _lineWidth && l < n; l++)
if (txt[l] <= ' ') break;
// word wrap
- if (l != linewidth && (xoff + l > linewidth))
- xoff = 0;
+ if (l != _lineWidth && (_xOff + l > _lineWidth))
+ _xOff = 0;
}
txt++;
- if (cr) {
- current--;
- cr = false;
+ if (_cr) {
+ _current--;
+ _cr = false;
}
- if (!xoff) {
+ if (!_xOff) {
Linefeed();
// mark time for transparent overlay
- if (current >= 0) times[current % CON_NUM_TIMES] = framenum;
+ if (_current >= 0) _times[_current % CON_NUM_TIMES] = _frameNum;
}
switch (c) {
case '\n':
- xoff = 0;
+ _xOff = 0;
break;
case '\r':
- xoff = 0;
- cr = true;
+ _xOff = 0;
+ _cr = true;
break;
- default: // display character and advance
- y = current % totallines;
- text[y * linewidth + xoff] = static_cast<char>(c);
- xoff++;
- if (xoff >= linewidth) xoff = 0;
+ default: // _display character and advance
+ y = _current % _totalLines;
+ _text[y * _lineWidth + _xOff] = static_cast<char>(c);
+ _xOff++;
+ if (_xOff >= _lineWidth) _xOff = 0;
break;
}
@@ -328,61 +328,61 @@ void Console::PrintRawInternal(const char *txt, int n) {
// Add a linefeed to the buffer
void Console::Linefeed(void) {
- xoff = 0;
- display++;
- current++;
- Std::memset(&text[(current % totallines)*linewidth], ' ', linewidth);
+ _xOff = 0;
+ _display++;
+ _current++;
+ Std::memset(&_text[(_current % _totalLines)*_lineWidth], ' ', _lineWidth);
- if (auto_paint) auto_paint();
+ if (_autoPaint) _autoPaint();
}
-// Print a text string to the console
+// Print a _text string to the console
void Console::PutcharInternal(int c) {
// Add the character
- putchar_buf[putchar_count] = static_cast<char>(c);
+ _putChar_buf[_putChar_count] = static_cast<char>(c);
// Increment the counter
- putchar_count++;
+ _putChar_count++;
// If it was a space or less, or we've hit the limit we'll add it to the
// actual buffer
- if (c <= ' ' || putchar_count == (CON_PUTCHAR_SIZE - 1)) PrintPutchar();
+ if (c <= ' ' || _putChar_count == (CON_PUTCHAR_SIZE - 1)) PrintPutchar();
}
// Print the Putchar data, if possible
void Console::PrintPutchar() {
- if (!putchar_count) return;
+ if (!_putChar_count) return;
// Get the count
- //int count = putchar_count; //Darke: UNUSED?
+ //int count = _putChar_count; //Darke: UNUSED?
// Terminate the string
- putchar_buf[putchar_count] = 0;
+ _putChar_buf[_putChar_count] = 0;
// Clear the counter
- putchar_count = 0;
+ _putChar_count = 0;
// Print it
- PrintInternal(putchar_buf);
+ PrintInternal(_putChar_buf);
}
//
// STDOUT Methods
//
-// Print a text string to the console, and output to stdout
+// Print a _text string to the console, and output to stdout
void Console::Print(const char *txt) {
- if (std_output_enabled & CON_STDOUT)
+ if (_stdOutputEnabled & CON_STDOUT)
debug("%s", txt);
- if (stdout_redir)
- stdout_redir->write(txt, Std::strlen(txt));
+ if (_stdout_redir)
+ _stdout_redir->write(txt, Std::strlen(txt));
PrintInternal(txt);
}
-// Print a text string to the console, and output to stdout, with message filtering
+// Print a _text string to the console, and output to stdout, with message filtering
void Console::Print(const MsgMask mm, const char *txt) {
- if (mm & msgMask) Print(txt);
+ if (mm & _msgMask) Print(txt);
}
// printf, and output to stdout
@@ -398,7 +398,7 @@ int32 Console::Printf(const char *fmt, ...) {
// printf, and output to stdout, with message filtering.
int32 Console::Printf(const MsgMask mm, const char *fmt, ...) {
- if (!(mm & msgMask)) return 0;
+ if (!(mm & _msgMask)) return 0;
va_list argptr;
@@ -413,34 +413,34 @@ int32 Console::Printf(const MsgMask mm, const char *fmt, ...) {
int32 Console::vPrintf(const char *fmt, va_list argptr) {
Common::String str = Common::String::vformat(fmt, argptr);
- if (std_output_enabled & CON_STDOUT) {
+ if (_stdOutputEnabled & CON_STDOUT) {
debug("%s", str.c_str());
}
- if (stdout_redir)
- stdout_redir->write(str.c_str(), str.size());
+ if (_stdout_redir)
+ _stdout_redir->write(str.c_str(), str.size());
PrintInternal(str.c_str());
return str.size();
}
-// Print a text string to the console, and output to stdout
+// Print a _text string to the console, and output to stdout
void Console::PrintRaw(const char *txt, int n) {
- if (std_output_enabled & CON_STDOUT) {
+ if (_stdOutputEnabled & CON_STDOUT) {
Common::String str(txt, txt + n);
debug("%s", str.c_str());
}
- if (stdout_redir) stdout_redir->write(txt, n);
+ if (_stdout_redir) _stdout_redir->write(txt, n);
PrintRawInternal(txt, n);
}
// putchar, and output to stdout
void Console::Putchar(int c) {
- if (std_output_enabled & CON_STDOUT)
+ if (_stdOutputEnabled & CON_STDOUT)
debug("%c", c);
- if (stdout_redir) stdout_redir->write1(c);
+ if (_stdout_redir) _stdout_redir->write1(c);
PutcharInternal(c);
}
@@ -449,18 +449,18 @@ void Console::Putchar(int c) {
// STDERR Methods
//
-// Print a text string to the console, and output to stderr
+// Print a _text string to the console, and output to stderr
void Console::Print_err(const char *txt) {
- if (std_output_enabled & CON_STDERR)
+ if (_stdOutputEnabled & CON_STDERR)
debug("%s", txt);
- if (stderr_redir) stderr_redir->write(txt, Std::strlen(txt));
+ if (_stderr_redir) _stderr_redir->write(txt, Std::strlen(txt));
PrintInternal(txt);
}
-// Print a text string to the console, and output to stderr, with message filtering
+// Print a _text string to the console, and output to stderr, with message filtering
void Console::Print_err(const MsgMask mm, const char *txt) {
- if (mm & msgMask) Print_err(txt);
+ if (mm & _msgMask) Print_err(txt);
}
// printf, and output to stderr
@@ -476,7 +476,7 @@ int32 Console::Printf_err(const char *fmt, ...) {
// printf, and output to stderr, with message filtering
int32 Console::Printf_err(const MsgMask mm, const char *fmt, ...) {
- if (!(mm & msgMask)) return 0;
+ if (!(mm & _msgMask)) return 0;
va_list argptr;
@@ -491,39 +491,39 @@ int32 Console::Printf_err(const MsgMask mm, const char *fmt, ...) {
int32 Console::vPrintf_err(const char *fmt, va_list argptr) {
Common::String str = Common::String::format(fmt, argptr);
- if (std_output_enabled & CON_STDERR)
+ if (_stdOutputEnabled & CON_STDERR)
debug("%s", str.c_str());
- if (stderr_redir)
- stderr_redir->write(str.c_str(), str.size());
+ if (_stderr_redir)
+ _stderr_redir->write(str.c_str(), str.size());
PrintInternal(str.c_str());
return str.size();
}
-// Print a text string to the console, and output to stderr
+// Print a _text string to the console, and output to stderr
void Console::PrintRaw_err(const char *txt, int n) {
- if (std_output_enabled & CON_STDERR)
+ if (_stdOutputEnabled & CON_STDERR)
debug("%d", n);
- if (stderr_redir) stderr_redir->write(txt, n);
+ if (_stderr_redir) _stderr_redir->write(txt, n);
PrintRawInternal(txt, n);
}
// putchar, and output to stderr
void Console::Putchar_err(int c) {
- if (std_output_enabled & CON_STDERR)
+ if (_stdOutputEnabled & CON_STDERR)
debug("%c", c);
- if (stderr_redir) stderr_redir->write1(c);
+ if (_stderr_redir) _stderr_redir->write1(c);
PutcharInternal(c);
}
void Console::ScrollConsole(int32 lines) {
- display += lines;
+ _display += lines;
- if (display < 0) display = 0;
- if (display > current) display = current;
+ if (_display < 0) _display = 0;
+ if (_display > _current) _display = _current;
}
//
@@ -792,40 +792,40 @@ void Console::DrawConsole(RenderSurface *surf, int height) {
//for (x=0 ; x<5 ; x++)
// re.DrawChar (viddef.width-44+x*8, lines-12, 128 + version[x] );
- // draw the text
- vislines = lines;
+ // draw the _text
+ _visLines = lines;
#if 0
- rows = (lines - 8) >> 3; // rows of text to draw
+ rows = (lines - 8) >> 3; // rows of _text to draw
y = lines - 24;
#else
- rows = (lines / confont->height) - 2; // rows of text to draw
+ rows = (lines / _conFont->height) - 2; // rows of _text to draw
- y = lines - (confont->height * 3);
+ y = lines - (_conFont->height * 3);
#endif
// draw from the bottom up
- if (display != current) {
+ if (_display != _current) {
// draw arrows to show the buffer is backscrolled
- for (x = 0 ; x < linewidth ; x += 4)
- surf->PrintCharFixed(confont, '^', (x + 1) * confont->width, y);
+ for (x = 0 ; x < _lineWidth ; x += 4)
+ surf->PrintCharFixed(_conFont, '^', (x + 1) * _conFont->width, y);
- y -= confont->height;
+ y -= _conFont->height;
rows--;
}
- row = display;
- for (i = 0 ; i < rows ; i++, y -= confont->height, row--) {
+ row = _display;
+ for (i = 0 ; i < rows ; i++, y -= _conFont->height, row--) {
if (row < 0)
break;
- if (current - row >= totallines)
+ if (_current - row >= _totalLines)
break; // past scrollback wrap point
- char *txt = text + (row % totallines) * linewidth;
+ char *txt = _text + (row % _totalLines) * _lineWidth;
- for (x = 0 ; x < linewidth ; x++) {
- surf->PrintCharFixed(confont, txt[x], (x + 1)*confont->width, y);
+ for (x = 0 ; x < _lineWidth ; x++) {
+ surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->width, y);
// putchar (txt[x]);
}
//putchar ('\n');
@@ -835,30 +835,30 @@ void Console::DrawConsole(RenderSurface *surf, int height) {
int com_size = commandBuffer.size();
int cur_pos = commandCursorPos;
- if (com_size >= (linewidth - 1)) {
+ if (com_size >= (_lineWidth - 1)) {
com_size = cur_pos;
}
// prestep if horizontally scrolling
- if (com_size >= (linewidth - 1)) {
- com += 1 + com_size - (linewidth - 1);
- cur_pos = linewidth - 2;
+ if (com_size >= (_lineWidth - 1)) {
+ com += 1 + com_size - (_lineWidth - 1);
+ cur_pos = _lineWidth - 2;
}
- y = lines - (confont->height * 2);
+ y = lines - (_conFont->height * 2);
- surf->PrintCharFixed(confont, ']', confont->width, y);
+ surf->PrintCharFixed(_conFont, ']', _conFont->width, y);
- for (x = 0 ; x < (linewidth - 2) && com[x]; x++) {
- surf->PrintCharFixed(confont, com[x], (x + 2)*confont->width, y);
+ for (x = 0 ; x < (_lineWidth - 2) && com[x]; x++) {
+ surf->PrintCharFixed(_conFont, com[x], (x + 2)*_conFont->width, y);
// putchar (txt[x]);
}
// Now for cursor position
if (commandInsert)
- surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*confont->width) + 1, y, 2, confont->height);
+ surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->width) + 1, y, 2, _conFont->height);
else
- surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*confont->width) + 1, y + confont->height - 2, confont->width, 2);
+ surf->Fill32(0xFFFFFFFF, ((cur_pos + 2)*_conFont->width) + 1, y + _conFont->height - 2, _conFont->width, 2);
}
@@ -869,21 +869,21 @@ void Console::DrawConsoleNotify(RenderSurface *surf) {
int time;
v = 0;
- for (i = current - CON_NUM_TIMES + 1 ; i <= current ; i++) {
+ for (i = _current - CON_NUM_TIMES + 1 ; i <= _current ; i++) {
if (i < 0) continue;
- time = con->times[i % CON_NUM_TIMES];
+ time = con->_times[i % CON_NUM_TIMES];
if (time == 0) continue;
- time = framenum - time;
+ time = _frameNum - time;
//if (time > con_notifytime->value*1000)
if (time > 150) // Each message lasts 5 seconds (30*5=150 frames)
continue;
- txt = text + (i % totallines) * linewidth;
+ txt = _text + (i % _totalLines) * _lineWidth;
- for (x = 0 ; x < con->linewidth ; x++)
- surf->PrintCharFixed(confont, txt[x], (x + 1)*confont->width, v);
+ for (x = 0 ; x < con->_lineWidth ; x++)
+ surf->PrintCharFixed(_conFont, txt[x], (x + 1)*_conFont->width, v);
- v += confont->height;
+ v += _conFont->height;
}
}
diff --git a/engines/ultima/ultima8/misc/console.h b/engines/ultima/ultima8/misc/console.h
index 8732d05..84d7350 100644
--- a/engines/ultima/ultima8/misc/console.h
+++ b/engines/ultima/ultima8/misc/console.h
@@ -87,38 +87,38 @@ enum MsgMask {
};
class Console {
- char text[CON_TEXTSIZE];
- int32 current; // line where next message will be printed
- int32 xoff; // offset in current line for next print
- int32 display; // bottom of console displays this line
+ char _text[CON_TEXTSIZE];
+ int32 _current; // line where next message will be printed
+ int32 _xOff; // offset in current line for next print
+ int32 _display; // bottom of console displays this line
- int32 linewidth; // characters across screen
- int32 totallines; // total lines in console scrollback
+ int32 _lineWidth; // characters across screen
+ int32 _totalLines; // total lines in console scrollback
- int32 vislines;
+ int32 _visLines;
- bool wordwrap; // Enable/Disable word wrapping
- bool cr; // Line feed marker
+ bool _wordWrap; // Enable/Disable word wrapping
+ bool _cr; // Line feed marker
- int32 putchar_count; // Number of characters that have been putchar'd
- char putchar_buf[CON_PUTCHAR_SIZE]; // The Characters that have been putchar'd
+ int32 _putChar_count; // Number of characters that have been putchar'd
+ char _putChar_buf[CON_PUTCHAR_SIZE]; // The Characters that have been putchar'd
- uint32 std_output_enabled;
+ uint32 _stdOutputEnabled;
// stdout and stderr redirection
- ODataSource *stdout_redir;
- ODataSource *stderr_redir;
+ ODataSource *_stdout_redir;
+ ODataSource *_stderr_redir;
// Confont
- FixedWidthFont *confont;
+ FixedWidthFont *_conFont;
- void (*auto_paint)(void);
+ void (*_autoPaint)(void);
- MsgMask msgMask; // mask to determine which messages are printed or not
+ MsgMask _msgMask; // mask to determine which messages are printed or not
// Overlay timing
- uint32 framenum;
- uint32 times[CON_NUM_TIMES]; // framenum the line was generated
+ uint32 _frameNum;
+ uint32 _times[CON_NUM_TIMES]; // framenum the line was generated
// for transparent notify lines
public:
enum SpecialChars {
@@ -148,17 +148,17 @@ public:
// Set the console font texture
void SetConFont(FixedWidthFont *cf) {
- confont = cf;
+ _conFont = cf;
}
// Get the console font texture
FixedWidthFont *GetConFont() {
- return confont;
+ return _conFont;
}
// Autopaint will cause the GUIApp to re-paint everything after a linefeed
void SetAutoPaint(void (*func)(void)) {
- auto_paint = func;
+ _autoPaint = func;
}
// Scroll through the console. - is up + is down
@@ -166,32 +166,32 @@ public:
// Redirection
void RedirectOutputStream(uint32 mask, ODataSource *ds) {
- if (mask & CON_STDOUT) stdout_redir = ds;
- if (mask & CON_STDERR) stderr_redir = ds;
+ if (mask & CON_STDOUT) _stdout_redir = ds;
+ if (mask & CON_STDERR) _stderr_redir = ds;
}
// Enabling output
void setOutputEnabled(uint32 mask) {
- std_output_enabled |= mask;
+ _stdOutputEnabled |= mask;
}
// Disabling output
void unsetOutputEnabled(uint32 mask) {
- std_output_enabled &= ~mask;
+ _stdOutputEnabled &= ~mask;
}
// Enabling output
uint32 getOutputEnabled() {
- return std_output_enabled;
+ return _stdOutputEnabled;
}
// sets what message types to ignore
void setMsgMask(const MsgMask mm) {
- msgMask = mm;
+ _msgMask = mm;
}
void setFrameNum(uint32 f) {
- framenum = f;
+ _frameNum = f;
}
//
@@ -240,10 +240,10 @@ public:
// Enable/Disable word wrapping
void EnableWordWrap() {
- wordwrap = true;
+ _wordWrap = true;
}
void DisableWordWrap() {
- wordwrap = false;
+ _wordWrap = false;
}
//
diff --git a/engines/ultima/ultima8/misc/errors.h b/engines/ultima/ultima8/misc/errors.h
index 11740e2..9c8476a 100644
--- a/engines/ultima/ultima8/misc/errors.h
+++ b/engines/ultima/ultima8/misc/errors.h
@@ -30,42 +30,42 @@ namespace Ultima8 {
// Base Error Code type
struct ECode {
- int32 error;
+ int32 _error;
- ECode() : error(0) { }
- ECode(int32 _e) : error(_e) { }
+ ECode() : _error(0) { }
+ ECode(int32 _e) : _error(_e) { }
bool failed() const {
- return error != 0;
+ return _error != 0;
}
bool succeded() const {
- return error == 0;
+ return _error == 0;
}
ECode &operator = (int32 &_e) {
- error = _e;
+ _error = _e;
return (*this);
}
ECode &operator = (ECode &_e) {
- error = _e.error;
+ _error = _e._error;
return (*this);
}
bool operator != (int32 &_e) {
- return error != _e;
+ return _error != _e;
}
friend bool operator != (int32 &_e, ECode &_e2) {
- return _e2.error != _e;
+ return _e2._error != _e;
}
bool operator == (int32 &_e) {
- return error == _e;
+ return _error == _e;
}
friend bool operator == (int32 &_e, ECode &_e2) {
- return _e2.error == _e;
+ return _e2._error == _e;
}
};
@@ -74,10 +74,10 @@ struct ECode {
// Helper Macros
//
-// Checks to see if a return code is an error
+// Checks to see if a return code is an _error
#define P_FAILED(e) ((e)!=0)
-// Checks to see if an error code indicates success
+// Checks to see if an _error code indicates success
#define P_SUCCEDED(e) ((e)==0)
diff --git a/engines/ultima/ultima8/misc/id_man.cpp b/engines/ultima/ultima8/misc/id_man.cpp
index 9050993..e328bdf 100644
--- a/engines/ultima/ultima8/misc/id_man.cpp
+++ b/engines/ultima/ultima8/misc/id_man.cpp
@@ -29,17 +29,17 @@
namespace Ultima {
namespace Ultima8 {
-idMan::idMan(uint16 Begin, uint16 MaxEnd, uint16 StartCount)
- : begin(Begin), max_end(MaxEnd), startcount(StartCount) {
+idMan::idMan(uint16 begin, uint16 maxEnd, uint16 startCount)
+ : _begin(begin), _maxEnd(maxEnd), _startCount(startCount) {
// 0 is always reserved, as is 65535
- if (begin == 0) begin = 1;
- if (max_end == 65535) max_end = 65534;
- if (startcount == 0) startcount = max_end - begin + 1;
+ if (_begin == 0) _begin = 1;
+ if (_maxEnd == 65535) _maxEnd = 65534;
+ if (_startCount == 0) _startCount = _maxEnd - _begin + 1;
- end = begin + startcount - 1;
- if (end > max_end) end = max_end;
+ _end = _begin + _startCount - 1;
+ if (_end > _maxEnd) _end = _maxEnd;
- ids.resize(end + 1);
+ _ids.resize(_end + 1);
clearAll();
}
@@ -49,115 +49,115 @@ idMan::~idMan() {
void idMan::clearAll(uint16 new_max) {
if (new_max)
- max_end = new_max;
+ _maxEnd = new_max;
- end = begin + startcount - 1;
- if (end > max_end) end = max_end;
- ids.resize(end + 1);
+ _end = _begin + _startCount - 1;
+ if (_end > _maxEnd) _end = _maxEnd;
+ _ids.resize(_end + 1);
- first = begin;
- last = end;
- usedcount = 0;
+ _first = _begin;
+ _last = _end;
+ _usedCount = 0;
uint16 i;
- for (i = 0; i < first; i++) ids[i] = 0; // NPCs always used
- for (; i < last; i++) ids[i] = i + 1; // Free IDs
- ids[last] = 0; // Terminates the list
+ for (i = 0; i < _first; i++) _ids[i] = 0; // NPCs always used
+ for (; i < _last; i++) _ids[i] = i + 1; // Free IDs
+ _ids[_last] = 0; // Terminates the list
}
uint16 idMan::getNewID() {
// more than 75% used and room to expand?
- if (usedcount * 4 > (end - begin + 1) * 3 && end < max_end) {
+ if (_usedCount * 4 > (_end - _begin + 1) * 3 && _end < _maxEnd) {
expand();
}
// Uh oh, what to do when there is none
- if (!first) {
- warning("Unable to allocate id (max = %d)", max_end);
+ if (!_first) {
+ warning("Unable to allocate id (max = %d)", _maxEnd);
return 0;
}
// Get the next id
- uint16 id = first;
+ uint16 id = _first;
- // Set the first in the list to next
- first = ids[id];
+ // Set the _first in the list to next
+ _first = _ids[id];
// Set us to used
- ids[id] = 0;
+ _ids[id] = 0;
- // If there is no first, there is no list, cause there's none left
- // So clear the last pointer
- if (!first) last = 0;
+ // If there is no _first, there is no list, cause there's none left
+ // So clear the _last pointer
+ if (!_first) _last = 0;
- usedcount++;
+ _usedCount++;
return id;
}
void idMan::expand() {
- if (end == max_end) return;
+ if (_end == _maxEnd) return;
- uint16 old_end = end;
- unsigned int new_end = end * 2;
- if (new_end > max_end) new_end = max_end;
- end = new_end;
- ids.resize(end + 1);
+ uint16 old_end = _end;
+ unsigned int new_end = _end * 2;
+ if (new_end > _maxEnd) new_end = _maxEnd;
+ _end = new_end;
+ _ids.resize(_end + 1);
#if 0
- perr << "Expanding idMan from (" << begin << "-" << old_end << ") to ("
- << begin << "-" << end << ")" << Std::endl;
+ perr << "Expanding idMan from (" << _begin << "-" << old_end << ") to ("
+ << _begin << "-" << _end << ")" << Std::endl;
#endif
// insert the new free IDs at the start
- for (uint16 i = old_end + 1; i < end; ++i) {
- ids[i] = i + 1;
+ for (uint16 i = old_end + 1; i < _end; ++i) {
+ _ids[i] = i + 1;
}
- ids[end] = first;
- first = old_end + 1;
+ _ids[_end] = _first;
+ _first = old_end + 1;
}
bool idMan::reserveID(uint16 id) {
- if (id < begin || id > max_end) {
+ if (id < _begin || id > _maxEnd) {
return false;
}
// expand until we're big enough to reserve this ID
- while (id > end) {
+ while (id > _end) {
expand();
}
if (isIDUsed(id))
return false; // already used
- usedcount++;
+ _usedCount++;
// more than 75% used and room to expand?
- if (usedcount * 4 > (end - begin + 1) * 3 && end < max_end) {
+ if (_usedCount * 4 > (_end - _begin + 1) * 3 && _end < _maxEnd) {
expand();
}
- if (id == first) {
- first = ids[id];
- ids[id] = 0;
- if (!first) last = 0;
+ if (id == _first) {
+ _first = _ids[id];
+ _ids[id] = 0;
+ if (!_first) _last = 0;
return true;
}
- uint16 node = ids[first];
- uint16 prev = first;
+ uint16 node = _ids[_first];
+ uint16 prev = _first;
while (node != id && node != 0) {
prev = node;
- node = ids[node];
+ node = _ids[node];
}
assert(node != 0); // list corrupt...
- ids[prev] = ids[node];
- ids[node] = 0;
- if (last == node)
- last = prev;
+ _ids[prev] = _ids[node];
+ _ids[node] = 0;
+ if (_last == node)
+ _last = prev;
return true;
}
@@ -165,52 +165,52 @@ void idMan::clearID(uint16 id) {
// Only clear IF it is used. We don't want to screw up the linked list
// if an id gets cleared twice
if (isIDUsed(id)) {
- // If there is a last, then set the last's next to us
- // or if there isn't a last, obviously no list exists,
- // so set the first to us
- if (last) ids[last] = id;
- else first = id;
+ // If there is a _last, then set the _last's next to us
+ // or if there isn't a _last, obviously no list exists,
+ // so set the _first to us
+ if (_last) _ids[_last] = id;
+ else _first = id;
- // Set the end to us
- last = id;
+ // Set the _end to us
+ _last = id;
// Set our next to terminate
- ids[id] = 0;
+ _ids[id] = 0;
- usedcount--;
+ _usedCount--;
}
// double-check we didn't break the list
- assert(!first || last);
+ assert(!_first || _last);
}
void idMan::save(ODataSource *ods) {
- ods->write2(begin);
- ods->write2(end);
- ods->write2(max_end);
- ods->write2(startcount);
- ods->write2(usedcount);
- uint16 cur = first;
+ ods->write2(_begin);
+ ods->write2(_end);
+ ods->write2(_maxEnd);
+ ods->write2(_startCount);
+ ods->write2(_usedCount);
+ uint16 cur = _first;
while (cur) {
ods->write2(cur);
- cur = ids[cur];
+ cur = _ids[cur];
}
ods->write2(0); // terminator
}
bool idMan::load(IDataSource *ds, uint32 version) {
- begin = ds->read2();
- end = ds->read2();
- max_end = ds->read2();
- startcount = ds->read2();
+ _begin = ds->read2();
+ _end = ds->read2();
+ _maxEnd = ds->read2();
+ _startCount = ds->read2();
uint16 realusedcount = ds->read2();
- ids.resize(end + 1);
+ _ids.resize(_end + 1);
- for (unsigned int i = 0; i <= end; ++i) {
- ids[i] = 0;
+ for (unsigned int i = 0; i <= _end; ++i) {
+ _ids[i] = 0;
}
- first = last = 0;
+ _first = _last = 0;
uint16 cur = ds->read2();
while (cur) {
@@ -218,7 +218,7 @@ bool idMan::load(IDataSource *ds, uint32 version) {
cur = ds->read2();
}
- usedcount = realusedcount;
+ _usedCount = realusedcount;
return true;
}
diff --git a/engines/ultima/ultima8/misc/id_man.h b/engines/ultima/ultima8/misc/id_man.h
index b943aca..80778d0 100644
--- a/engines/ultima/ultima8/misc/id_man.h
+++ b/engines/ultima/ultima8/misc/id_man.h
@@ -45,16 +45,16 @@ class ODataSource;
//
class idMan {
- uint16 begin; //!< start of the available range of IDs
- uint16 end; //!< current end of the range
- uint16 max_end; //!< end of the available range
- uint16 startcount; //!< number of IDs to make available initially
+ uint16 _begin; //!< start of the available range of IDs
+ uint16 _end; //!< current end of the range
+ uint16 _maxEnd; //!< end of the available range
+ uint16 _startCount; //!< number of IDs to make available initially
- uint16 usedcount; //!< number of IDs currently in use
+ uint16 _usedCount; //!< number of IDs currently in use
- Std::vector<uint16> ids; //!< the 'next' field in a list of free IDs
- uint16 first; //!< the first ID in the free list
- uint16 last; //!< the last ID in the last list
+ Std::vector<uint16> _ids; //!< the 'next' field in a list of free IDs
+ uint16 _first; //!< the first ID in the free list
+ uint16 _last; //!< the last ID in the last list
public:
//! \param begin start of the range of available IDs
//! \param max_end end of the range of available IDs
@@ -64,7 +64,7 @@ public:
//! check if this idMan is full
bool isFull() const {
- return first == 0 && end >= max_end;
+ return _first == 0 && _end >= _maxEnd;
}
//! clear all IDs, reset size to the startcount, and set max_end to new_max
@@ -84,7 +84,7 @@ public:
//! check if an ID is in use
bool isIDUsed(uint16 id) const {
- return id >= begin && id <= end && ids[id] == 0 && id != last;
+ return id >= _begin && id <= _end && _ids[id] == 0 && id != _last;
}
//! increase the maximum size
@@ -93,7 +93,7 @@ public:
//! to need more than 32768 object IDs, this function should be
//! deleted.
void setNewMax(uint16 maxEnd) {
- this->max_end = maxEnd;
+ _maxEnd = maxEnd;
}
void save(ODataSource *ods);
diff --git a/engines/ultima/ultima8/misc/p_dynamic_cast.h b/engines/ultima/ultima8/misc/p_dynamic_cast.h
index 5c4f806..bb3b393 100644
--- a/engines/ultima/ultima8/misc/p_dynamic_cast.h
+++ b/engines/ultima/ultima8/misc/p_dynamic_cast.h
@@ -32,7 +32,7 @@ template<class A, class B> inline A p_dynamic_cast(B *object) {
// This is just a 'type' used to differentiate each class.
struct RunTimeClassType {
- const char *class_name;
+ const char *_className;
inline bool operator == (const RunTimeClassType &other) const {
return this == &other;
}
@@ -74,7 +74,7 @@ struct RunTimeClassType {
\
bool Classname::IsOfType(const char *classType) \
{ \
- if (!Std::strcmp(classType,ClassType.class_name)) return true; \
+ if (!Std::strcmp(classType,ClassType._className)) return true; \
return false; \
}
@@ -95,7 +95,7 @@ struct RunTimeClassType {
\
bool Classname::IsOfType(const char *typeName) \
{ \
- if (!Std::strcmp(typeName,ClassType.class_name)) return true; \
+ if (!Std::strcmp(typeName,ClassType._className)) return true; \
return ParentClassname::IsOfType(typeName); \
}
@@ -123,7 +123,7 @@ struct RunTimeClassType {
{ \
typedef Parent1 P1; \
typedef Parent2 P2; \
- if (!Std::strcmp(type,ClassType.class_name)) return true; \
+ if (!Std::strcmp(type,ClassType._className)) return true; \
bool ret = P1::IsOfType(type); \
if (ret) return true; \
return P2::IsOfType(type); \
diff --git a/engines/ultima/ultima8/world/actors/loiter_process.cpp b/engines/ultima/ultima8/world/actors/loiter_process.cpp
index 577e6fc..fd0f61d 100644
--- a/engines/ultima/ultima8/world/actors/loiter_process.cpp
+++ b/engines/ultima/ultima8/world/actors/loiter_process.cpp
@@ -37,24 +37,23 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(LoiterProcess, Process)
LoiterProcess::LoiterProcess() : Process() {
-
}
-LoiterProcess::LoiterProcess(Actor *actor_, int32 c) {
- assert(actor_);
- _itemNum = actor_->getObjId();
- count = c;
+LoiterProcess::LoiterProcess(Actor *actor, int32 c) {
+ assert(actor);
+ _itemNum = actor->getObjId();
+ _count = c;
_type = 0x205; // CONSTANT!
}
void LoiterProcess::run() {
- if (!count) {
+ if (!_count) {
terminate();
return;
}
- if (count > 0)
- count--;
+ if (_count > 0)
+ _count--;
Actor *a = getActor(_itemNum);
@@ -108,16 +107,16 @@ void LoiterProcess::run() {
void LoiterProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write4(count);
+ ods->write4(_count);
}
bool LoiterProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
if (version >= 3)
- count = ids->read4();
+ _count = ids->read4();
else
- count = 0; // default to loitering indefinitely
+ _count = 0; // default to loitering indefinitely
return true;
}
diff --git a/engines/ultima/ultima8/world/actors/loiter_process.h b/engines/ultima/ultima8/world/actors/loiter_process.h
index 15156e1..caef240 100644
--- a/engines/ultima/ultima8/world/actors/loiter_process.h
+++ b/engines/ultima/ultima8/world/actors/loiter_process.h
@@ -44,7 +44,7 @@ public:
protected:
void saveData(ODataSource *ods) override;
- int32 count;
+ int32 _count;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index 3f676d5..f425565 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -86,7 +86,7 @@ Item::~Item() {
void Item::dumpInfo() {
pout << "Item " << getObjId() << " (class "
- << GetClassType().class_name << ", shape "
+ << GetClassType()._className << ", shape "
<< getShape() << ", " << getFrame() << ", (";
if (parent) {
Commit: d37b0bed2379fb4676f08821b940a68772c8ef3f
https://github.com/scummvm/scummvm/commit/d37b0bed2379fb4676f08821b940a68772c8ef3f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-15T21:39:28-08:00
Commit Message:
ULTIMA8: Renaming usecode folder class fields
Changed paths:
engines/ultima/ultima8/usecode/bit_set.cpp
engines/ultima/ultima8/usecode/bit_set.h
engines/ultima/ultima8/usecode/uc_list.cpp
engines/ultima/ultima8/usecode/uc_list.h
engines/ultima/ultima8/usecode/uc_machine.cpp
engines/ultima/ultima8/usecode/uc_machine.h
engines/ultima/ultima8/usecode/uc_process.cpp
engines/ultima/ultima8/usecode/uc_process.h
engines/ultima/ultima8/usecode/uc_stack.cpp
engines/ultima/ultima8/usecode/uc_stack.h
diff --git a/engines/ultima/ultima8/usecode/bit_set.cpp b/engines/ultima/ultima8/usecode/bit_set.cpp
index d3f99a2..28ccf3e 100644
--- a/engines/ultima/ultima8/usecode/bit_set.cpp
+++ b/engines/ultima/ultima8/usecode/bit_set.cpp
@@ -29,43 +29,42 @@
namespace Ultima {
namespace Ultima8 {
-BitSet::BitSet() : size(0), bytes(0), data(0) {
-
+BitSet::BitSet() : _size(0), _bytes(0), _data(0) {
}
-BitSet::BitSet(unsigned int size_) {
- data = 0;
- setSize(size_);
+BitSet::BitSet(unsigned int size) {
+ _data = 0;
+ setSize(size);
}
BitSet::~BitSet() {
- delete[] data;
+ delete[] _data;
}
-void BitSet::setSize(unsigned int size_) {
- if (data) delete[] data;
+void BitSet::setSize(unsigned int size) {
+ if (_data) delete[] _data;
- size = size_;
- bytes = 0;
- bytes = size / 8;
- if (size % 8 != 0) bytes++;
+ _size = size;
+ _bytes = 0;
+ _bytes = _size / 8;
+ if (_size % 8 != 0) _bytes++;
- data = new uint8[bytes];
- for (unsigned int i = 0; i < bytes; ++i)
- data[i] = 0;
+ _data = new uint8[_bytes];
+ for (unsigned int i = 0; i < _bytes; ++i)
+ _data[i] = 0;
}
uint32 BitSet::getBits(unsigned int pos, unsigned int n) {
assert(n <= 32);
- assert(pos + n <= size);
+ assert(pos + n <= _size);
if (n == 0) return 0;
unsigned int firstbyte = pos / 8;
unsigned int lastbyte = (pos + n - 1) / 8;
if (firstbyte == lastbyte) {
- return ((data[firstbyte] >> (pos % 8)) & ((1 << n) - 1));
+ return ((_data[firstbyte] >> (pos % 8)) & ((1 << n) - 1));
}
unsigned int firstbits = 8 - (pos % 8);
@@ -76,28 +75,28 @@ uint32 BitSet::getBits(unsigned int pos, unsigned int n) {
uint32 ret = 0;
- ret |= (data[firstbyte] & firstmask) >> (8 - firstbits);
+ ret |= (_data[firstbyte] & firstmask) >> (8 - firstbits);
unsigned int shift = firstbits;
for (unsigned int i = firstbyte + 1; i < lastbyte; ++i) {
- ret |= (data[i] << shift);
+ ret |= (_data[i] << shift);
shift += 8;
}
- ret |= (data[lastbyte] & lastmask) << shift;
+ ret |= (_data[lastbyte] & lastmask) << shift;
return ret;
}
void BitSet::setBits(unsigned int pos, unsigned int n, uint32 bits) {
assert(n <= 32);
- assert(pos + n <= size);
+ assert(pos + n <= _size);
if (n == 0) return;
unsigned int firstbyte = pos / 8;
unsigned int lastbyte = (pos + n - 1) / 8;
if (firstbyte == lastbyte) {
- data[firstbyte] &= ~(((1 << n) - 1) << (pos % 8));
- data[firstbyte] |= (bits & ((1 << n) - 1)) << (pos % 8);
+ _data[firstbyte] &= ~(((1 << n) - 1) << (pos % 8));
+ _data[firstbyte] |= (bits & ((1 << n) - 1)) << (pos % 8);
return;
}
@@ -107,26 +106,26 @@ void BitSet::setBits(unsigned int pos, unsigned int n, uint32 bits) {
unsigned int firstmask = ((1 << firstbits) - 1) << (8 - firstbits);
unsigned int lastmask = ((1 << lastbits) - 1);
- data[firstbyte] &= ~firstmask;
- data[firstbyte] |= (bits << (8 - firstbits)) & firstmask;
+ _data[firstbyte] &= ~firstmask;
+ _data[firstbyte] |= (bits << (8 - firstbits)) & firstmask;
unsigned int shift = firstbits;
for (unsigned int i = firstbyte + 1; i < lastbyte; ++i) {
- data[i] = (bits >> shift);
+ _data[i] = (bits >> shift);
shift += 8;
}
- data[lastbyte] &= ~lastmask;
- data[lastbyte] |= (bits >> shift) & lastmask;
+ _data[lastbyte] &= ~lastmask;
+ _data[lastbyte] |= (bits >> shift) & lastmask;
}
void BitSet::save(ODataSource *ods) {
- ods->write4(size);
- ods->write(data, bytes);
+ ods->write4(_size);
+ ods->write(_data, _bytes);
}
bool BitSet::load(IDataSource *ids, uint32 version) {
uint32 s = ids->read4();
setSize(s);
- ids->read(data, bytes);
+ ids->read(_data, _bytes);
return true;
}
diff --git a/engines/ultima/ultima8/usecode/bit_set.h b/engines/ultima/ultima8/usecode/bit_set.h
index 4a3e35a..a0e97e5 100644
--- a/engines/ultima/ultima8/usecode/bit_set.h
+++ b/engines/ultima/ultima8/usecode/bit_set.h
@@ -55,9 +55,9 @@ public:
bool load(IDataSource *ids, uint32 version);
private:
- unsigned int size;
- unsigned int bytes;
- uint8 *data;
+ unsigned int _size;
+ unsigned int _bytes;
+ uint8 *_data;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/usecode/uc_list.cpp b/engines/ultima/ultima8/usecode/uc_list.cpp
index 7fcaf6a..5b2346a 100644
--- a/engines/ultima/ultima8/usecode/uc_list.cpp
+++ b/engines/ultima/ultima8/usecode/uc_list.cpp
@@ -31,7 +31,7 @@ namespace Ultima {
namespace Ultima8 {
uint16 UCList::getStringIndex(uint32 index) {
- return elements[index * 2] + (elements[index * 2 + 1] << 8);
+ return _elements[index * 2] + (_elements[index * 2 + 1] << 8);
}
Std::string &UCList::getString(uint32 index) {
@@ -41,7 +41,7 @@ Std::string &UCList::getString(uint32 index) {
void UCList::freeStrings() {
UCMachine *ucm = UCMachine::get_instance();
- for (unsigned int i = 0; i < size; i++) {
+ for (unsigned int i = 0; i < _size; i++) {
ucm->freeString(getStringIndex(i));
}
free();
@@ -50,7 +50,7 @@ void UCList::freeStrings() {
void UCList::copyStringList(UCList &l) {
UCMachine *ucm = UCMachine::get_instance();
freeStrings();
- for (unsigned int i = 0; i < l.size; i++) {
+ for (unsigned int i = 0; i < l._size; i++) {
uint16 s = ucm->duplicateString(l.getStringIndex(i));
uint8 tmp[2]; // ugly...
tmp[0] = static_cast<uint8>(s & 0xFF);
@@ -63,7 +63,7 @@ void UCList::unionStringList(UCList &l) {
UCMachine *ucm = UCMachine::get_instance();
// take the union of two stringlists
// i.e., append the second to this one, removing any duplicates
- for (unsigned int i = 0; i < l.size; i++) {
+ for (unsigned int i = 0; i < l._size; i++) {
if (!stringInList(l.getStringIndex(i))) {
append(l[i]);
} else {
@@ -75,13 +75,13 @@ void UCList::unionStringList(UCList &l) {
}
void UCList::substractStringList(UCList &l) {
- for (unsigned int i = 0; i < l.size; i++)
+ for (unsigned int i = 0; i < l._size; i++)
removeString(l.getStringIndex(i));
}
bool UCList::stringInList(uint16 s) {
Std::string str = UCMachine::get_instance()->getString(s);
- for (unsigned int i = 0; i < size; i++)
+ for (unsigned int i = 0; i < _size; i++)
if (getString(i) == str)
return true;
@@ -93,41 +93,41 @@ void UCList::assignString(uint32 index, uint16 str) {
// free old contents of element index; take ownership of str(?)
UCMachine::get_instance()->freeString(getStringIndex(index));
- elements[index * elementsize] = static_cast<uint8>(str & 0xFF);
- elements[index * elementsize + 1] = static_cast<uint8>(str >> 8);
+ _elements[index * _elementSize] = static_cast<uint8>(str & 0xFF);
+ _elements[index * _elementSize + 1] = static_cast<uint8>(str >> 8);
}
void UCList::removeString(uint16 s, bool nodel) {
// do we need to erase all occurences of str or just the first one?
// (deleting all, currently)
Std::string str = UCMachine::get_instance()->getString(s);
- for (unsigned int i = 0; i < size; i++) {
+ for (unsigned int i = 0; i < _size; i++) {
if (getString(i) == str) {
// free string
if (!nodel)
UCMachine::get_instance()->freeString(getStringIndex(i));
// remove string from list
- elements.erase(elements.begin() + i * elementsize,
- elements.begin() + (i + 1)*elementsize);
- size--;
+ _elements.erase(_elements.begin() + i * _elementSize,
+ _elements.begin() + (i + 1)*_elementSize);
+ _size--;
i--; // back up a bit
}
}
}
void UCList::save(ODataSource *ods) {
- ods->write4(elementsize);
- ods->write4(size);
- ods->write(&(elements[0]), size * elementsize);
+ ods->write4(_elementSize);
+ ods->write4(_size);
+ ods->write(&(_elements[0]), _size * _elementSize);
}
bool UCList::load(IDataSource *ids, uint32 version) {
- elementsize = ids->read4();
- size = ids->read4();
- elements.resize(size * elementsize);
- ids->read(&(elements[0]), size * elementsize);
+ _elementSize = ids->read4();
+ _size = ids->read4();
+ _elements.resize(_size * _elementSize);
+ ids->read(&(_elements[0]), _size * _elementSize);
return true;
}
diff --git a/engines/ultima/ultima8/usecode/uc_list.h b/engines/ultima/ultima8/usecode/uc_list.h
index d720d3e..e517653 100644
--- a/engines/ultima/ultima8/usecode/uc_list.h
+++ b/engines/ultima/ultima8/usecode/uc_list.h
@@ -32,7 +32,7 @@ namespace Ultima8 {
class IDataSource;
class ODataSource;
-// stringlists: elementsize = 2, each element is actually a stringref
+// stringlists: _elementSize = 2, each element is actually a stringref
// see for example the 0x0E opcode: there is no way to see if the
// created list is a stringlist or not
// the opcodes which do need a distinction have a operand for this.
@@ -43,15 +43,15 @@ class ODataSource;
// Question: does substractList remove _all_ occurences of elements or only 1?
class UCList {
- Std::vector<uint8> elements;
- unsigned int elementsize;
- unsigned int size;
+ Std::vector<uint8> _elements;
+ unsigned int _elementSize;
+ unsigned int _size;
public:
- UCList(unsigned int elementsize_, unsigned int capacity = 0) :
- elementsize(elementsize_), size(0) {
+ UCList(unsigned int elementSize, unsigned int capacity = 0) :
+ _elementSize(elementSize), _size(0) {
if (capacity > 0)
- elements.reserve(elementsize * capacity);
+ _elements.reserve(_elementSize * capacity);
}
~UCList() {
@@ -63,44 +63,44 @@ public:
const uint8 *operator[](uint32 index) {
// check that index isn't out of bounds...
- return &(elements[index * elementsize]);
+ return &(_elements[index * _elementSize]);
}
uint16 getuint16(uint32 index) {
- assert(elementsize == 2);
- uint16 t = elements[index * elementsize];
- t += elements[index * elementsize + 1] << 8;
+ assert(_elementSize == 2);
+ uint16 t = _elements[index * _elementSize];
+ t += _elements[index * _elementSize + 1] << 8;
return t;
}
void append(const uint8 *e) {
- elements.resize((size + 1) * elementsize);
- for (unsigned int i = 0; i < elementsize; i++)
- elements[size * elementsize + i] = e[i];
- size++;
+ _elements.resize((_size + 1) * _elementSize);
+ for (unsigned int i = 0; i < _elementSize; i++)
+ _elements[_size * _elementSize + i] = e[i];
+ _size++;
}
void remove(const uint8 *e) {
// do we need to erase all occurences of e or just the first one?
// (deleting all, currently)
- for (unsigned int i = 0; i < size; i++) {
+ for (unsigned int i = 0; i < _size; i++) {
bool equal = true;
- for (unsigned int j = 0; j < elementsize && equal; j++)
- equal = (elements[i * elementsize + j] == e[j]);
+ for (unsigned int j = 0; j < _elementSize && equal; j++)
+ equal = (_elements[i * _elementSize + j] == e[j]);
if (!equal) {
- elements.erase(elements.begin() + i * elementsize,
- elements.begin() + (i + 1)*elementsize);
- size--;
+ _elements.erase(_elements.begin() + i * _elementSize,
+ _elements.begin() + (i + 1)*_elementSize);
+ _size--;
i--; // back up a bit
}
}
}
bool inList(const uint8 *e) {
- for (unsigned int i = 0; i < size; i++) {
+ for (unsigned int i = 0; i < _size; i++) {
bool equal = true;
- for (unsigned int j = 0; j < elementsize && equal; j++)
- equal = (elements[i * elementsize + j] == e[j]);
+ for (unsigned int j = 0; j < _elementSize && equal; j++)
+ equal = (_elements[i * _elementSize + j] == e[j]);
if (equal)
return true;
}
@@ -109,38 +109,38 @@ public:
void appendList(UCList &l) {
// need to check if elementsizes match...
- elements.reserve(elementsize * (size + l.size));
- unsigned int lsize = l.size;
+ _elements.reserve(_elementSize * (_size + l._size));
+ unsigned int lsize = l._size;
for (unsigned int i = 0; i < lsize; i++)
append(l[i]);
}
void unionList(UCList &l) { // like append, but remove duplicates
// need to check if elementsizes match...
- elements.reserve(elementsize * (size + l.size));
- for (unsigned int i = 0; i < l.size; i++)
+ _elements.reserve(_elementSize * (_size + l._size));
+ for (unsigned int i = 0; i < l._size; i++)
if (!inList(l[i]))
append(l[i]);
}
void substractList(UCList &l) {
- for (unsigned int i = 0; i < l.size; i++)
+ for (unsigned int i = 0; i < l._size; i++)
remove(l[i]);
}
void free() {
- elements.clear();
- size = 0;
+ _elements.clear();
+ _size = 0;
}
uint32 getSize() const {
- return size;
+ return _size;
}
unsigned int getElementSize() const {
- return elementsize;
+ return _elementSize;
}
void assign(uint32 index, const uint8 *e) {
// need to check that index isn't out-of-bounds? (or grow list?)
- for (unsigned int i = 0; i < elementsize; i++)
- elements[index * elementsize + i] = e[i];
+ for (unsigned int i = 0; i < _elementSize; i++)
+ _elements[index * _elementSize + i] = e[i];
}
void copyList(UCList &l) { // deep copy for list
diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index 3e42cb0..4943451 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -80,21 +80,21 @@ enum UCSegments {
SEG_GLOBAL = 0x8003
};
-UCMachine *UCMachine::ucmachine = 0;
+UCMachine *UCMachine::_ucMachine = 0;
UCMachine::UCMachine(Intrinsic *iset, unsigned int icount) {
con->Print(MM_INFO, "Creating UCMachine...\n");
- ucmachine = this;
+ _ucMachine = this;
- // zero globals
- globals = new BitSet(0x1000);
+ // zero _globals
+ _globals = new BitSet(0x1000);
- convuse = new ConvertUsecodeU8; //!...
+ _convUse = new ConvertUsecodeU8; //!...
loadIntrinsics(iset, icount); //!...
- listIDs = new idMan(1, 65534, 128);
- stringIDs = new idMan(1, 65534, 256);
+ _listIDs = new idMan(1, 65534, 128);
+ _stringIDs = new idMan(1, 65534, 256);
con->AddConsoleCommand("UCMachine::getGlobal", ConCmd_getGlobal);
con->AddConsoleCommand("UCMachine::setGlobal", ConCmd_setGlobal);
@@ -125,50 +125,50 @@ UCMachine::~UCMachine() {
con->RemoveConsoleCommand(UCMachine::ConCmd_stopTrace);
#endif
- ucmachine = 0;
+ _ucMachine = 0;
- delete globals;
- globals = 0;
- delete convuse;
- convuse = 0;
- delete listIDs;
- listIDs = 0;
- delete stringIDs;
- stringIDs = 0;
+ delete _globals;
+ _globals = 0;
+ delete _convUse;
+ _convUse = 0;
+ delete _listIDs;
+ _listIDs = 0;
+ delete _stringIDs;
+ _stringIDs = 0;
}
void UCMachine::reset() {
con->Print(MM_INFO, "Resetting UCMachine\n");
- // clear globals
- globals->setSize(0x1000);
+ // clear _globals
+ _globals->setSize(0x1000);
// clear strings, lists
Std::map<uint16, UCList *>::iterator iter;
- for (iter = listHeap.begin(); iter != listHeap.end(); ++iter)
+ for (iter = _listHeap.begin(); iter != _listHeap.end(); ++iter)
delete(iter->_value);
- listHeap.clear();
- stringHeap.clear();
+ _listHeap.clear();
+ _stringHeap.clear();
}
void UCMachine::loadIntrinsics(Intrinsic *i, unsigned int icount) {
- intrinsics = i;
- intrinsiccount = icount;
+ _intrinsics = i;
+ _intrinsicCount = icount;
}
void UCMachine::execProcess(UCProcess *p) {
assert(p);
- uint32 base = p->usecode->get_class_base_offset(p->classid);
- IBufferDataSource cs(p->usecode->get_class(p->classid) + base,
- p->usecode->get_class_size(p->classid) - base);
- cs.seek(p->ip);
+ uint32 base = p->_usecode->get_class_base_offset(p->_classId);
+ IBufferDataSource cs(p->_usecode->get_class(p->_classId) + base,
+ p->_usecode->get_class_size(p->_classId) - base);
+ cs.seek(p->_ip);
#ifdef DEBUG
- if (trace_show(p->_pid, p->_itemNum, p->classid)) {
+ if (trace_show(p->_pid, p->_itemNum, p->_classId)) {
pout << Std::hex << "running process " << p->_pid
<< ", item " << p->_itemNum << ", type " << p->type
- << ", class " << p->classid << ", offset " << p->ip
+ << ", class " << p->_classId << ", offset " << p->_ip
<< Std::dec << Std::endl;
}
#endif
@@ -183,13 +183,13 @@ void UCMachine::execProcess(UCProcess *p) {
uint8 opcode = cs.read1();
#ifdef DEBUG
- uint16 trace_classid = p->classid;
+ uint16 trace_classid = p->_classId;
ObjId trace_objid = p->_itemNum;
ProcId trace_pid = p->_pid;
#endif
LOGPF(("sp = %02X; %04X:%04X: %02X\t",
- p->stack.stacksize(), p->classid, p->ip, opcode));
+ p->_stack.stacksize(), p->_classId, p->_ip, opcode));
int8 si8a, si8b;
uint8 ui8a;
@@ -205,8 +205,8 @@ void UCMachine::execProcess(UCProcess *p) {
// 00 xx
// pop 16 bit int, and assign LS 8 bit int into bp+xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.pop2();
- p->stack.assign1(p->bp + si8a, static_cast<uint8>(ui16a));
+ ui16a = p->_stack.pop2();
+ p->_stack.assign1(p->_bp + si8a, static_cast<uint8>(ui16a));
LOGPF(("pop byte\t%s = %02Xh\n", print_bp(si8a), ui16a));
break;
@@ -214,8 +214,8 @@ void UCMachine::execProcess(UCProcess *p) {
// 01 xx
// pop 16 bit int into bp+xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.pop2();
- p->stack.assign2(p->bp + si8a, ui16a);
+ ui16a = p->_stack.pop2();
+ p->_stack.assign2(p->_bp + si8a, ui16a);
LOGPF(("pop\t\t%s = %04Xh\n", print_bp(si8a), ui16a));
break;
@@ -223,8 +223,8 @@ void UCMachine::execProcess(UCProcess *p) {
// 02 xx
// pop 32 bit int into bp+xx
si8a = static_cast<int8>(cs.read1());
- ui32a = p->stack.pop4();
- p->stack.assign4(p->bp + si8a, ui32a);
+ ui32a = p->_stack.pop4();
+ p->_stack.assign4(p->_bp + si8a, ui32a);
LOGPF(("pop dword\t%s = %08Xh\n", print_bp(si8a), ui32a));
break;
@@ -235,8 +235,8 @@ void UCMachine::execProcess(UCProcess *p) {
si8a = static_cast<int8>(cs.read1());
uint8 size = cs.read1();
uint8 buf[256];
- p->stack.pop(buf, size);
- p->stack.assign(p->bp + si8a, buf, size);
+ p->_stack.pop(buf, size);
+ p->_stack.assign(p->_bp + si8a, buf, size);
LOGPF(("pop huge\t%s %i\n", print_bp(si8a), size));
}
break;
@@ -248,7 +248,7 @@ void UCMachine::execProcess(UCProcess *p) {
//! probably a member of the Process?
//! is the result in 0x08 and 0x6D the same var?
LOGPF(("pop dword\tprocess result\n"));
- p->_result = p->stack.pop4();
+ p->_result = p->_stack.pop4();
break;
case 0x09:
@@ -260,8 +260,8 @@ void UCMachine::execProcess(UCProcess *p) {
si8b = static_cast<int8>(cs.read1());
LOGPF(("assign element\t%s (%02X) (slist==%02X)\n",
print_bp(si8a), ui32a, si8b));
- ui16a = p->stack.pop2() - 1; // index
- ui16b = p->stack.access2(p->bp + si8a);
+ ui16a = p->_stack.pop2() - 1; // index
+ ui16b = p->_stack.access2(p->_bp + si8a);
UCList *l = getList(ui16b);
if (!l) {
perr << "assign element to an invalid list (" << ui16b << ")"
@@ -277,11 +277,11 @@ void UCMachine::execProcess(UCProcess *p) {
<< Std::endl;
error = true; // um?
}
- l->assign(ui16a, p->stack.access());
- p->stack.pop2(); // advance SP
+ l->assign(ui16a, p->_stack.access());
+ p->_stack.pop2(); // advance SP
} else {
- l->assign(ui16a, p->stack.access());
- p->stack.addSP(ui32a);
+ l->assign(ui16a, p->_stack.access());
+ p->_stack.addSP(ui32a);
}
}
break;
@@ -292,7 +292,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 0A xx
// push sign-extended 8 bit xx onto the stack as 16 bit
ui16a = static_cast<int8>(cs.read1());
- p->stack.push2(ui16a);
+ p->_stack.push2(ui16a);
LOGPF(("push byte\t%04Xh\n", ui16a));
break;
@@ -300,7 +300,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 0B xx xx
// push 16 bit xxxx onto the stack
ui16a = cs.read2();
- p->stack.push2(ui16a);
+ p->_stack.push2(ui16a);
LOGPF(("push\t\t%04Xh\n", ui16a));
break;
@@ -308,7 +308,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 0C xx xx xx xx
// push 32 bit xxxxxxxx onto the stack
ui32a = cs.read4();
- p->stack.push4(ui32a);
+ p->_stack.push4(ui32a);
LOGPF(("push dword\t%08Xh\n", ui32a));
break;
@@ -324,7 +324,7 @@ void UCMachine::execProcess(UCProcess *p) {
// REALLY MAJOR HACK:
// see docs/u8bugs.txt and
// http://sourceforge.net/tracker/index.php?func=detail&aid=2025145&group_id=53819&atid=471706
- if (GAME_IS_U8 && p->classid == 0x7C) {
+ if (GAME_IS_U8 && p->_classId == 0x7C) {
if (!strcmp(str, " Irgendetwas stimmt nicht!")) {
str[25] = '.'; // ! to .
}
@@ -338,7 +338,7 @@ void UCMachine::execProcess(UCProcess *p) {
<< Std::endl;
error = true;
}
- p->stack.push2(assignString(str));
+ p->_stack.push2(assignString(str));
delete[] str;
}
break;
@@ -351,13 +351,13 @@ void UCMachine::execProcess(UCProcess *p) {
ui16a = cs.read1();
ui16b = cs.read1();
UCList *l = new UCList(ui16a, ui16b);
- p->stack.addSP(ui16a * (ui16b - 1));
+ p->_stack.addSP(ui16a * (ui16b - 1));
for (unsigned int i = 0; i < ui16b; i++) {
- l->append(p->stack.access());
- p->stack.addSP(-ui16a);
+ l->append(p->_stack.access());
+ p->_stack.addSP(-ui16a);
}
- p->stack.addSP(ui16a * (ui16b + 1));
- p->stack.push2(assignList(l));
+ p->_stack.addSP(ui16a * (ui16b + 1));
+ p->_stack.push2(assignList(l));
LOGPF(("create list\t%02X (%02X)\n", ui16b, ui16a));
}
break;
@@ -374,23 +374,23 @@ void UCMachine::execProcess(UCProcess *p) {
//! TODO
uint16 arg_bytes = cs.read1();
uint16 func = cs.read2();
- LOGPF(("calli\t\t%04Xh (%02Xh arg bytes) %s \n", func, arg_bytes, convuse->intrinsics()[func]));
+ LOGPF(("calli\t\t%04Xh (%02Xh arg bytes) %s \n", func, arg_bytes, _convUse->_intrinsics()[func]));
// !constants
- if (func >= intrinsiccount || intrinsics[func] == 0) {
- p->temp32 = 0;
- perr << "Unhandled intrinsic \'" << convuse->intrinsics()[func] << "\' (" << Std::hex << func << Std::dec << ") called" << Std::endl;
+ if (func >= _intrinsicCount || _intrinsics[func] == 0) {
+ p->_temp32 = 0;
+ perr << "Unhandled intrinsic \'" << _convUse->intrinsics()[func] << "\' (" << Std::hex << func << Std::dec << ") called" << Std::endl;
} else {
//!! hackish
- if (intrinsics[func] == UCMachine::I_dummyProcess ||
- intrinsics[func] == UCMachine::I_true) {
-// perr << "Unhandled intrinsic \'" << convuse->intrinsics()[func] << "\' (" << Std::hex << func << Std::dec << ") called" << Std::endl;
+ if (_intrinsics[func] == UCMachine::I_dummyProcess ||
+ _intrinsics[func] == UCMachine::I_true) {
+// perr << "Unhandled intrinsic \'" << _convUse->_intrinsics()[func] << "\' (" << Std::hex << func << Std::dec << ") called" << Std::endl;
}
uint8 *argbuf = new uint8[arg_bytes];
- p->stack.pop(argbuf, arg_bytes);
- p->stack.addSP(-arg_bytes); // don't really pop the args
+ p->_stack.pop(argbuf, arg_bytes);
+ p->_stack.addSP(-arg_bytes); // don't really pop the args
- p->temp32 = intrinsics[func](argbuf, arg_bytes);
+ p->_temp32 = _intrinsics[func](argbuf, arg_bytes);
delete[] argbuf;
}
@@ -400,9 +400,9 @@ void UCMachine::execProcess(UCProcess *p) {
// REALLY MAJOR HACK:
// see docs/u8bugs.txt and
// https://sourceforge.net/tracker/index.php?func=detail&aid=1018748&group_id=53819&atid=471709
- if (GAME_IS_U8 && p->classid == 0x48B && func == 0xD0) {
+ if (GAME_IS_U8 && p->_classId == 0x48B && func == 0xD0) {
// 0xD0 = setAvatarInStasis
- globals->setBits(0, 1, 1);
+ _globals->setBits(0, 1, 1);
}
}
@@ -420,18 +420,18 @@ void UCMachine::execProcess(UCProcess *p) {
uint16 new_offset = cs.read2();
LOGPF(("call\t\t%04X:%04X\n", new_classid, new_offset));
if (GAME_IS_CRUSADER) {
- new_offset = p->usecode->get_class_event(new_classid,
+ new_offset = p->_usecode->get_class_event(new_classid,
new_offset);
}
- p->ip = static_cast<uint16>(cs.getPos()); // Truncates!!
+ p->_ip = static_cast<uint16>(cs.getPos()); // Truncates!!
p->call(new_classid, new_offset);
// Update the code segment
- uint32 base_ = p->usecode->get_class_base_offset(p->classid);
- cs.load(p->usecode->get_class(p->classid) + base_,
- p->usecode->get_class_size(p->classid) - base_);
- cs.seek(p->ip);
+ uint32 base_ = p->_usecode->get_class_base_offset(p->_classId);
+ cs.load(p->_usecode->get_class(p->_classId) + base_,
+ p->_usecode->get_class_size(p->_classId) - base_);
+ cs.seek(p->_ip);
// Resume execution
}
@@ -440,16 +440,16 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x12:
// 12
// pop 16bits into temp register
- p->temp32 = p->stack.pop2();
- LOGPF(("pop\t\ttemp = %04X\n", (p->temp32 & 0xFFFF)));
+ p->_temp32 = p->_stack.pop2();
+ LOGPF(("pop\t\ttemp = %04X\n", (p->_temp32 & 0xFFFF)));
break;
case 0x13:
// 13
// pop 32bits into temp register
// NB: 0x13 isn't used AFAIK, but this is a 'logical' guess
- p->temp32 = p->stack.pop4();
- LOGPF(("pop long\t\ttemp = %08X\n", p->temp32));
+ p->_temp32 = p->_stack.pop4();
+ LOGPF(("pop long\t\ttemp = %08X\n", p->_temp32));
break;
// Arithmetic
@@ -457,18 +457,18 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x14:
// 14
// 16 bit add
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
- p->stack.push2(static_cast<uint16>(si16a + si16b));
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
+ p->_stack.push2(static_cast<uint16>(si16a + si16b));
LOGPF(("add\n"));
break;
case 0x15:
// 15
// 32 bit add
- si32a = static_cast<int32>(p->stack.pop4());
- si32b = static_cast<int32>(p->stack.pop4());
- p->stack.push4(static_cast<uint32>(si32a + si32b));
+ si32a = static_cast<int32>(p->_stack.pop4());
+ si32b = static_cast<int32>(p->_stack.pop4());
+ p->_stack.push4(static_cast<uint32>(si32a + si32b));
LOGPF(("add long\n"));
break;
@@ -477,17 +477,17 @@ void UCMachine::execProcess(UCProcess *p) {
// 16
// pop two strings from the stack and push the concatenation
// (free the originals? order?)
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
if (ui16b == 0) {
perr << "Trying to append to string 0." << Std::endl;
error = true;
break;
}
- stringHeap[ui16b] += getString(ui16a);
+ _stringHeap[ui16b] += getString(ui16a);
freeString(ui16a);
- p->stack.push2(ui16b);
- LOGPF(("concat\t\t= %s\n", stringHeap[ui16b].c_str()));
+ p->_stack.push2(ui16b);
+ LOGPF(("concat\t\t= %s\n", _stringHeap[ui16b].c_str()));
break;
case 0x17:
@@ -495,8 +495,8 @@ void UCMachine::execProcess(UCProcess *p) {
// pop two lists from the stack and push the 'sum' of the lists
// (freeing the originals)
{
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
UCList *listA = getList(ui16a);
UCList *listB = getList(ui16b);
@@ -512,18 +512,18 @@ void UCMachine::execProcess(UCProcess *p) {
// CHECKME: do we allow appending a list to itself?
assert(ui16a != ui16b);
freeList(ui16a);
- p->stack.push2(ui16b);
+ p->_stack.push2(ui16b);
} else {
// at least one of the lists didn't exist. Error or not?
// for now: if one exists, push that one.
// if neither exists, push 0.
if (listA) {
- p->stack.push2(ui16a);
+ p->_stack.push2(ui16a);
} else if (listB) {
- p->stack.push2(ui16b);
+ p->_stack.push2(ui16b);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
}
LOGPF(("append\n"));
@@ -539,11 +539,11 @@ void UCMachine::execProcess(UCProcess *p) {
<< Std::endl;
error = true;
}
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
getList(ui16b)->unionStringList(*getList(ui16a));
freeStringList(ui16a); // contents are actually freed in unionSL
- p->stack.push2(ui16b);
+ p->_stack.push2(ui16b);
LOGPF(("union slist\t(%02X)\n", ui32a));
break;
@@ -554,11 +554,11 @@ void UCMachine::execProcess(UCProcess *p) {
// (or rather, it seems it takes one after all? -wjp,20030511)
ui32a = cs.read1(); // elementsize
ui32a = 2;
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
getList(ui16b)->substractStringList(*getList(ui16a));
freeStringList(ui16a);
- p->stack.push2(ui16b);
+ p->_stack.push2(ui16b);
LOGPF(("remove slist\t(%02X)\n", ui32a));
break;
@@ -568,60 +568,60 @@ void UCMachine::execProcess(UCProcess *p) {
// (free the originals? order?)
// only occurs in crusader.
ui32a = cs.read1(); // elementsize
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
getList(ui16b)->substractList(*getList(ui16a));
freeList(ui16a);
- p->stack.push2(ui16b);
+ p->_stack.push2(ui16b);
LOGPF(("remove list\t(%02X)\n", ui32a));
break;
case 0x1C:
// 1C
// subtract two 16 bit integers
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
- p->stack.push2(static_cast<uint16>(si16b - si16a)); // !! order?
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
+ p->_stack.push2(static_cast<uint16>(si16b - si16a)); // !! order?
LOGPF(("sub\n"));
break;
case 0x1D:
// 1D
// subtract two 32 bit integers
- si32a = static_cast<int16>(p->stack.pop4());
- si32b = static_cast<int16>(p->stack.pop4());
- p->stack.push4(static_cast<uint32>(si32b - si32a)); // !! order?
+ si32a = static_cast<int16>(p->_stack.pop4());
+ si32b = static_cast<int16>(p->_stack.pop4());
+ p->_stack.push4(static_cast<uint32>(si32b - si32a)); // !! order?
LOGPF(("sub long\n"));
break;
case 0x1E:
// 1E
// multiply two 16 bit integers
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
- p->stack.push2(static_cast<uint16>(si16a * si16b));
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
+ p->_stack.push2(static_cast<uint16>(si16a * si16b));
LOGPF(("mul\n"));
break;
case 0x1F:
// 1F
// multiply two 32 bit integers
- si32a = static_cast<int16>(p->stack.pop4());
- si32b = static_cast<int16>(p->stack.pop4());
- p->stack.push4(static_cast<uint32>(si32a * si32b));
+ si32a = static_cast<int16>(p->_stack.pop4());
+ si32b = static_cast<int16>(p->_stack.pop4());
+ p->_stack.push4(static_cast<uint32>(si32a * si32b));
LOGPF(("mul long\n"));
break;
case 0x20:
// 20
// divide two 16 bit integers (order?)
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16a != 0) {
- p->stack.push2(static_cast<uint16>(si16b / si16a));
+ p->_stack.push2(static_cast<uint16>(si16b / si16a));
} else {
perr.Print("division by zero.\n");
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("div\n"));
break;
@@ -629,13 +629,13 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x21:
// 21
// divide two 32 bit integers (order?)
- si32a = static_cast<int16>(p->stack.pop4());
- si32b = static_cast<int16>(p->stack.pop4());
+ si32a = static_cast<int16>(p->_stack.pop4());
+ si32b = static_cast<int16>(p->_stack.pop4());
if (si32a != 0) {
- p->stack.push4(static_cast<uint32>(si32b / si32a));
+ p->_stack.push4(static_cast<uint32>(si32b / si32a));
} else {
perr.Print("division by zero.\n");
- p->stack.push4(0);
+ p->_stack.push4(0);
}
LOGPF(("div\n"));
break;
@@ -645,13 +645,13 @@ void UCMachine::execProcess(UCProcess *p) {
// 16 bit mod (order?)
// is this a C-style %?
// or return values between 0 and si16a-1 ?
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16a != 0) {
- p->stack.push2(static_cast<uint16>(si16b % si16a));
+ p->_stack.push2(static_cast<uint16>(si16b % si16a));
} else {
perr.Print("division by zero.\n");
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("mod\n"));
break;
@@ -660,13 +660,13 @@ void UCMachine::execProcess(UCProcess *p) {
// 23
// 32 bit mod (order)?
// also see 0x22
- si32a = static_cast<int16>(p->stack.pop4());
- si32b = static_cast<int16>(p->stack.pop4());
+ si32a = static_cast<int16>(p->_stack.pop4());
+ si32b = static_cast<int16>(p->_stack.pop4());
if (si32a != 0) {
- p->stack.push4(static_cast<uint32>(si32b % si32a));
+ p->_stack.push4(static_cast<uint32>(si32b % si32a));
} else {
perr.Print("division by zero.\n");
- p->stack.push4(0);
+ p->_stack.push4(0);
}
LOGPF(("mod long\n"));
break;
@@ -674,12 +674,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x24:
// 24
// 16 bit cmp
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16a == si16b) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("cmp\n"));
break;
@@ -687,12 +687,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x25:
// 25
// 32 bit cmp
- si32a = static_cast<int32>(p->stack.pop4());
- si32b = static_cast<int32>(p->stack.pop4());
+ si32a = static_cast<int32>(p->_stack.pop4());
+ si32b = static_cast<int32>(p->_stack.pop4());
if (si32a == si32b) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("cmp long\n"));
break;
@@ -702,12 +702,12 @@ void UCMachine::execProcess(UCProcess *p) {
// 26
// compare two strings
// (delete strings)
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
if (getString(ui16b) == getString(ui16a))
- p->stack.push2(1);
+ p->_stack.push2(1);
else
- p->stack.push2(0);
+ p->_stack.push2(0);
freeString(ui16a);
freeString(ui16b);
LOGPF(("strcmp\n"));
@@ -717,12 +717,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x28:
// 28
// 16 bit less-than
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16b < si16a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("lt\n"));
break;
@@ -730,12 +730,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x29:
// 29
// 32 bit less-than
- si32a = static_cast<int32>(p->stack.pop4());
- si32b = static_cast<int32>(p->stack.pop4());
+ si32a = static_cast<int32>(p->_stack.pop4());
+ si32b = static_cast<int32>(p->_stack.pop4());
if (si32b < si32a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("lt long\n"));
break;
@@ -743,12 +743,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x2A:
// 2A
// 16 bit less-or-equal
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16b <= si16a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("le\n"));
break;
@@ -756,12 +756,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x2B:
// 2B
// 32 bit less-or-equal
- si32a = static_cast<int32>(p->stack.pop4());
- si32b = static_cast<int32>(p->stack.pop4());
+ si32a = static_cast<int32>(p->_stack.pop4());
+ si32b = static_cast<int32>(p->_stack.pop4());
if (si32b <= si32a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("le long\n"));
break;
@@ -769,12 +769,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x2C:
// 2C
// 16 bit greater-than
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16b > si16a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("gt\n"));
break;
@@ -782,12 +782,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x2D:
// 2D
// 32 bit greater-than
- si32a = static_cast<int32>(p->stack.pop4());
- si32b = static_cast<int32>(p->stack.pop4());
+ si32a = static_cast<int32>(p->_stack.pop4());
+ si32b = static_cast<int32>(p->_stack.pop4());
if (si32b > si32a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("gt long\n"));
break;
@@ -795,12 +795,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x2E:
// 2E
// 16 bit greater-or-equal
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16b >= si16a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("ge\n"));
break;
@@ -808,12 +808,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x2F:
// 2F
// 32 bit greater-or-equal
- si32a = static_cast<int32>(p->stack.pop4());
- si32b = static_cast<int32>(p->stack.pop4());
+ si32a = static_cast<int32>(p->_stack.pop4());
+ si32b = static_cast<int32>(p->_stack.pop4());
if (si32b >= si32a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("ge long\n"));
break;
@@ -821,11 +821,11 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x30:
// 30
// 16 bit boolean not
- ui16a = p->stack.pop2();
+ ui16a = p->_stack.pop2();
if (!ui16a) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("not\n"));
break;
@@ -834,11 +834,11 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x31:
// 31
// 32 bit boolean not (both input and output 32 bit?)
- ui32a = p->stack.pop4();
+ ui32a = p->_stack.pop4();
if (!ui32a) {
- p->stack.push4(1);
+ p->_stack.push4(1);
} else {
- p->stack.push4(0);
+ p->_stack.push4(0);
}
LOGPF(("not long\n"));
break;
@@ -846,12 +846,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x32:
// 32
// 16 bit boolean and
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
if (ui16a && ui16b) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("and\n"));
break;
@@ -859,12 +859,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x33:
// 33
// 32 bit boolean and
- ui32a = p->stack.pop4();
- ui32b = p->stack.pop4();
+ ui32a = p->_stack.pop4();
+ ui32b = p->_stack.pop4();
if (ui32a && ui32b) {
- p->stack.push4(1);
+ p->_stack.push4(1);
} else {
- p->stack.push4(0);
+ p->_stack.push4(0);
}
LOGPF(("and long\n"));
break;
@@ -872,12 +872,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x34:
// 34
// 16 bit boolean or
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
if (ui16a || ui16b) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("or\n"));
break;
@@ -885,12 +885,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x35:
// 35
// 32 bit boolean or
- ui32a = p->stack.pop4();
- ui32b = p->stack.pop4();
+ ui32a = p->_stack.pop4();
+ ui32b = p->_stack.pop4();
if (ui32a || ui32b) {
- p->stack.push4(1);
+ p->_stack.push4(1);
} else {
- p->stack.push4(0);
+ p->_stack.push4(0);
}
LOGPF(("or long\n"));
break;
@@ -898,12 +898,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x36:
// 36
// 16 bit not-equal
- si16a = static_cast<int16>(p->stack.pop2());
- si16b = static_cast<int16>(p->stack.pop2());
+ si16a = static_cast<int16>(p->_stack.pop2());
+ si16b = static_cast<int16>(p->_stack.pop2());
if (si16a != si16b) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("ne\n"));
break;
@@ -911,12 +911,12 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x37:
// 37
// 32 bit not-equal
- si32a = static_cast<int16>(p->stack.pop4());
- si32b = static_cast<int16>(p->stack.pop4());
+ si32a = static_cast<int16>(p->_stack.pop4());
+ si32b = static_cast<int16>(p->_stack.pop4());
if (si32a != si32b) {
- p->stack.push2(1);
+ p->_stack.push2(1);
} else {
- p->stack.push2(0);
+ p->_stack.push2(0);
}
LOGPF(("ne long\n"));
break;
@@ -929,25 +929,25 @@ void UCMachine::execProcess(UCProcess *p) {
ui16a = cs.read1();
ui32a = cs.read1();
- ui16b = p->stack.pop2();
+ ui16b = p->_stack.pop2();
if (ui32a) { // stringlist
if (ui16a != 2) {
perr << "Unhandled operand " << ui16a << " to in slist"
<< Std::endl;
error = true;
}
- if (getList(ui16b)->stringInList(p->stack.pop2()))
- p->stack.push2(1);
+ if (getList(ui16b)->stringInList(p->_stack.pop2()))
+ p->_stack.push2(1);
else
- p->stack.push2(0);
+ p->_stack.push2(0);
freeStringList(ui16b);
} else {
- bool found = getList(ui16b)->inList(p->stack.access());
- p->stack.addSP(ui16a);
+ bool found = getList(ui16b)->inList(p->_stack.access());
+ p->_stack.addSP(ui16a);
if (found)
- p->stack.push2(1);
+ p->_stack.push2(1);
else
- p->stack.push2(0);
+ p->_stack.push2(0);
freeList(ui16b);
}
@@ -957,26 +957,26 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x39:
// 39
// 16 bit bitwise and
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
- p->stack.push2(ui16a & ui16b);
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
+ p->_stack.push2(ui16a & ui16b);
LOGPF(("bit_and\n"));
break;
case 0x3A:
// 3A
// 16 bit bitwise or
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
- p->stack.push2(ui16a | ui16b);
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
+ p->_stack.push2(ui16a | ui16b);
LOGPF(("bit_or\n"));
break;
case 0x3B:
// 3B
// 16 bit bitwise not
- ui16a = p->stack.pop2();
- p->stack.push2(~ui16a);
+ ui16a = p->_stack.pop2();
+ p->_stack.push2(~ui16a);
LOGPF(("bit_not\n"));
break;
@@ -984,9 +984,9 @@ void UCMachine::execProcess(UCProcess *p) {
// 3C
// 16 bit left shift
// operand order?
- si16a = static_cast<int16>(p->stack.pop2());
- ui16b = static_cast<int16>(p->stack.pop2());
- p->stack.push2(static_cast<uint16>(si16a << ui16b));
+ si16a = static_cast<int16>(p->_stack.pop2());
+ ui16b = static_cast<int16>(p->_stack.pop2());
+ p->_stack.push2(static_cast<uint16>(si16a << ui16b));
LOGPF(("lsh\n"));
break;
@@ -995,9 +995,9 @@ void UCMachine::execProcess(UCProcess *p) {
// 16 bit right shift
// !! sign-extend or not?
// operand order?
- si16a = static_cast<int16>(p->stack.pop2());
- ui16b = static_cast<int16>(p->stack.pop2());
- p->stack.push2(static_cast<uint16>(si16a >> ui16b));
+ si16a = static_cast<int16>(p->_stack.pop2());
+ ui16b = static_cast<int16>(p->_stack.pop2());
+ p->_stack.push2(static_cast<uint16>(si16a >> ui16b));
LOGPF(("rsh\n"));
break;
@@ -1005,8 +1005,8 @@ void UCMachine::execProcess(UCProcess *p) {
// 3E xx
// push the value of the unsigned 8 bit local var xx as 16 bit int
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access1(p->bp + si8a);
- p->stack.push2(ui16a);
+ ui16a = p->_stack.access1(p->_bp + si8a);
+ p->_stack.push2(ui16a);
LOGPF(("push byte\t%s = %02Xh\n", print_bp(si8a), ui16a));
break;
@@ -1014,8 +1014,8 @@ void UCMachine::execProcess(UCProcess *p) {
// 3F xx
// push the value of the 16 bit local var xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->bp + si8a);
- p->stack.push2(ui16a);
+ ui16a = p->_stack.access2(p->_bp + si8a);
+ p->_stack.push2(ui16a);
LOGPF(("push\t\t%s = %04Xh\n", print_bp(si8a), ui16a));
break;
@@ -1023,8 +1023,8 @@ void UCMachine::execProcess(UCProcess *p) {
// 40 xx
// push the value of the 32 bit local var xx
si8a = static_cast<int8>(cs.read1());
- ui32a = p->stack.access4(p->bp + si8a);
- p->stack.push4(ui32a);
+ ui32a = p->_stack.access4(p->_bp + si8a);
+ p->_stack.push4(ui32a);
LOGPF(("push dword\t%s = %08Xh\n", print_bp(si8a), ui32a));
break;
@@ -1034,8 +1034,8 @@ void UCMachine::execProcess(UCProcess *p) {
// duplicating the string?
{
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->bp + si8a);
- p->stack.push2(duplicateString(ui16a));
+ ui16a = p->_stack.access2(p->_bp + si8a);
+ p->_stack.push2(duplicateString(ui16a));
LOGPF(("push string\t%s\n", print_bp(si8a)));
}
break;
@@ -1047,7 +1047,7 @@ void UCMachine::execProcess(UCProcess *p) {
{
si8a = static_cast<int8>(cs.read1());
ui16a = cs.read1();
- ui16b = p->stack.access2(p->bp + si8a);
+ ui16b = p->_stack.access2(p->_bp + si8a);
UCList *l = new UCList(ui16a);
if (getList(ui16b)) {
l->copyList(*getList(ui16b));
@@ -1058,7 +1058,7 @@ void UCMachine::execProcess(UCProcess *p) {
// error = true;
}
uint16 newlistid = assignList(l);
- p->stack.push2(newlistid);
+ p->_stack.push2(newlistid);
LOGPF(("push list\t%s (%04X, copy %04X, %d elements)\n",
print_bp(si8a), ui16b, newlistid, l->getSize()));
}
@@ -1072,7 +1072,7 @@ void UCMachine::execProcess(UCProcess *p) {
si8a = static_cast<int8>(cs.read1());
//!U8 ui16a = cs.read1();
ui16a = 2;
- ui16b = p->stack.access2(p->bp + si8a);
+ ui16b = p->_stack.access2(p->_bp + si8a);
UCList *l = new UCList(ui16a);
if (getList(ui16b)) {
l->copyStringList(*getList(ui16b));
@@ -1082,7 +1082,7 @@ void UCMachine::execProcess(UCProcess *p) {
// perr << "Pushing non-existent slist" << Std::endl;
// error = true;
}
- p->stack.push2(assignList(l));
+ p->_stack.push2(assignList(l));
LOGPF(("push slist\t%s\n", print_bp(si8a)));
}
break;
@@ -1100,21 +1100,21 @@ void UCMachine::execProcess(UCProcess *p) {
{
ui32a = cs.read1();
ui32b = cs.read1();
- ui16a = p->stack.pop2() - 1; // index
- ui16b = p->stack.pop2(); // list
+ ui16a = p->_stack.pop2() - 1; // index
+ ui16b = p->_stack.pop2(); // list
UCList *l = getList(ui16b);
if (!l) {
// perr << "push element from invalid list (" << ui16b << ")"
// << Std::endl;
// This is necessary for closing the backpack to work
- p->stack.push0(ui32a);
+ p->_stack.push0(ui32a);
// error = true;
} else {
if (ui32b) {
uint16 s = getList(ui16b)->getStringIndex(ui16a);
- p->stack.push2(duplicateString(s));
+ p->_stack.push2(duplicateString(s));
} else {
- p->stack.push((*getList(ui16b))[ui16a], ui32a);
+ p->_stack.push((*getList(ui16b))[ui16a], ui32a);
}
}
LOGPF(("push element\t%02X slist==%02X\n", ui32a, ui32b));
@@ -1126,7 +1126,7 @@ void UCMachine::execProcess(UCProcess *p) {
// push huge of size yy from BP+xx
si8a = static_cast<int8>(cs.read1());
ui16b = cs.read1();
- p->stack.push(p->stack.access(p->bp + si8a), ui16b);
+ p->_stack.push(p->_stack.access(p->_bp + si8a), ui16b);
LOGPF(("push huge\t%s %02X\n", print_bp(si8a), ui16b));
break;
@@ -1134,7 +1134,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 4B xx
// push 32 bit pointer address of BP+XX
si8a = static_cast<int8>(cs.read1());
- p->stack.push4(stackToPtr(p->_pid, p->bp + si8a));
+ p->_stack.push4(stackToPtr(p->_pid, p->_bp + si8a));
LOGPF(("push addr\t%s\n", print_bp(si8a)));
break;
@@ -1145,17 +1145,17 @@ void UCMachine::execProcess(UCProcess *p) {
// from the location referenced by the pointer
{
ui16a = cs.read1();
- ui32a = p->stack.pop4();
+ ui32a = p->_stack.pop4();
- p->stack.addSP(-ui16a);
+ p->_stack.addSP(-ui16a);
if (!dereferencePointer(ui32a,
- p->stack.access(),
+ p->_stack.access(),
ui16a))
error = true;
LOGPF(("push indirect\t%02Xh bytes", ui16a));
if (!error && ui16a == 2) {
- LOGPF((" = %04Xh\n", p->stack.access2(p->stack.getSP())));
+ LOGPF((" = %04Xh\n", p->_stack.access2(p->_stack.getSP())));
} else {
LOGPF(("\n"));
}
@@ -1169,10 +1169,10 @@ void UCMachine::execProcess(UCProcess *p) {
// from the location referenced by the pointer
{
ui16a = cs.read1();
- ui32a = p->stack.pop4();
+ ui32a = p->_stack.pop4();
- if (assignPointer(ui32a, p->stack.access(), ui16a)) {
- p->stack.addSP(ui16a);
+ if (assignPointer(ui32a, p->_stack.access(), ui16a)) {
+ p->_stack.addSP(ui16a);
} else {
error = true;
}
@@ -1188,8 +1188,8 @@ void UCMachine::execProcess(UCProcess *p) {
ui16b = cs.read1();
// TODO: get flagname for output?
- ui32a = globals->getBits(ui16a, ui16b);
- p->stack.push2(static_cast<uint16>(ui32a));
+ ui32a = _globals->getBits(ui16a, ui16b);
+ p->_stack.push2(static_cast<uint16>(ui32a));
LOGPF(("push\t\tglobal [%04X %02X] = %02X\n", ui16a, ui16b, ui32a));
break;
@@ -1199,15 +1199,15 @@ void UCMachine::execProcess(UCProcess *p) {
ui16a = cs.read2();
ui16b = cs.read1();
// TODO: get flagname for output?
- ui32a = p->stack.pop2();
- globals->setBits(ui16a, ui16b, ui32a);
+ ui32a = p->_stack.pop2();
+ _globals->setBits(ui16a, ui16b, ui32a);
if (ui32a & ~(((1 << ui16b) - 1))) {
perr << "Warning: value popped into a bitflag it doesn't fit in" << Std::endl;
}
// paranoid :-)
- assert(globals->getBits(ui16a, ui16b) == (ui32a & ((1 << ui16b) - 1)));
+ assert(_globals->getBits(ui16a, ui16b) == (ui32a & ((1 << ui16b) - 1)));
LOGPF(("pop\t\tglobal [%04X %02X] = %02X\n", ui16a, ui16b, ui32a));
break;
@@ -1225,15 +1225,15 @@ void UCMachine::execProcess(UCProcess *p) {
// and some other process is probably waiting for it.
// So, we can't delete ourselves just yet.
} else {
- LOGPF(("ret\t\tto %04X:%04X\n", p->classid, p->ip));
+ LOGPF(("ret\t\tto %04X:%04X\n", p->_classId, p->_ip));
- // return value is stored in temp32 register
+ // return value is stored in _temp32 register
// Update the code segment
- uint32 base_ = p->usecode->get_class_base_offset(p->classid);
- cs.load(p->usecode->get_class(p->classid) + base_,
- p->usecode->get_class_size(p->classid) - base_);
- cs.seek(p->ip);
+ uint32 base_ = p->_usecode->get_class_base_offset(p->_classId);
+ cs.load(p->_usecode->get_class(p->_classId) + base_,
+ p->_usecode->get_class_size(p->_classId) - base_);
+ cs.seek(p->_ip);
}
// Resume execution
@@ -1243,7 +1243,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 51 xx xx
// relative jump to xxxx if false
si16a = static_cast<int16>(cs.read2());
- ui16b = p->stack.pop2();
+ ui16b = p->_stack.pop2();
if (!ui16b) {
ui16a = cs.getPos() + si16a;
cs.seek(ui16a);
@@ -1294,9 +1294,9 @@ void UCMachine::execProcess(UCProcess *p) {
{
cs.read2(); // skip the 01 01
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
- p->stack.push2(ui16a); //!! which _pid do we need to push!?
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
+ p->_stack.push2(ui16a); //!! which _pid do we need to push!?
LOGPF(("implies\n"));
Process *proc = Kernel::get_instance()->getProcess(ui16b);
@@ -1338,27 +1338,27 @@ void UCMachine::execProcess(UCProcess *p) {
uint16 classid = cs.read2();
uint16 offset = cs.read2();
- uint32 thisptr = p->stack.pop4();
+ uint32 thisptr = p->_stack.pop4();
LOGPF(("spawn\t\t%02X %02X %04X:%04X\n",
arg_bytes, this_size, classid, offset));
if (GAME_IS_CRUSADER) {
- offset = p->usecode->get_class_event(classid, offset);
+ offset = p->_usecode->get_class_event(classid, offset);
}
UCProcess *newproc = new UCProcess(classid, offset,
thisptr,
this_size,
- p->stack.access(),
+ p->_stack.access(),
arg_bytes);
- p->temp32 = Kernel::get_instance()->addProcessExec(newproc);
+ p->_temp32 = Kernel::get_instance()->addProcessExec(newproc);
#ifdef DEBUG
- if (trace_show(p->_pid, p->_itemNum, p->classid)) {
+ if (trace_show(p->_pid, p->_itemNum, p->_classId)) {
pout << Std::hex << "(still) running process " << p->_pid
<< ", item " << p->_itemNum << ", type " << p->type
- << ", class " << p->classid << ", offset " << p->ip
+ << ", class " << p->_classId << ", offset " << p->_ip
<< Std::dec << Std::endl;
}
#endif
@@ -1392,24 +1392,24 @@ void UCMachine::execProcess(UCProcess *p) {
uint32 thisptr = 0;
if (this_size > 0)
- thisptr = p->stack.access4(p->bp + 6);
+ thisptr = p->_stack.access4(p->_bp + 6);
UCProcess *newproc = new UCProcess(classid, offset + delta,
thisptr, this_size);
uint16 newpid = Kernel::get_instance()->addProcessExec(newproc);
#ifdef DEBUG
- if (trace_show(p->_pid, p->_itemNum, p->classid)) {
+ if (trace_show(p->_pid, p->_itemNum, p->_classId)) {
pout << Std::hex << "(still) running process " << p->_pid
- << ", item " << p->_itemNum << ", class " << p->classid
- << ", offset " << p->ip << Std::dec << Std::endl;
+ << ", item " << p->_itemNum << ", class " << p->_classId
+ << ", offset " << p->_ip << Std::dec << Std::endl;
}
#endif
// as with 'spawn', run execute the spawned process once
// immediately
- p->stack.push2(newpid); //! push _pid of newproc?
+ p->_stack.push2(newpid); //! push _pid of newproc?
// cede = true;
}
@@ -1418,7 +1418,7 @@ void UCMachine::execProcess(UCProcess *p) {
case 0x59:
// 59
// push process id
- p->stack.push2(p->_pid);
+ p->_stack.push2(p->_pid);
LOGPF(("push\t\tpid = %04Xh\n", p->_pid));
break;
@@ -1431,7 +1431,7 @@ void UCMachine::execProcess(UCProcess *p) {
if (ui16a & 1) ui16a++; // 16-bit align
if (ui16a > 0) {
- p->stack.push0(ui16a);
+ p->_stack.push0(ui16a);
}
break;
@@ -1439,39 +1439,39 @@ void UCMachine::execProcess(UCProcess *p) {
// 5D
// push 8 bit value returned from function call
// (push temp8 as 16 bit value)
- p->stack.push2(static_cast<uint8>(p->temp32 & 0xFF));
- LOGPF(("push byte\tretval = %02Xh\n", (p->temp32 & 0xFF)));
+ p->_stack.push2(static_cast<uint8>(p->_temp32 & 0xFF));
+ LOGPF(("push byte\tretval = %02Xh\n", (p->_temp32 & 0xFF)));
break;
case 0x5E:
// 5E
// push 16 bit value returned from function call
// (push temp16)
- p->stack.push2(static_cast<uint16>(p->temp32 & 0xFFFF));
- LOGPF(("push\t\tretval = %04Xh\n", (p->temp32 & 0xFFFF)));
+ p->_stack.push2(static_cast<uint16>(p->_temp32 & 0xFFFF));
+ LOGPF(("push\t\tretval = %04Xh\n", (p->_temp32 & 0xFFFF)));
break;
case 0x5F:
// 5F
// push 32 bit value returned from function call
- // (push temp32)
- p->stack.push4(p->temp32);
- LOGPF(("push long\t\tretval = %08Xh\n", p->temp32));
+ // (push _temp32)
+ p->_stack.push4(p->_temp32);
+ LOGPF(("push long\t\tretval = %08Xh\n", p->_temp32));
break;
case 0x60:
// 60
// convert 16-bit to 32-bit int (sign extend)
- si32a = static_cast<int16>(p->stack.pop2());
- p->stack.push4(si32a);
+ si32a = static_cast<int16>(p->_stack.pop2());
+ p->_stack.push4(si32a);
LOGPF(("int to long\n"));
break;
case 0x61:
// 61
// convert 32-bit to 16-bit int
- si16a = static_cast<int16>(p->stack.pop4());
- p->stack.push2(si16a);
+ si16a = static_cast<int16>(p->_stack.pop4());
+ p->_stack.push2(si16a);
LOGPF(("long to int\n"));
break;
@@ -1479,7 +1479,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 62 xx
// free the string in var BP+xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->bp + si8a);
+ ui16a = p->_stack.access2(p->_bp + si8a);
freeString(ui16a);
LOGPF(("free string\t%s = %04X\n", print_bp(si8a), ui16a));
break;
@@ -1488,7 +1488,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 63 xx
// free the stringlist in var BP+xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->bp + si8a);
+ ui16a = p->_stack.access2(p->_bp + si8a);
freeStringList(ui16a);
LOGPF(("free slist\t%s = %04X\n", print_bp(si8a), ui16a));
break;
@@ -1497,7 +1497,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 64 xx
// free the list in var BP+xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->bp + si8a);
+ ui16a = p->_stack.access2(p->_bp + si8a);
freeList(ui16a);
LOGPF(("free list\t%s = %04X\n", print_bp(si8a), ui16a));
break;
@@ -1508,7 +1508,7 @@ void UCMachine::execProcess(UCProcess *p) {
// NB: sometimes there's a 32-bit string pointer at SP+xx
// However, the low word of this is exactly the 16bit ref
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->stack.getSP() + si8a);
+ ui16a = p->_stack.access2(p->_stack.getSP() + si8a);
freeString(ui16a);
LOGPF(("free string\t%s = %04X\n", print_sp(si8a), ui16a));
break;
@@ -1517,7 +1517,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 66 xx
// free the list at SP+xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->stack.getSP() + si8a);
+ ui16a = p->_stack.access2(p->_stack.getSP() + si8a);
freeList(ui16a);
LOGPF(("free list\t%s = %04X\n", print_sp(si8a), ui16a));
break;
@@ -1526,7 +1526,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 67 xx
// free the string list at SP+xx
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->stack.getSP() + si8a);
+ ui16a = p->_stack.access2(p->_stack.getSP() + si8a);
freeStringList(ui16a);
LOGPF(("free slist\t%s = %04x\n", print_sp(si8a), ui16a));
break;
@@ -1535,16 +1535,16 @@ void UCMachine::execProcess(UCProcess *p) {
// 69 xx
// push the string in var BP+xx as 32 bit pointer
si8a = static_cast<int8>(cs.read1());
- ui16a = p->stack.access2(p->bp + si8a);
- p->stack.push4(stringToPtr(ui16a));
+ ui16a = p->_stack.access2(p->_bp + si8a);
+ p->_stack.push4(stringToPtr(ui16a));
LOGPF(("str to ptr\t%s\n", print_bp(si8a)));
break;
case 0x6B:
// 6B
// pop a string and push 32 bit pointer to string
- ui16a = p->stack.pop2();
- p->stack.push4(stringToPtr(ui16a));
+ ui16a = p->_stack.pop2();
+ p->_stack.push4(stringToPtr(ui16a));
LOGPF(("str to ptr\n"));
break;
@@ -1557,7 +1557,7 @@ void UCMachine::execProcess(UCProcess *p) {
ui8a = cs.read1(); // type
LOGPF(("param _pid chg\t%s, type=%u\n", print_bp(si8a), ui8a));
- ui16a = p->stack.access2(p->bp + si8a);
+ ui16a = p->_stack.access2(p->_bp + si8a);
switch (ui8a) {
case 1: // string
// copy string
@@ -1583,7 +1583,7 @@ void UCMachine::execProcess(UCProcess *p) {
<< ")" << Std::endl;
error = true;
}
- p->stack.assign2(p->bp + si8a, ui16b); // assign new index
+ p->_stack.assign2(p->_bp + si8a, ui16b); // assign new index
p->freeOnTerminate(ui16b, ui8a); // free new var when terminating
break;
@@ -1593,7 +1593,7 @@ void UCMachine::execProcess(UCProcess *p) {
// (of which process? pop anything?)
// (also see comment for 0x54 'implies')
LOGPF(("push dword\tprocess result\n"));
- p->stack.push4(p->_result);
+ p->_stack.push4(p->_result);
break;
case 0x6E:
@@ -1601,7 +1601,7 @@ void UCMachine::execProcess(UCProcess *p) {
// substract xx from stack pointer
// (effect on SP is the same as popping xx bytes)
si8a = static_cast<int8>(cs.read1());
- p->stack.addSP(-si8a);
+ p->_stack.addSP(-si8a);
LOGPF(("move sp\t\t%s%02Xh\n", si8a < 0 ? "-" : "", si8a < 0 ? -si8a : si8a));
break;
@@ -1610,7 +1610,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 6F xx
// push 32 pointer address of SP-xx
si8a = static_cast<int8>(cs.read1());
- p->stack.push4(stackToPtr(p->_pid, static_cast<uint16>(p->stack.getSP() - si8a)));
+ p->_stack.push4(stackToPtr(p->_pid, static_cast<uint16>(p->_stack.getSP() - si8a)));
LOGPF(("push addr\t%s\n", print_sp(-si8a)));
break;
@@ -1635,8 +1635,8 @@ void UCMachine::execProcess(UCProcess *p) {
uint32 scriptsize = cs.read1();
uint32 searchtype = cs.read1();
- ui16a = p->stack.pop2();
- ui16b = p->stack.pop2();
+ ui16a = p->_stack.pop2();
+ ui16b = p->_stack.pop2();
//!! This may not be the way the original did things...
@@ -1657,7 +1657,7 @@ void UCMachine::execProcess(UCProcess *p) {
}
uint8 *script = new uint8[scriptsize];
- p->stack.pop(script, scriptsize);
+ p->_stack.pop(script, scriptsize);
uint32 stacksize = 0;
bool recurse = false;
@@ -1744,13 +1744,13 @@ void UCMachine::execProcess(UCProcess *p) {
break;
}
- p->stack.push0(stacksize - scriptsize - 8); // filler
- p->stack.push(script, scriptsize);
- p->stack.push2(scriptsize);
- p->stack.push2(static_cast<uint16>(si16a));
- p->stack.push2(0);
+ p->_stack.push0(stacksize - scriptsize - 8); // filler
+ p->_stack.push(script, scriptsize);
+ p->_stack.push2(scriptsize);
+ p->_stack.push2(static_cast<uint16>(si16a));
+ p->_stack.push2(0);
uint16 itemlistID = assignList(itemlist);
- p->stack.push2(itemlistID);
+ p->_stack.push2(itemlistID);
delete[] script;
@@ -1762,14 +1762,14 @@ void UCMachine::execProcess(UCProcess *p) {
// 73
// next loop object. pushes false if end reached
{
- unsigned int sp = p->stack.getSP();
- uint16 itemlistID = p->stack.access2(sp);
+ unsigned int sp = p->_stack.getSP();
+ uint16 itemlistID = p->_stack.access2(sp);
UCList *itemlist = getList(itemlistID);
- uint16 index = p->stack.access2(sp + 2);
- si16a = static_cast<int16>(p->stack.access2(sp + 4));
+ uint16 index = p->_stack.access2(sp + 2);
+ si16a = static_cast<int16>(p->_stack.access2(sp + 4));
#if 0
- uint16 scriptsize = p->stack.access2(sp + 6);
- const uint8 *loopscript = p->stack.access(sp + 8);
+ uint16 scriptsize = p->_stack.access2(sp + 6);
+ const uint8 *loopscript = p->_stack.access(sp + 8);
#endif
if (!itemlist) {
@@ -1785,8 +1785,8 @@ void UCMachine::execProcess(UCProcess *p) {
break;
}
- p->stack.assign(p->bp + si16a, (*itemlist)[index], 2);
- uint16 objid = p->stack.access2(p->bp + si16a);
+ p->_stack.assign(p->_bp + si16a, (*itemlist)[index], 2);
+ uint16 objid = p->_stack.access2(p->_bp + si16a);
Item *item = getItem(objid);
if (item) {
#if 0
@@ -1801,12 +1801,12 @@ void UCMachine::execProcess(UCProcess *p) {
} while (!valid);
if (!valid) {
- p->stack.push2(0); // end of loop
+ p->_stack.push2(0); // end of loop
freeList(itemlistID);
} else {
- p->stack.push2(1);
+ p->_stack.push2(1);
// increment index
- p->stack.assign2(sp + 2, index + 1);
+ p->_stack.assign2(sp + 2, index + 1);
}
if (opcode == 0x73) { // because of the fall-through
@@ -1819,7 +1819,7 @@ void UCMachine::execProcess(UCProcess *p) {
// 74 xx
// add xx to the current 'loopscript'
ui8a = cs.read1();
- p->stack.push1(ui8a);
+ p->_stack.push1(ui8a);
LOGPF(("loopscr\t\t%02X \"%c\"\n", ui8a, static_cast<char>(ui8a)));
break;
@@ -1868,8 +1868,8 @@ void UCMachine::execProcess(UCProcess *p) {
ui32a = cs.read1(); // list size
si16a = cs.read2(); // jump offset
- ui16a = p->stack.access2(p->stack.getSP()); // Loop index
- ui16b = p->stack.access2(p->stack.getSP() + 2); // Loop list
+ ui16a = p->_stack.access2(p->_stack.getSP()); // Loop index
+ ui16b = p->_stack.access2(p->_stack.getSP() + 2); // Loop list
if (opcode == 0x76 && ui32a != 2) {
error = true;
@@ -1897,7 +1897,7 @@ void UCMachine::execProcess(UCProcess *p) {
freeStringList(ui16b);
}
- p->stack.addSP(4); // Pop list and counter
+ p->_stack.addSP(4); // Pop list and counter
// jump out
ui16a = cs.getPos() + si16a;
@@ -1907,10 +1907,10 @@ void UCMachine::execProcess(UCProcess *p) {
// (not duplicating any strings)
// updated loop index
- p->stack.assign2(p->stack.getSP(), ui16a);
+ p->_stack.assign2(p->_stack.getSP(), ui16a);
// place next element from list in [bp+si8a]
- p->stack.assign(p->bp + si8a, (*getList(ui16b))[ui16a], ui32a);
+ p->_stack.assign(p->_bp + si8a, (*getList(ui16b))[ui16a], ui32a);
}
break;
@@ -1918,8 +1918,8 @@ void UCMachine::execProcess(UCProcess *p) {
// 77
// set info
// assigns item number and ProcessType
- p->setItemNum(p->stack.pop2());
- p->setType(p->stack.pop2());
+ p->setItemNum(p->_stack.pop2());
+ p->setType(p->_stack.pop2());
LOGPF(("set info\n"));
break;
@@ -1969,7 +1969,7 @@ void UCMachine::execProcess(UCProcess *p) {
// write back IP (but preserve IP if there was an error)
if (!error)
- p->ip = static_cast<uint16>(cs.getPos()); // TRUNCATES!
+ p->_ip = static_cast<uint16>(cs.getPos()); // TRUNCATES!
// check if we suspended ourselves
if ((p->_flags & Process::PROC_SUSPENDED) != 0)
@@ -1978,7 +1978,7 @@ void UCMachine::execProcess(UCProcess *p) {
if (error) {
perr.Print("Process %d caused an error at %04X:%04X. Killing process.\n",
- p->_pid, p->classid, p->ip);
+ p->_pid, p->_classId, p->_ip);
p->terminateDeferred();
}
}
@@ -1987,18 +1987,18 @@ void UCMachine::execProcess(UCProcess *p) {
Std::string &UCMachine::getString(uint16 str) {
static Std::string emptystring("");
- Std::map<uint16, Std::string>::iterator iter = stringHeap.find(str);
+ Std::map<uint16, Std::string>::iterator iter = _stringHeap.find(str);
- if (iter != stringHeap.end())
+ if (iter != _stringHeap.end())
return iter->_value;
return emptystring;
}
UCList *UCMachine::getList(uint16 l) {
- Std::map<uint16, UCList *>::iterator iter = listHeap.find(l);
+ Std::map<uint16, UCList *>::iterator iter = _listHeap.find(l);
- if (iter != listHeap.end())
+ if (iter != _listHeap.end())
return iter->_value;
return 0;
@@ -2007,58 +2007,58 @@ UCList *UCMachine::getList(uint16 l) {
uint16 UCMachine::assignString(const char *str) {
- uint16 id = stringIDs->getNewID();
+ uint16 id = _stringIDs->getNewID();
if (id == 0) return 0;
- stringHeap[id] = str;
+ _stringHeap[id] = str;
return id;
}
uint16 UCMachine::duplicateString(uint16 str) {
- return assignString(stringHeap[str].c_str());
+ return assignString(_stringHeap[str].c_str());
}
uint16 UCMachine::assignList(UCList *l) {
- uint16 id = listIDs->getNewID();
+ uint16 id = _listIDs->getNewID();
if (id == 0) return 0;
- assert(listHeap.find(id) == listHeap.end());
+ assert(_listHeap.find(id) == _listHeap.end());
- listHeap[id] = l;
+ _listHeap[id] = l;
return id;
}
void UCMachine::freeString(uint16 s) {
//! There's still a semi-bug in some places that string 0 can be assigned
- //! (when something accesses stringHeap[0])
+ //! (when something accesses _stringHeap[0])
//! This may not be desirable, but OTOH the created string will be
//! empty, so not too much of a problem.
- Std::map<uint16, Std::string>::iterator iter = stringHeap.find(s);
- if (iter != stringHeap.end()) {
- stringHeap.erase(iter);
- stringIDs->clearID(s);
+ Std::map<uint16, Std::string>::iterator iter = _stringHeap.find(s);
+ if (iter != _stringHeap.end()) {
+ _stringHeap.erase(iter);
+ _stringIDs->clearID(s);
}
}
void UCMachine::freeList(uint16 l) {
- Std::map<uint16, UCList *>::iterator iter = listHeap.find(l);
- if (iter != listHeap.end() && iter->_value) {
+ Std::map<uint16, UCList *>::iterator iter = _listHeap.find(l);
+ if (iter != _listHeap.end() && iter->_value) {
iter->_value->free();
delete iter->_value;
- listHeap.erase(iter);
- listIDs->clearID(l);
+ _listHeap.erase(iter);
+ _listIDs->clearID(l);
}
}
void UCMachine::freeStringList(uint16 l) {
- Std::map<uint16, UCList *>::iterator iter = listHeap.find(l);
- if (iter != listHeap.end() && iter->_value) {
+ Std::map<uint16, UCList *>::iterator iter = _listHeap.find(l);
+ if (iter != _listHeap.end() && iter->_value) {
iter->_value->freeStrings();
delete iter->_value;
- listHeap.erase(iter);
- listIDs->clearID(l);
+ _listHeap.erase(iter);
+ _listIDs->clearID(l);
}
}
@@ -2124,10 +2124,10 @@ bool UCMachine::assignPointer(uint32 ptr, const uint8 *data, uint32 size) {
<< "process (_pid: " << segment << ")" << Std::endl;
return false;
} else {
- proc->stack.assign(offset, data, size);
+ proc->_stack.assign(offset, data, size);
}
} else if (segment == SEG_GLOBAL) {
- CANT_HAPPEN_MSG("pointers to globals not implemented yet");
+ CANT_HAPPEN_MSG("pointers to _globals not implemented yet");
} else {
perr << "Trying to access segment " << Std::hex
<< segment << Std::dec << Std::endl;
@@ -2161,7 +2161,7 @@ bool UCMachine::dereferencePointer(uint32 ptr, uint8 *data, uint32 size) {
<< "process (_pid: " << segment << ")" << Std::endl;
return false;
} else {
- Std::memcpy(data, proc->stack.access(offset), size);
+ Std::memcpy(data, proc->_stack.access(offset), size);
}
} else if (segment == SEG_OBJ) {
if (size != 2) {
@@ -2174,7 +2174,7 @@ bool UCMachine::dereferencePointer(uint32 ptr, uint8 *data, uint32 size) {
data[1] = static_cast<uint8>(offset >> 8);
}
} else if (segment == SEG_GLOBAL) {
- CANT_HAPPEN_MSG("pointers to globals not implemented yet");
+ CANT_HAPPEN_MSG("pointers to _globals not implemented yet");
} else {
perr << "Trying to access segment " << Std::hex
<< segment << Std::dec << Std::endl;
@@ -2200,12 +2200,12 @@ uint16 UCMachine::ptrToObject(uint32 ptr) {
<< "process (_pid: " << segment << ")" << Std::endl;
return 0;
} else {
- return proc->stack.access2(offset);
+ return proc->_stack.access2(offset);
}
} else if (segment == SEG_OBJ || segment == SEG_STRING) {
return offset;
} else if (segment == SEG_GLOBAL) {
- CANT_HAPPEN_MSG("pointers to globals not implemented yet");
+ CANT_HAPPEN_MSG("pointers to _globals not implemented yet");
return 0;
} else {
perr << "Trying to access segment " << Std::hex
@@ -2216,16 +2216,16 @@ uint16 UCMachine::ptrToObject(uint32 ptr) {
void UCMachine::usecodeStats() {
pout << "Usecode Machine memory stats:" << Std::endl;
- pout << "Strings : " << stringHeap.size() << "/65534" << Std::endl;
+ pout << "Strings : " << _stringHeap.size() << "/65534" << Std::endl;
#ifdef DUMPHEAP
Std::map<uint16, Std::string>::iterator iter;
- for (iter = stringHeap.begin(); iter != stringHeap.end(); ++iter)
+ for (iter = _stringHeap.begin(); iter != _stringHeap.end(); ++iter)
pout << iter->first << ":" << iter->_value << Std::endl;
#endif
- pout << "Lists : " << listHeap.size() << "/65534" << Std::endl;
+ pout << "Lists : " << _listHeap.size() << "/65534" << Std::endl;
#ifdef DUMPHEAP
Std::map<uint16, UCList *>::iterator iterl;
- for (iterl = listHeap.begin(); iterl != listHeap.end(); ++iterl) {
+ for (iterl = _listHeap.begin(); iterl != _listHeap.end(); ++iterl) {
if (!iterl->_value) {
pout << iterl->first << ": <null>" << Std::endl;
continue;
@@ -2247,15 +2247,15 @@ void UCMachine::usecodeStats() {
}
void UCMachine::saveGlobals(ODataSource *ods) {
- globals->save(ods);
+ _globals->save(ods);
}
void UCMachine::saveStrings(ODataSource *ods) {
- stringIDs->save(ods);
- ods->write4(static_cast<uint32>(stringHeap.size()));
+ _stringIDs->save(ods);
+ ods->write4(static_cast<uint32>(_stringHeap.size()));
Std::map<uint16, Std::string>::iterator iter;
- for (iter = stringHeap.begin(); iter != stringHeap.end(); ++iter) {
+ for (iter = _stringHeap.begin(); iter != _stringHeap.end(); ++iter) {
ods->write2((*iter)._key);
ods->write4((*iter)._value.size());
ods->write((*iter)._value.c_str(), (*iter)._value.size());
@@ -2263,22 +2263,22 @@ void UCMachine::saveStrings(ODataSource *ods) {
}
void UCMachine::saveLists(ODataSource *ods) {
- listIDs->save(ods);
- ods->write4(listHeap.size());
+ _listIDs->save(ods);
+ ods->write4(_listHeap.size());
Std::map<uint16, UCList *>::iterator iter;
- for (iter = listHeap.begin(); iter != listHeap.end(); ++iter) {
+ for (iter = _listHeap.begin(); iter != _listHeap.end(); ++iter) {
ods->write2((*iter)._key);
(*iter)._value->save(ods);
}
}
bool UCMachine::loadGlobals(IDataSource *ids, uint32 version) {
- return globals->load(ids, version);
+ return _globals->load(ids, version);
}
bool UCMachine::loadStrings(IDataSource *ids, uint32 version) {
- if (!stringIDs->load(ids, version)) return false;
+ if (!_stringIDs->load(ids, version)) return false;
uint32 stringcount = ids->read4();
for (unsigned int i = 0; i < stringcount; ++i) {
@@ -2288,10 +2288,10 @@ bool UCMachine::loadStrings(IDataSource *ids, uint32 version) {
char *buf = new char[len + 1];
ids->read(buf, len);
buf[len] = 0;
- stringHeap[sid] = buf;
+ _stringHeap[sid] = buf;
delete[] buf;
} else {
- stringHeap[sid] = "";
+ _stringHeap[sid] = "";
}
}
@@ -2299,7 +2299,7 @@ bool UCMachine::loadStrings(IDataSource *ids, uint32 version) {
}
bool UCMachine::loadLists(IDataSource *ids, uint32 version) {
- if (!listIDs->load(ids, version)) return false;
+ if (!_listIDs->load(ids, version)) return false;
uint32 listcount = ids->read4();
for (unsigned int i = 0; i < listcount; ++i) {
@@ -2308,7 +2308,7 @@ bool UCMachine::loadLists(IDataSource *ids, uint32 version) {
bool ret = l->load(ids, version);
if (!ret) return false;
- listHeap[lid] = l;
+ _listHeap[lid] = l;
}
return true;
@@ -2370,7 +2370,7 @@ void UCMachine::ConCmd_getGlobal(const Console::ArgvType &argv) {
unsigned int size = strtol(argv[2].c_str(), 0, 0);
pout.Print("[%04X %02X] = %d\n", offset, size,
- uc->globals->getBits(offset, size));
+ uc->_globals->getBits(offset, size));
}
void UCMachine::ConCmd_setGlobal(const Console::ArgvType &argv) {
@@ -2384,10 +2384,10 @@ void UCMachine::ConCmd_setGlobal(const Console::ArgvType &argv) {
unsigned int size = strtol(argv[2].c_str(), 0, 0);
unsigned int value = strtol(argv[3].c_str(), 0, 0);
- uc->globals->setBits(offset, size, value);
+ uc->_globals->setBits(offset, size, value);
pout.Print("[%04X %02X] = %d\n", offset, size,
- uc->globals->getBits(offset, size));
+ uc->_globals->getBits(offset, size));
}
#ifdef DEBUG
diff --git a/engines/ultima/ultima8/usecode/uc_machine.h b/engines/ultima/ultima8/usecode/uc_machine.h
index 097767f..0077d03 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.h
+++ b/engines/ultima/ultima8/usecode/uc_machine.h
@@ -44,7 +44,7 @@ public:
~UCMachine();
static UCMachine *get_instance() {
- return ucmachine;
+ return _ucMachine;
}
void reset();
@@ -93,23 +93,22 @@ protected:
void loadIntrinsics(Intrinsic *i, unsigned int icount);
private:
+ ConvertUsecode *_convUse;
+ Intrinsic *_intrinsics;
+ unsigned int _intrinsicCount;
- ConvertUsecode *convuse;
- Intrinsic *intrinsics;
- unsigned int intrinsiccount;
+ BitSet *_globals;
- BitSet *globals;
-
- Std::map<uint16, UCList *> listHeap;
- Std::map<uint16, Std::string> stringHeap;
+ Std::map<uint16, UCList *> _listHeap;
+ Std::map<uint16, Std::string> _stringHeap;
uint16 assignString(const char *str);
uint16 assignList(UCList *l);
- idMan *listIDs;
- idMan *stringIDs;
+ idMan *_listIDs;
+ idMan *_stringIDs;
- static UCMachine *ucmachine;
+ static UCMachine *_ucMachine;
static void ConCmd_getGlobal(const Console::ArgvType &argv);
static void ConCmd_setGlobal(const Console::ArgvType &argv);
diff --git a/engines/ultima/ultima8/usecode/uc_process.cpp b/engines/ultima/ultima8/usecode/uc_process.cpp
index 496cb24..381457c 100644
--- a/engines/ultima/ultima8/usecode/uc_process.cpp
+++ b/engines/ultima/ultima8/usecode/uc_process.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/usecode/uc_process.h"
#include "ultima/ultima8/usecode/uc_machine.h"
#include "ultima/ultima8/usecode/usecode.h"
@@ -36,17 +35,17 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(UCProcess, Process)
UCProcess::UCProcess() : Process() { // !! fixme
- usecode = GameData::get_instance()->getMainUsecode();
+ _usecode = GameData::get_instance()->getMainUsecode();
}
UCProcess::UCProcess(uint16 classid_, uint16 offset_, uint32 this_ptr,
int thissize, const uint8 *args, int argsize)
: Process() {
- classid = 0xFFFF;
- ip = 0xFFFF;
- bp = 0x0000;
- usecode = GameData::get_instance()->getMainUsecode();
- temp32 = 0;
+ _classId = 0xFFFF;
+ _ip = 0xFFFF;
+ _bp = 0x0000;
+ _usecode = GameData::get_instance()->getMainUsecode();
+ _temp32 = 0;
load(classid_, offset_, this_ptr, thissize, args, argsize);
}
@@ -57,28 +56,28 @@ UCProcess::~UCProcess() {
void UCProcess::load(uint16 classid_, uint16 offset_, uint32 this_ptr,
int thissize, const uint8 *args, int argsize) {
- if (usecode->get_class_size(classid_) == 0)
+ if (_usecode->get_class_size(classid_) == 0)
perr << "Class is empty..." << Std::endl;
- classid = 0xFFFF;
- ip = 0xFFFF;
- bp = 0x0000;
+ _classId = 0xFFFF;
+ _ip = 0xFFFF;
+ _bp = 0x0000;
uint16 thissp = 0;
// first, push the derefenced this pointer
if (this_ptr != 0 && thissize > 0) {
- stack.addSP(-thissize);
+ _stack.addSP(-thissize);
UCMachine::get_instance()->
- dereferencePointer(this_ptr, stack.access(), thissize);
- thissp = stack.getSP();
+ dereferencePointer(this_ptr, _stack.access(), thissize);
+ thissp = _stack.getSP();
}
// next, push the arguments
- stack.push(args, argsize);
+ _stack.push(args, argsize);
// then, push the new this pointer
if (thissp != 0)
- stack.push4(UCMachine::stackToPtr(_pid, thissp));
+ _stack.push4(UCMachine::stackToPtr(_pid, thissp));
// finally, call the specified function
call(classid_, offset_);
@@ -93,23 +92,23 @@ void UCProcess::run() {
}
void UCProcess::call(uint16 classid_, uint16 offset_) {
- stack.push2(classid); // BP+04 prev class
- stack.push2(ip); // BP+02 prev IP
- stack.push2(bp); // BP+00 prev BP
+ _stack.push2(_classId); // BP+04 prev class
+ _stack.push2(_ip); // BP+02 prev IP
+ _stack.push2(_bp); // BP+00 prev BP
- classid = classid_;
- ip = offset_;
- bp = static_cast<uint16>(stack.getSP()); // TRUNCATES!
+ _classId = classid_;
+ _ip = offset_;
+ _bp = static_cast<uint16>(_stack.getSP()); // TRUNCATES!
}
bool UCProcess::ret() {
- stack.setSP(bp);
+ _stack.setSP(_bp);
- bp = stack.pop2();
- ip = stack.pop2();
- classid = stack.pop2();
+ _bp = _stack.pop2();
+ _ip = _stack.pop2();
+ _classId = _stack.pop2();
- if (ip == 0xFFFF && classid == 0xFFFF)
+ if (_ip == 0xFFFF && _classId == 0xFFFF)
return true;
else
return false;
@@ -122,13 +121,13 @@ void UCProcess::freeOnTerminate(uint16 index, int type_) {
p.first = index;
p.second = type_;
- freeonterminate.push_back(p);
+ _freeOnTerminate.push_back(p);
}
void UCProcess::terminate() {
Std::list<Std::pair<uint16, int> >::iterator i;
- for (i = freeonterminate.begin(); i != freeonterminate.end(); ++i) {
+ for (i = _freeOnTerminate.begin(); i != _freeOnTerminate.end(); ++i) {
uint16 index = (*i).first;
int typeNum = (*i).second;
@@ -145,7 +144,7 @@ void UCProcess::terminate() {
}
}
- freeonterminate.clear();
+ _freeOnTerminate.clear();
Process::terminate();
}
@@ -153,46 +152,46 @@ void UCProcess::terminate() {
void UCProcess::dumpInfo() {
Process::dumpInfo();
- if (classid == 0xFFFF) {
+ if (_classId == 0xFFFF) {
pout.Print("IP undefined\n");
} else {
const char *classname = GameData::get_instance()->getMainUsecode()->
- get_class_name(classid);
- pout.Print("classname: %s, IP: %04X:%04X\n", classname, classid, ip);
+ get_class_name(_classId);
+ pout.Print("classname: %s, IP: %04X:%04X\n", classname, _classId, _ip);
}
}
void UCProcess::saveData(ODataSource *ods) {
Process::saveData(ods);
- ods->write2(bp);
- ods->write2(classid);
- ods->write2(ip);
- ods->write4(temp32);
- ods->write4(static_cast<uint32>(freeonterminate.size()));
+ ods->write2(_bp);
+ ods->write2(_classId);
+ ods->write2(_ip);
+ ods->write4(_temp32);
+ ods->write4(static_cast<uint32>(_freeOnTerminate.size()));
Std::list<Std::pair<uint16, int> >::iterator iter;
- for (iter = freeonterminate.begin(); iter != freeonterminate.end(); ++iter) {
+ for (iter = _freeOnTerminate.begin(); iter != _freeOnTerminate.end(); ++iter) {
ods->write2(iter->first);
ods->write4(static_cast<uint32>(iter->second));
}
- stack.save(ods);
+ _stack.save(ods);
}
bool UCProcess::loadData(IDataSource *ids, uint32 version) {
if (!Process::loadData(ids, version)) return false;
- bp = ids->read2();
- classid = ids->read2();
- ip = ids->read2();
- temp32 = ids->read4();
+ _bp = ids->read2();
+ _classId = ids->read2();
+ _ip = ids->read2();
+ _temp32 = ids->read4();
uint32 freecount = ids->read4();
for (unsigned int i = 0; i < freecount; ++i) {
Std::pair<uint16, int> p;
p.first = ids->read2();
p.second = static_cast<int>(ids->read4());
- freeonterminate.push_back(p);
+ _freeOnTerminate.push_back(p);
}
- stack.load(ids, version);
+ _stack.load(ids, version);
return true;
}
diff --git a/engines/ultima/ultima8/usecode/uc_process.h b/engines/ultima/ultima8/usecode/uc_process.h
index e7d6214..80e0d15 100644
--- a/engines/ultima/ultima8/usecode/uc_process.h
+++ b/engines/ultima/ultima8/usecode/uc_process.h
@@ -54,7 +54,7 @@ public:
void freeOnTerminate(uint16 index, int type_);
void setReturnValue(uint32 retval) {
- temp32 = retval;
+ _temp32 = retval;
}
//! dump some info about this process to pout
@@ -70,20 +70,20 @@ protected:
bool ret();
// stack base pointer
- uint16 bp;
+ uint16 _bp;
- Usecode *usecode;
+ Usecode *_usecode;
- uint16 classid;
- uint16 ip;
+ uint16 _classId;
+ uint16 _ip;
- uint32 temp32;
+ uint32 _temp32;
// data stack
- UCStack stack;
+ UCStack _stack;
// "Free Me" list
- Std::list<Std::pair<uint16, int> > freeonterminate;
+ Std::list<Std::pair<uint16, int> > _freeOnTerminate;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/usecode/uc_stack.cpp b/engines/ultima/ultima8/usecode/uc_stack.cpp
index fad4662..34cb17c 100644
--- a/engines/ultima/ultima8/usecode/uc_stack.cpp
+++ b/engines/ultima/ultima8/usecode/uc_stack.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/usecode/uc_stack.h"
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/odata_source.h"
@@ -30,28 +29,28 @@ namespace Ultima {
namespace Ultima8 {
void UCStack::save(ODataSource *ods) {
- ods->write4(size);
+ ods->write4(_size);
ods->write4(getSP());
- ods->write(buf_ptr, stacksize());
+ ods->write(_bufPtr, stacksize());
}
bool UCStack::load(IDataSource *ids, uint32 version) {
- size = ids->read4();
+ _size = ids->read4();
#ifdef USE_DYNAMIC_UCSTACK
- if (buf) delete[] buf;
- buf = new uint8[size];
+ if (_buf) delete[] _buf;
+ _buf = new uint8[_size];
#else
- if (size > sizeof(buf_array)) {
- perr << "Error: UCStack size mismatch (buf_array too small)" << Std::endl;
+ if (_size > sizeof(buf_array)) {
+ perr << "Error: UCStack _size mismatch (buf_array too small)" << Std::endl;
return false;
}
- buf = buf_array;
+ _buf = buf_array;
#endif
uint32 sp = ids->read4();
- buf_ptr = buf + sp;
+ _bufPtr = _buf + sp;
- ids->read(buf_ptr, size - sp);
+ ids->read(_bufPtr, _size - sp);
return true;
}
diff --git a/engines/ultima/ultima8/usecode/uc_stack.h b/engines/ultima/ultima8/usecode/uc_stack.h
index e4ff734..50f0ee4 100644
--- a/engines/ultima/ultima8/usecode/uc_stack.h
+++ b/engines/ultima/ultima8/usecode/uc_stack.h
@@ -34,35 +34,35 @@ class ODataSource;
// A little-endian stack for use with usecode
class BaseUCStack {
protected:
- uint8 *buf;
- uint8 *buf_ptr;
- uint32 size;
+ uint8 *_buf;
+ uint8 *_bufPtr;
+ uint32 _size;
public:
- BaseUCStack(uint32 len, uint8 *b) : buf(b), size(len) {
+ BaseUCStack(uint32 len, uint8 *b) : _buf(b), _size(len) {
// stack grows downward, so start at the end of the buffer
- buf_ptr = buf + size;
+ _bufPtr = _buf + _size;
}
virtual ~BaseUCStack() { }
inline uint32 getSize() const {
- return size;
+ return _size;
}
inline uint32 stacksize() const {
- return size - (buf_ptr - buf);
+ return _size - (_bufPtr - _buf);
}
inline void addSP(const int32 offset) {
- buf_ptr += offset;
+ _bufPtr += offset;
}
inline unsigned int getSP() const {
- return static_cast<unsigned int>(buf_ptr - buf);
+ return static_cast<unsigned int>(_bufPtr - _buf);
}
inline void setSP(unsigned int pos) {
- buf_ptr = buf + pos;
+ _bufPtr = _buf + pos;
}
//
@@ -70,31 +70,31 @@ public:
//
inline void push1(uint8 val) {
- buf_ptr--;
- buf_ptr[0] = val;
+ _bufPtr--;
+ _bufPtr[0] = val;
}
inline void push2(uint16 val) {
- buf_ptr -= 2;
- buf_ptr[0] = static_cast<uint8>(val & 0xFF);
- buf_ptr[1] = static_cast<uint8>((val >> 8) & 0xFF);
+ _bufPtr -= 2;
+ _bufPtr[0] = static_cast<uint8>(val & 0xFF);
+ _bufPtr[1] = static_cast<uint8>((val >> 8) & 0xFF);
}
inline void push4(uint32 val) {
- buf_ptr -= 4;
- buf_ptr[0] = static_cast<uint8>(val & 0xFF);
- buf_ptr[1] = static_cast<uint8>((val >> 8) & 0xFF);
- buf_ptr[2] = static_cast<uint8>((val >> 16) & 0xFF);
- buf_ptr[3] = static_cast<uint8>((val >> 24) & 0xFF);
+ _bufPtr -= 4;
+ _bufPtr[0] = static_cast<uint8>(val & 0xFF);
+ _bufPtr[1] = static_cast<uint8>((val >> 8) & 0xFF);
+ _bufPtr[2] = static_cast<uint8>((val >> 16) & 0xFF);
+ _bufPtr[3] = static_cast<uint8>((val >> 24) & 0xFF);
}
// Push an arbitrary number of bytes of 0
inline void push0(const uint32 count) {
- buf_ptr -= count;
- Std::memset(buf_ptr, 0, count);
+ _bufPtr -= count;
+ Std::memset(_bufPtr, 0, count);
}
// Push an arbitrary number of bytes
inline void push(const uint8 *in, const uint32 count) {
- buf_ptr -= count;
- Std::memcpy(buf_ptr, in, count);
+ _bufPtr -= count;
+ Std::memcpy(_bufPtr, in, count);
}
//
@@ -103,21 +103,21 @@ public:
inline uint16 pop2() {
uint8 b0, b1;
- b0 = *buf_ptr++;
- b1 = *buf_ptr++;
+ b0 = *_bufPtr++;
+ b1 = *_bufPtr++;
return (b0 | (b1 << 8));
}
inline uint32 pop4() {
uint8 b0, b1, b2, b3;
- b0 = *buf_ptr++;
- b1 = *buf_ptr++;
- b2 = *buf_ptr++;
- b3 = *buf_ptr++;
+ b0 = *_bufPtr++;
+ b1 = *_bufPtr++;
+ b2 = *_bufPtr++;
+ b3 = *_bufPtr++;
return (b0 | (b1 << 8) | (b2 << 16) | (b3 << 24));
}
inline void pop(uint8 *out, const uint32 count) {
- Std::memcpy(out, buf_ptr, count);
- buf_ptr += count;
+ Std::memcpy(out, _bufPtr, count);
+ _bufPtr += count;
}
//
@@ -125,20 +125,20 @@ public:
//
inline uint8 access1(const uint32 offset) const {
- return buf[offset];
+ return _buf[offset];
}
inline uint16 access2(const uint32 offset) const {
- return (buf[offset] | (buf[offset + 1] << 8));
+ return (_buf[offset] | (_buf[offset + 1] << 8));
}
inline uint32 access4(const uint32 offset) const {
- return buf[offset] | (buf[offset + 1] << 8) |
- (buf[offset + 2] << 16) | (buf[offset + 3] << 24);
+ return _buf[offset] | (_buf[offset + 1] << 8) |
+ (_buf[offset + 2] << 16) | (_buf[offset + 3] << 24);
}
inline uint8 *access(const uint32 offset) {
- return buf + offset;
+ return _buf + offset;
}
inline uint8 *access() {
- return buf_ptr;
+ return _bufPtr;
}
//
@@ -146,20 +146,20 @@ public:
//
inline void assign1(const uint32 offset, const uint8 val) {
- const_cast<uint8 *>(buf)[offset] = static_cast<uint8>(val & 0xFF);
+ const_cast<uint8 *>(_buf)[offset] = static_cast<uint8>(val & 0xFF);
}
inline void assign2(const uint32 offset, const uint16 val) {
- const_cast<uint8 *>(buf)[offset] = static_cast<uint8>(val & 0xFF);
- const_cast<uint8 *>(buf)[offset + 1] = static_cast<uint8>((val >> 8) & 0xFF);
+ const_cast<uint8 *>(_buf)[offset] = static_cast<uint8>(val & 0xFF);
+ const_cast<uint8 *>(_buf)[offset + 1] = static_cast<uint8>((val >> 8) & 0xFF);
}
inline void assign4(const uint32 offset, const uint32 val) {
- const_cast<uint8 *>(buf)[offset] = static_cast<uint8>(val & 0xFF);
- const_cast<uint8 *>(buf)[offset + 1] = static_cast<uint8>((val >> 8) & 0xFF);
- const_cast<uint8 *>(buf)[offset + 2] = static_cast<uint8>((val >> 16) & 0xFF);
- const_cast<uint8 *>(buf)[offset + 3] = static_cast<uint8>((val >> 24) & 0xFF);
+ const_cast<uint8 *>(_buf)[offset] = static_cast<uint8>(val & 0xFF);
+ const_cast<uint8 *>(_buf)[offset + 1] = static_cast<uint8>((val >> 8) & 0xFF);
+ const_cast<uint8 *>(_buf)[offset + 2] = static_cast<uint8>((val >> 16) & 0xFF);
+ const_cast<uint8 *>(_buf)[offset + 3] = static_cast<uint8>((val >> 24) & 0xFF);
}
inline void assign(const uint32 offset, const uint8 *in, const uint32 len) {
- Std::memcpy(const_cast<uint8 *>(buf) + offset, in, len);
+ Std::memcpy(const_cast<uint8 *>(_buf) + offset, in, len);
}
};
@@ -167,7 +167,7 @@ class DynamicUCStack : public BaseUCStack {
public:
DynamicUCStack(uint32 len = 0x1000) : BaseUCStack(len, new uint8[len]) { }
~DynamicUCStack() override {
- delete [] buf;
+ delete [] _buf;
}
#ifdef USE_DYNAMIC_UCSTACK
Commit: ee1417a6d3ef51eb8e01dc14548cbc36f78a3138
https://github.com/scummvm/scummvm/commit/ee1417a6d3ef51eb8e01dc14548cbc36f78a3138
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-15T21:39:28-08:00
Commit Message:
ULTIMA8: Renaming filesys folder class fields
Changed paths:
engines/ultima/ultima8/audio/music_flex.cpp
engines/ultima/ultima8/audio/music_flex.h
engines/ultima/ultima8/audio/sound_flex.cpp
engines/ultima/ultima8/audio/sound_flex.h
engines/ultima/ultima8/filesys/archive.cpp
engines/ultima/ultima8/filesys/archive.h
engines/ultima/ultima8/filesys/archive_file.h
engines/ultima/ultima8/filesys/dir_file.cpp
engines/ultima/ultima8/filesys/dir_file.h
engines/ultima/ultima8/filesys/file_system.cpp
engines/ultima/ultima8/filesys/file_system.h
engines/ultima/ultima8/filesys/flex_file.cpp
engines/ultima/ultima8/filesys/flex_file.h
engines/ultima/ultima8/filesys/odata_source.h
engines/ultima/ultima8/filesys/raw_archive.cpp
engines/ultima/ultima8/filesys/raw_archive.h
engines/ultima/ultima8/filesys/u8_save_file.cpp
engines/ultima/ultima8/filesys/u8_save_file.h
engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
engines/ultima/ultima8/graphics/shape_archive.cpp
diff --git a/engines/ultima/ultima8/audio/music_flex.cpp b/engines/ultima/ultima8/audio/music_flex.cpp
index 9a1e77d..c206739 100644
--- a/engines/ultima/ultima8/audio/music_flex.cpp
+++ b/engines/ultima/ultima8/audio/music_flex.cpp
@@ -69,7 +69,7 @@ void MusicFlex::uncache(uint32 index) {
}
bool MusicFlex::isCached(uint32 index) {
- if (index >= count) return false;
+ if (index >= _count) return false;
if (!songs) return false;
return (songs[index] != 0);
diff --git a/engines/ultima/ultima8/audio/music_flex.h b/engines/ultima/ultima8/audio/music_flex.h
index 6b9ec58..92161ef 100644
--- a/engines/ultima/ultima8/audio/music_flex.h
+++ b/engines/ultima/ultima8/audio/music_flex.h
@@ -50,7 +50,7 @@ public:
//! Get an xmidi
XMidiFile *getXMidi(uint32 index) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
cache(index);
return songs[index];
}
diff --git a/engines/ultima/ultima8/audio/sound_flex.cpp b/engines/ultima/ultima8/audio/sound_flex.cpp
index 05898f1..6c223f5 100644
--- a/engines/ultima/ultima8/audio/sound_flex.cpp
+++ b/engines/ultima/ultima8/audio/sound_flex.cpp
@@ -33,23 +33,23 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(SoundFlex, Archive)
SoundFlex::SoundFlex(IDataSource *ds) : Archive(ds) {
- samples = 0;
+ _samples = 0;
}
SoundFlex::~SoundFlex() {
Archive::uncache();
- delete [] samples;
+ delete [] _samples;
}
void SoundFlex::cache(uint32 index) {
- if (index >= count) return;
+ if (index >= _count) return;
- if (!samples) {
- samples = new AudioSample * [count];
- Std::memset(samples, 0, sizeof(AudioSample *) * count);
+ if (!_samples) {
+ _samples = new AudioSample * [_count];
+ Std::memset(_samples, 0, sizeof(AudioSample *) * _count);
}
- if (samples[index]) return;
+ if (_samples[index]) return;
// This will cache the data
uint32 size;
@@ -57,22 +57,22 @@ void SoundFlex::cache(uint32 index) {
if (!buf || !size) return;
- samples[index] = new SonarcAudioSample(buf, size);
+ _samples[index] = new SonarcAudioSample(buf, size);
}
void SoundFlex::uncache(uint32 index) {
- if (index >= count) return;
- if (!samples) return;
+ if (index >= _count) return;
+ if (!_samples) return;
- delete samples[index];
- samples[index] = 0;
+ delete _samples[index];
+ _samples[index] = 0;
}
bool SoundFlex::isCached(uint32 index) {
- if (index >= count) return false;
- if (!samples) return false;
+ if (index >= _count) return false;
+ if (!_samples) return false;
- return (samples[index] != 0);
+ return (_samples[index] != 0);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/audio/sound_flex.h b/engines/ultima/ultima8/audio/sound_flex.h
index 6476177..c0e034b 100644
--- a/engines/ultima/ultima8/audio/sound_flex.h
+++ b/engines/ultima/ultima8/audio/sound_flex.h
@@ -40,9 +40,9 @@ public:
//! Get an audiosample
AudioSample *getSample(uint32 index) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
cache(index);
- return samples[index];
+ return _samples[index];
}
void cache(uint32 index) override;
@@ -50,7 +50,7 @@ public:
bool isCached(uint32 index) override;
private:
- AudioSample **samples;
+ AudioSample **_samples;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/filesys/archive.cpp b/engines/ultima/ultima8/filesys/archive.cpp
index 991d86b..a405df4 100644
--- a/engines/ultima/ultima8/filesys/archive.cpp
+++ b/engines/ultima/ultima8/filesys/archive.cpp
@@ -21,7 +21,6 @@
*/
#include "ultima/ultima8/misc/pent_include.h"
-
#include "ultima/ultima8/filesys/archive.h"
#include "ultima/ultima8/filesys/idata_source.h"
#include "ultima/ultima8/filesys/archive_file.h"
@@ -37,36 +36,36 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(NamedArchiveFile, ArchiveFile)
DEFINE_RUNTIME_CLASSTYPE_CODE_BASE_CLASS(Archive)
Archive::Archive() {
- count = 0;
+ _count = 0;
}
Archive::~Archive() {
- for (unsigned int i = 0; i < sources.size(); ++i)
- delete sources[i];
- sources.clear();
+ for (unsigned int i = 0; i < _sources.size(); ++i)
+ delete _sources[i];
+ _sources.clear();
}
Archive::Archive(ArchiveFile *af) {
- count = 0;
+ _count = 0;
addSource(af);
}
Archive::Archive(IDataSource *ids) {
- count = 0;
+ _count = 0;
addSource(ids);
}
Archive::Archive(const Std::string &path) {
- count = 0;
+ _count = 0;
addSource(path);
}
bool Archive::addSource(ArchiveFile *af) {
- sources.push_back(af);
+ _sources.push_back(af);
uint32 indexcount = af->getIndexCount();
- if (indexcount > count) count = indexcount;
+ if (indexcount > _count) _count = indexcount;
return true;
}
@@ -102,12 +101,12 @@ bool Archive::addSource(const Std::string &path) {
}
void Archive::cache() {
- for (unsigned int i = 0; i < count; ++i)
+ for (unsigned int i = 0; i < _count; ++i)
cache(i);
}
void Archive::uncache() {
- for (unsigned int i = 0; i < count; ++i)
+ for (unsigned int i = 0; i < _count; ++i)
uncache(i);
}
@@ -126,10 +125,10 @@ uint32 Archive::getRawSize(uint32 index) {
}
ArchiveFile *Archive::findArchiveFile(uint32 index) {
- unsigned int n = sources.size();
+ unsigned int n = _sources.size();
for (unsigned int i = 1; i <= n; ++i) {
- if (sources[n - i]->exists(index))
- return sources[n - i];
+ if (_sources[n - i]->exists(index))
+ return _sources[n - i];
}
return 0;
diff --git a/engines/ultima/ultima8/filesys/archive.h b/engines/ultima/ultima8/filesys/archive.h
index a914865..87a6509 100644
--- a/engines/ultima/ultima8/filesys/archive.h
+++ b/engines/ultima/ultima8/filesys/archive.h
@@ -85,17 +85,17 @@ public:
virtual bool isCached(uint32 index) = 0;
uint32 getCount() const {
- return count;
+ return _count;
}
protected:
- uint32 count;
+ uint32 _count;
uint8 *getRawObject(uint32 index, uint32 *sizep = 0);
uint32 getRawSize(uint32 index);
private:
- Std::vector<ArchiveFile *> sources;
+ Std::vector<ArchiveFile *> _sources;
ArchiveFile *findArchiveFile(uint32 index);
};
diff --git a/engines/ultima/ultima8/filesys/archive_file.h b/engines/ultima/ultima8/filesys/archive_file.h
index ef912b9..9bc352a 100644
--- a/engines/ultima/ultima8/filesys/archive_file.h
+++ b/engines/ultima/ultima8/filesys/archive_file.h
@@ -39,7 +39,7 @@ public:
//! Check if constructed object is indeed a valid archive
virtual bool isValid() const {
- return valid;
+ return _valid;
}
//! Check if numbered object exists
@@ -107,7 +107,7 @@ public:
protected:
static bool extractIndexFromName(const Std::string &name, uint32 &index);
- bool valid;
+ bool _valid;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/filesys/dir_file.cpp b/engines/ultima/ultima8/filesys/dir_file.cpp
index a06ec19..9b7d00c 100644
--- a/engines/ultima/ultima8/filesys/dir_file.cpp
+++ b/engines/ultima/ultima8/filesys/dir_file.cpp
@@ -31,16 +31,16 @@ namespace Ultima8 {
DEFINE_RUNTIME_CLASSTYPE_CODE(DirFile, NamedArchiveFile)
-DirFile::DirFile(const Std::string &path_) {
- path = path_;
- if (path.size() == 0) {
- valid = false;
+DirFile::DirFile(const Std::string &path) {
+ _path = path;
+ if (_path.size() == 0) {
+ _valid = false;
return;
}
- if (path[path.size() - 1] != '/') path += "/";
+ if (_path[_path.size() - 1] != '/') _path += "/";
- valid = readMetadata();
+ _valid = readMetadata();
}
@@ -52,11 +52,11 @@ bool DirFile::readMetadata() {
FileSystem *filesys = FileSystem::get_instance();
FileSystem::FileList files;
- /*int ret =*/ filesys->ListFiles(path + "*", files);
+ /*int ret =*/ filesys->ListFiles(_path + "*", files);
// TODO: check if directory actually exists
- count = files.size();
+ _count = files.size();
FileSystem::FileList::iterator iter;
@@ -75,7 +75,7 @@ bool DirFile::readMetadata() {
bool DirFile::exists(const Std::string &name) {
FileSystem *filesys = FileSystem::get_instance();
- IDataSource *ids = filesys->ReadFile(path + name);
+ IDataSource *ids = filesys->ReadFile(_path + name);
if (!ids) return false;
delete ids;
@@ -84,7 +84,7 @@ bool DirFile::exists(const Std::string &name) {
uint32 DirFile::getSize(const Std::string &name) {
FileSystem *filesys = FileSystem::get_instance();
- IDataSource *ids = filesys->ReadFile(path + name);
+ IDataSource *ids = filesys->ReadFile(_path + name);
if (!ids) return 0;
uint32 size = ids->getSize();
@@ -94,7 +94,7 @@ uint32 DirFile::getSize(const Std::string &name) {
uint8 *DirFile::getObject(const Std::string &name, uint32 *sizep) {
FileSystem *filesys = FileSystem::get_instance();
- IDataSource *ids = filesys->ReadFile(path + name);
+ IDataSource *ids = filesys->ReadFile(_path + name);
if (!ids) return 0;
uint32 size = ids->getSize();
diff --git a/engines/ultima/ultima8/filesys/dir_file.h b/engines/ultima/ultima8/filesys/dir_file.h
index c309b83..46c478c 100644
--- a/engines/ultima/ultima8/filesys/dir_file.h
+++ b/engines/ultima/ultima8/filesys/dir_file.h
@@ -45,14 +45,14 @@ public:
uint32 getSize(const Std::string &name) override;
uint32 getCount() override {
- return count;
+ return _count;
}
protected:
bool readMetadata();
- Std::string path;
- uint32 count;
+ Std::string _path;
+ uint32 _count;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/filesys/file_system.cpp b/engines/ultima/ultima8/filesys/file_system.cpp
index 9b8b505..f1573fb 100644
--- a/engines/ultima/ultima8/filesys/file_system.cpp
+++ b/engines/ultima/ultima8/filesys/file_system.cpp
@@ -33,20 +33,20 @@ namespace Ultima8 {
using Std::string;
-FileSystem *FileSystem::filesystem = 0;
+FileSystem *FileSystem::_fileSystem = 0;
FileSystem::FileSystem(bool noforced)
- : noforcedvpaths(noforced), allowdataoverride(true) {
+ : _noForcedVPaths(noforced), _allowDataOverride(true) {
con->Print(MM_INFO, "Creating FileSystem...\n");
- filesystem = this;
+ _fileSystem = this;
AddVirtualPath("@home", "");
}
FileSystem::~FileSystem() {
con->Print(MM_INFO, "Destroying FileSystem...\n");
- filesystem = 0;
+ _fileSystem = 0;
}
@@ -57,7 +57,7 @@ IDataSource *FileSystem::ReadFile(const string &vfn, bool is_text) {
IDataSource *data = checkBuiltinData(vfn, is_text);
// allow data-override?
- if (!allowdataoverride && data)
+ if (!_allowDataOverride && data)
return data;
Common::SeekableReadStream *readStream;
@@ -238,7 +238,7 @@ bool FileSystem::AddVirtualPath(const string &vpath, const string &realpath, con
}
}
- virtualpaths[vp] = rp;
+ _virtualPaths[vp] = rp;
return true;
}
@@ -249,12 +249,12 @@ bool FileSystem::RemoveVirtualPath(const string &vpath) {
if (vp.rfind('/') == vp.size() - 1)
vp.erase(vp.rfind('/'));
- Std::map<Common::String, string>::iterator i = virtualpaths.find(vp);
+ Std::map<Common::String, string>::iterator i = _virtualPaths.find(vp);
- if (i == virtualpaths.end()) {
+ if (i == _virtualPaths.end()) {
return false;
} else {
- virtualpaths.erase(vp);
+ _virtualPaths.erase(vp);
return true;
}
}
@@ -264,8 +264,8 @@ IDataSource *FileSystem::checkBuiltinData(const Std::string &vfn, bool is_text)
Std::map<Common::String, MemoryFile *>::iterator mf = memoryfiles.find(vfn);
if (mf != memoryfiles.end())
- return new IBufferDataSource(mf->_value->data,
- mf->_value->len, is_text);
+ return new IBufferDataSource(mf->_value->_data,
+ mf->_value->_len, is_text);
return 0;
}
@@ -276,10 +276,10 @@ bool FileSystem::rewrite_virtual_path(string &vfn) {
while ((pos = vfn.rfind('/', pos)) != Std::string::npos) {
// perr << vfn << ", " << vfn.substr(0, pos) << ", " << pos << Std::endl;
- Std::map<Common::String, string>::iterator p = virtualpaths.find(
+ Std::map<Common::String, string>::iterator p = _virtualPaths.find(
vfn.substr(0, pos));
- if (p != virtualpaths.end()) {
+ if (p != _virtualPaths.end()) {
ret = true;
// rewrite first part of path
vfn = p->_value + vfn.substr(pos + 1);
@@ -292,7 +292,7 @@ bool FileSystem::rewrite_virtual_path(string &vfn) {
}
// We will allow all paths to work
- if (noforcedvpaths) ret = true;
+ if (_noForcedVPaths) ret = true;
return ret;
}
diff --git a/engines/ultima/ultima8/filesys/file_system.h b/engines/ultima/ultima8/filesys/file_system.h
index 333b392..c618736 100644
--- a/engines/ultima/ultima8/filesys/file_system.h
+++ b/engines/ultima/ultima8/filesys/file_system.h
@@ -41,7 +41,7 @@ public:
void initBuiltinData(bool allowoverride);
static FileSystem *get_instance() {
- return filesystem;
+ return _fileSystem;
}
//! Get the current users pentagram home path
@@ -91,7 +91,7 @@ private:
static bool IsDir(const Std::string &path);
- static FileSystem *filesystem;
+ static FileSystem *_fileSystem;
/**
* Open a file for reading,
@@ -107,26 +107,26 @@ private:
// This will disable the usage of forced virtual paths.
// It's useful for 'tools'
- bool noforcedvpaths;
+ bool _noForcedVPaths;
// This enables/disables overriding builtin data files with external ones
- bool allowdataoverride;
+ bool _allowDataOverride;
// rewrite virtual path in-place (i.e., fvn is replaced)
// returns false if no rewriting was done
bool rewrite_virtual_path(Std::string &vfn);
- Std::map<Common::String, Std::string> virtualpaths;
+ Std::map<Common::String, Std::string> _virtualPaths;
//! Check if the given file is a builtin data file.
//! If so, return an IDataSource for it. If not, return 0.
IDataSource *checkBuiltinData(const Std::string &vfn, bool is_text = false);
struct MemoryFile {
- MemoryFile(const uint8 *_data, const uint32 _len)
- : data(_data), len(_len) { }
- const uint8 *data;
- const uint32 len;
+ MemoryFile(const uint8 *data, const uint32 len)
+ : _data(data), _len(len) { }
+ const uint8 *_data;
+ const uint32 _len;
};
Std::map<Common::String, MemoryFile *> memoryfiles; // Files mounted in memory
};
diff --git a/engines/ultima/ultima8/filesys/flex_file.cpp b/engines/ultima/ultima8/filesys/flex_file.cpp
index 7385094..06b9462 100644
--- a/engines/ultima/ultima8/filesys/flex_file.cpp
+++ b/engines/ultima/ultima8/filesys/flex_file.cpp
@@ -32,26 +32,26 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(FlexFile, ArchiveFile)
FlexFile::FlexFile(IDataSource *ds_) {
- ds = ds_;
- count = 0;
- valid = isFlexFile(ds);
+ _ds = ds_;
+ _count = 0;
+ _valid = isFlexFile(_ds);
- if (valid) {
- ds->seek(0x54);
- count = ds->read4();
+ if (_valid) {
+ _ds->seek(0x54);
+ _count = _ds->read4();
}
}
FlexFile::~FlexFile() {
- delete ds;
+ delete _ds;
}
//static
-bool FlexFile::isFlexFile(IDataSource *ds) {
- ds->seek(0);
+bool FlexFile::isFlexFile(IDataSource *_ds) {
+ _ds->seek(0);
int i;
char buf[0x52];
- ds->read(buf, 0x52);
+ _ds->read(buf, 0x52);
for (i = 0; i < 0x52; ++i) {
if (buf[i] == 0x1A) break;
@@ -67,12 +67,12 @@ bool FlexFile::isFlexFile(IDataSource *ds) {
}
uint32 FlexFile::getOffset(uint32 index) {
- ds->seek(0x80 + 8 * index);
- return ds->read4();
+ _ds->seek(0x80 + 8 * index);
+ return _ds->read4();
}
uint8 *FlexFile::getObject(uint32 index, uint32 *sizep) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
uint32 size = getSize(index);
if (size == 0) return 0;
@@ -80,8 +80,8 @@ uint8 *FlexFile::getObject(uint32 index, uint32 *sizep) {
uint8 *object = new uint8[size];
uint32 offset = getOffset(index);
- ds->seek(offset);
- ds->read(object, size);
+ _ds->seek(offset);
+ _ds->read(object, size);
if (sizep) *sizep = size;
@@ -89,10 +89,10 @@ uint8 *FlexFile::getObject(uint32 index, uint32 *sizep) {
}
uint32 FlexFile::getSize(uint32 index) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
- ds->seek(0x84 + 8 * index);
- uint32 length = ds->read4();
+ _ds->seek(0x84 + 8 * index);
+ uint32 length = _ds->read4();
return length;
}
diff --git a/engines/ultima/ultima8/filesys/flex_file.h b/engines/ultima/ultima8/filesys/flex_file.h
index f1e291d..edd0ac4 100644
--- a/engines/ultima/ultima8/filesys/flex_file.h
+++ b/engines/ultima/ultima8/filesys/flex_file.h
@@ -71,11 +71,11 @@ public:
}
uint32 getCount() override {
- return count;
+ return _count;
}
uint32 getIndexCount() override {
- return count;
+ return _count;
}
bool isIndexed() const override {
@@ -90,8 +90,8 @@ public:
protected:
bool nameToIndex(const Std::string &name, uint32 &index);
- IDataSource *ds;
- uint32 count;
+ IDataSource *_ds;
+ uint32 _count;
private:
uint32 getOffset(uint32 index);
diff --git a/engines/ultima/ultima8/filesys/odata_source.h b/engines/ultima/ultima8/filesys/odata_source.h
index 542520f..4af11a9 100644
--- a/engines/ultima/ultima8/filesys/odata_source.h
+++ b/engines/ultima/ultima8/filesys/odata_source.h
@@ -153,77 +153,77 @@ public:
class OBufferDataSource: public ODataSource {
protected:
- uint8 *buf;
- uint8 *buf_ptr;
- uint32 size;
+ uint8 *_buf;
+ uint8 *_bufPtr;
+ uint32 _size;
public:
OBufferDataSource(void *data, uint32 len) {
assert(data == 0 || len == 0);
- buf = buf_ptr = reinterpret_cast<uint8 *>(data);
- size = len;
+ _buf = _bufPtr = reinterpret_cast<uint8 *>(data);
+ _size = len;
};
void load(char *data, uint32 len) {
assert(data == 0 || len == 0);
- buf = buf_ptr = reinterpret_cast<uint8 *>(data);
- size = len;
+ _buf = _bufPtr = reinterpret_cast<uint8 *>(data);
+ _size = len;
};
~OBufferDataSource() override {};
void write1(uint32 val) override {
- *buf_ptr++ = val & 0xff;
+ *_bufPtr++ = val & 0xff;
};
void write2(uint16 val) override {
- *buf_ptr++ = val & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
};
void write2high(uint16 val) override {
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = val & 0xff;
};
void write3(uint32 val) override {
- *buf_ptr++ = val & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = (val >> 16) & 0xff;
+ *_bufPtr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = (val >> 16) & 0xff;
};
void write4(uint32 val) override {
- *buf_ptr++ = val & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = (val >> 16) & 0xff;
- *buf_ptr++ = (val >> 24) & 0xff;
+ *_bufPtr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = (val >> 16) & 0xff;
+ *_bufPtr++ = (val >> 24) & 0xff;
};
void write4high(uint32 val) override {
- *buf_ptr++ = (val >> 24) & 0xff;
- *buf_ptr++ = (val >> 16) & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = val & 0xff;
+ *_bufPtr++ = (val >> 24) & 0xff;
+ *_bufPtr++ = (val >> 16) & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = val & 0xff;
};
void write(const void *b, uint32 len) override {
- Common::copy((const byte *)b, (const byte *)b + len, buf_ptr);
- buf_ptr += len;
+ Common::copy((const byte *)b, (const byte *)b + len, _bufPtr);
+ _bufPtr += len;
};
void seek(uint32 pos) override {
- buf_ptr = const_cast<unsigned char *>(buf) + pos;
+ _bufPtr = const_cast<unsigned char *>(_buf) + pos;
};
void skip(int32 pos) override {
- buf_ptr += pos;
+ _bufPtr += pos;
};
uint32 getSize() const override {
- return size;
+ return _size;
};
uint32 getPos() const override {
- return static_cast<uint32>(buf_ptr - buf);
+ return static_cast<uint32>(_bufPtr - _buf);
};
};
@@ -308,143 +308,143 @@ public:
class OAutoBufferDataSource: public ODataSource {
protected:
- uint8 *buf;
- uint8 *buf_ptr;
- uint32 size;
- uint32 loc;
- uint32 allocated;
+ uint8 *_buf;
+ uint8 *_bufPtr;
+ uint32 _size;
+ uint32 _loc;
+ uint32 _allocated;
void checkResize(uint32 num_bytes) {
// Increment loc
- loc += num_bytes;
+ _loc += num_bytes;
// Don't need to resize
- if (loc <= size) return;
+ if (_loc <= _size) return;
// Reallocate the buffer
- if (loc > allocated) {
+ if (_loc > _allocated) {
// The old pointer position
- uint32 pos = static_cast<uint32>(buf_ptr - buf);
+ uint32 pos = static_cast<uint32>(_bufPtr - _buf);
// The new buffer and size (2 times what is needed)
- allocated = loc * 2;
- uint8 *new_buf = new uint8[allocated];
+ _allocated = _loc * 2;
+ uint8 *new_buf = new uint8[_allocated];
- memcpy(new_buf, buf, size);
- delete [] buf;
+ memcpy(new_buf, _buf, _size);
+ delete [] _buf;
- buf = new_buf;
- buf_ptr = buf + pos;
+ _buf = new_buf;
+ _bufPtr = _buf + pos;
}
// Update size
- size = loc;
+ _size = _loc;
}
public:
OAutoBufferDataSource(uint32 initial_len) {
- allocated = initial_len;
- size = 0;
+ _allocated = initial_len;
+ _size = 0;
// Make the min allocated size 16 bytes
- if (allocated < 16) allocated = 16;
- buf = buf_ptr = new uint8[allocated];
- loc = 0;
+ if (_allocated < 16)
+ _allocated = 16;
+ _buf = _bufPtr = new uint8[_allocated];
+ _loc = 0;
};
//! Get a pointer to the data buffer.
const uint8 *getBuf() {
- return buf;
+ return _buf;
}
~OAutoBufferDataSource() override {
- delete [] buf_ptr;
+ delete [] _bufPtr;
}
void write1(uint32 val) override {
checkResize(1);
- *buf_ptr++ = val & 0xff;
+ *_bufPtr++ = val & 0xff;
};
void write2(uint16 val) override {
checkResize(2);
- *buf_ptr++ = val & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
};
void write2high(uint16 val) override {
checkResize(2);
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = val & 0xff;
};
void write3(uint32 val) override {
checkResize(3);
- *buf_ptr++ = val & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = (val >> 16) & 0xff;
+ *_bufPtr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = (val >> 16) & 0xff;
};
void write4(uint32 val) override {
checkResize(4);
- *buf_ptr++ = val & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = (val >> 16) & 0xff;
- *buf_ptr++ = (val >> 24) & 0xff;
+ *_bufPtr++ = val & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = (val >> 16) & 0xff;
+ *_bufPtr++ = (val >> 24) & 0xff;
};
void write4high(uint32 val) override {
checkResize(4);
- *buf_ptr++ = (val >> 24) & 0xff;
- *buf_ptr++ = (val >> 16) & 0xff;
- *buf_ptr++ = (val >> 8) & 0xff;
- *buf_ptr++ = val & 0xff;
+ *_bufPtr++ = (val >> 24) & 0xff;
+ *_bufPtr++ = (val >> 16) & 0xff;
+ *_bufPtr++ = (val >> 8) & 0xff;
+ *_bufPtr++ = val & 0xff;
};
void write(const void *b, uint32 len) override {
checkResize(len);
- Common::copy((const byte *)b, (const byte *)b + len, buf_ptr);
- buf_ptr += len;
+ Common::copy((const byte *)b, (const byte *)b + len, _bufPtr);
+ _bufPtr += len;
};
void seek(uint32 pos) override {
// No seeking past the end of the buffer
- if (pos <= size) loc = pos;
- else loc = size;
+ if (pos <= _size) _loc = pos;
+ else _loc = _size;
- buf_ptr = const_cast<unsigned char *>(buf) + loc;
+ _bufPtr = const_cast<unsigned char *>(_buf) + _loc;
};
void skip(int32 pos) override {
// No seeking past the end
if (pos >= 0) {
- loc += pos;
- if (loc > size) loc = size;
+ _loc += pos;
+ if (_loc > _size) _loc = _size;
}
// No seeking past the start
else {
uint32 invpos = -pos;
- if (invpos > loc) invpos = loc;
- loc -= invpos;
+ if (invpos > _loc) invpos = _loc;
+ _loc -= invpos;
}
- buf_ptr = const_cast<unsigned char *>(buf) + loc;
+ _bufPtr = const_cast<unsigned char *>(_buf) + _loc;
};
uint32 getSize() const override {
- return size;
+ return _size;
};
uint32 getPos() const override {
- return static_cast<uint32>(buf_ptr - buf);
+ return static_cast<uint32>(_bufPtr - _buf);
};
// Don't actually do anything substantial
virtual void clear() {
- buf_ptr = buf;
- size = 0;
- loc = 0;
+ _bufPtr = _buf;
+ _size = 0;
+ _loc = 0;
}
-
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/filesys/raw_archive.cpp b/engines/ultima/ultima8/filesys/raw_archive.cpp
index 7cdc366..d5874ae 100644
--- a/engines/ultima/ultima8/filesys/raw_archive.cpp
+++ b/engines/ultima/ultima8/filesys/raw_archive.cpp
@@ -36,46 +36,46 @@ RawArchive::~RawArchive() {
}
void RawArchive::cache(uint32 index) {
- if (index >= count) return;
- if (objects.empty()) objects.resize(count);
+ if (index >= _count) return;
+ if (_objects.empty()) _objects.resize(_count);
- if (objects[index]) return;
+ if (_objects[index]) return;
- objects[index] = getRawObject(index);
+ _objects[index] = getRawObject(index);
}
void RawArchive::uncache(uint32 index) {
- if (index >= count) return;
- if (objects.empty()) return;
+ if (index >= _count) return;
+ if (_objects.empty()) return;
- if (objects[index]) {
- delete[] objects[index];
- objects[index] = 0;
+ if (_objects[index]) {
+ delete[] _objects[index];
+ _objects[index] = 0;
}
}
bool RawArchive::isCached(uint32 index) {
- if (index >= count) return false;
- if (objects.empty()) return false;
+ if (index >= _count) return false;
+ if (_objects.empty()) return false;
- return (objects[index] != 0);
+ return (_objects[index] != 0);
}
const uint8 *RawArchive::get_object_nodel(uint32 index) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
cache(index);
- return objects[index];
+ return _objects[index];
}
uint8 *RawArchive::get_object(uint32 index) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
- if (index < objects.size() && objects[index]) {
+ if (index < _objects.size() && _objects[index]) {
// already cached
uint32 size = getRawSize(index);
if (size == 0) return 0;
uint8 *object = new uint8[size];
- Std::memcpy(object, objects[index], size);
+ Std::memcpy(object, _objects[index], size);
return object;
}
@@ -83,17 +83,17 @@ uint8 *RawArchive::get_object(uint32 index) {
}
uint32 RawArchive::get_size(uint32 index) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
return getRawSize(index);
}
IDataSource *RawArchive::get_datasource(uint32 index) {
- if (index >= count) return 0;
+ if (index >= _count) return 0;
cache(index);
- if (!objects[index]) return 0;
+ if (!_objects[index]) return 0;
- return new IBufferDataSource(objects[index], getRawSize(index));
+ return new IBufferDataSource(_objects[index], getRawSize(index));
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/filesys/raw_archive.h b/engines/ultima/ultima8/filesys/raw_archive.h
index 6b60193..d1ca3a3 100644
--- a/engines/ultima/ultima8/filesys/raw_archive.h
+++ b/engines/ultima/ultima8/filesys/raw_archive.h
@@ -61,7 +61,7 @@ public:
virtual IDataSource *get_datasource(uint32 index);
protected:
- Std::vector<uint8 *> objects;
+ Std::vector<uint8 *> _objects;
};
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/filesys/u8_save_file.cpp b/engines/ultima/ultima8/filesys/u8_save_file.cpp
index 3d03822..66f9e50 100644
--- a/engines/ultima/ultima8/filesys/u8_save_file.cpp
+++ b/engines/ultima/ultima8/filesys/u8_save_file.cpp
@@ -32,46 +32,46 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(U8SaveFile, NamedArchiveFile)
U8SaveFile::U8SaveFile(IDataSource *ds_) {
- ds = ds_;
- count = 0;
- valid = isU8SaveFile(ds);
+ _ds = ds_;
+ _count = 0;
+ _valid = isU8SaveFile(_ds);
- if (valid)
- valid = readMetadata();
+ if (_valid)
+ _valid = readMetadata();
}
U8SaveFile::~U8SaveFile() {
- delete ds;
+ delete _ds;
}
//static
-bool U8SaveFile::isU8SaveFile(IDataSource *ds) {
- ds->seek(0);
+bool U8SaveFile::isU8SaveFile(IDataSource *_ds) {
+ _ds->seek(0);
char buf[24];
- ds->read(buf, 23);
+ _ds->read(buf, 23);
buf[23] = '\0';
return (Std::strncmp(buf, "Ultima 8 SaveGame File.", 23) == 0);
}
bool U8SaveFile::readMetadata() {
- ds->seek(0x18);
- count = ds->read2();
+ _ds->seek(0x18);
+ _count = _ds->read2();
- offsets.resize(count);
- sizes.resize(count);
+ _offsets.resize(_count);
+ _sizes.resize(_count);
- for (unsigned int i = 0; i < count; ++i) {
- uint32 namelen = ds->read4();
+ for (unsigned int i = 0; i < _count; ++i) {
+ uint32 namelen = _ds->read4();
char *buf = new char[namelen];
- ds->read(buf, static_cast<int32>(namelen));
+ _ds->read(buf, static_cast<int32>(namelen));
Std::string filename = buf;
- indices[filename] = i;
+ _indices[filename] = i;
storeIndexedName(filename);
delete[] buf;
- sizes[i] = ds->read4();
- offsets[i] = ds->getPos();
- ds->skip(sizes[i]); // skip data
+ _sizes[i] = _ds->read4();
+ _offsets[i] = _ds->getPos();
+ _ds->skip(_sizes[i]); // skip data
}
return true;
@@ -79,8 +79,8 @@ bool U8SaveFile::readMetadata() {
bool U8SaveFile::findIndex(const Std::string &name, uint32 &index) {
Std::map<Common::String, uint32>::iterator iter;
- iter = indices.find(name);
- if (iter == indices.end()) return false;
+ iter = _indices.find(name);
+ if (iter == _indices.end()) return false;
index = iter->_value;
return true;
}
@@ -94,14 +94,14 @@ uint8 *U8SaveFile::getObject(const Std::string &name, uint32 *sizep) {
uint32 index;
if (!findIndex(name, index)) return 0;
- uint32 size = sizes[index];
+ uint32 size = _sizes[index];
if (size == 0) return 0;
uint8 *object = new uint8[size];
- uint32 offset = offsets[index];
+ uint32 offset = _offsets[index];
- ds->seek(offset);
- ds->read(object, size);
+ _ds->seek(offset);
+ _ds->read(object, size);
if (sizep) *sizep = size;
@@ -113,7 +113,7 @@ uint32 U8SaveFile::getSize(const Std::string &name) {
uint32 index;
if (!findIndex(name, index)) return 0;
- return sizes[index];
+ return _sizes[index];
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/filesys/u8_save_file.h b/engines/ultima/ultima8/filesys/u8_save_file.h
index 37e931f..a670e9b 100644
--- a/engines/ultima/ultima8/filesys/u8_save_file.h
+++ b/engines/ultima/ultima8/filesys/u8_save_file.h
@@ -48,18 +48,18 @@ public:
uint32 getSize(const Std::string &name) override;
uint32 getCount() override {
- return count;
+ return _count;
}
static bool isU8SaveFile(IDataSource *ds);
protected:
- IDataSource *ds;
- uint32 count;
+ IDataSource *_ds;
+ uint32 _count;
- Std::map<Common::String, uint32> indices;
- Std::vector<uint32> offsets;
- Std::vector<uint32> sizes;
+ Std::map<Common::String, uint32> _indices;
+ Std::vector<uint32> _offsets;
+ Std::vector<uint32> _sizes;
private:
bool readMetadata();
diff --git a/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp b/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
index f8490bb..3ba4295 100644
--- a/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/font_shape_archive.cpp
@@ -37,8 +37,8 @@ ShapeFont *FontShapeArchive::getFont(uint32 fontnum) {
}
void FontShapeArchive::cache(uint32 shapenum) {
- if (shapenum >= count) return;
- if (shapes.empty()) shapes.resize(count);
+ if (shapenum >= _count) return;
+ if (shapes.empty()) shapes.resize(_count);
if (shapes[shapenum]) return;
diff --git a/engines/ultima/ultima8/graphics/shape_archive.cpp b/engines/ultima/ultima8/graphics/shape_archive.cpp
index af87b24..a2fb95f 100644
--- a/engines/ultima/ultima8/graphics/shape_archive.cpp
+++ b/engines/ultima/ultima8/graphics/shape_archive.cpp
@@ -37,15 +37,15 @@ ShapeArchive::~ShapeArchive() {
}
Shape *ShapeArchive::getShape(uint32 shapenum) {
- if (shapenum >= count) return 0;
+ if (shapenum >= _count) return 0;
cache(shapenum);
return shapes[shapenum];
}
void ShapeArchive::cache(uint32 shapenum) {
- if (shapenum >= count) return;
- if (shapes.empty()) shapes.resize(count);
+ if (shapenum >= _count) return;
+ if (shapes.empty()) shapes.resize(_count);
if (shapes[shapenum]) return;
@@ -73,7 +73,7 @@ void ShapeArchive::cache(uint32 shapenum) {
}
void ShapeArchive::uncache(uint32 shapenum) {
- if (shapenum >= count) return;
+ if (shapenum >= _count) return;
if (shapes.empty()) return;
delete shapes[shapenum];
@@ -81,7 +81,7 @@ void ShapeArchive::uncache(uint32 shapenum) {
}
bool ShapeArchive::isCached(uint32 shapenum) {
- if (shapenum >= count) return false;
+ if (shapenum >= _count) return false;
if (shapes.empty()) return false;
return (shapes[shapenum] != 0);
Commit: c9f59c8008094895619d52f146cda73253e0ce89
https://github.com/scummvm/scummvm/commit/c9f59c8008094895619d52f146cda73253e0ce89
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-15T21:39:28-08:00
Commit Message:
ULTIMA8: Miscellaneous graphics and gumps field changes
Changed paths:
engines/ultima/ultima8/convert/convert_shape.cpp
engines/ultima/ultima8/convert/convert_shape.h
engines/ultima/ultima8/graphics/fonts/jp_font.cpp
engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/shape_font.cpp
engines/ultima/ultima8/graphics/shape.cpp
engines/ultima/ultima8/graphics/shape_archive.cpp
engines/ultima/ultima8/graphics/shape_frame.cpp
engines/ultima/ultima8/graphics/shape_frame.h
engines/ultima/ultima8/graphics/soft_render_surface.inl
engines/ultima/ultima8/gumps/book_gump.cpp
engines/ultima/ultima8/gumps/container_gump.cpp
engines/ultima/ultima8/gumps/gump.cpp
engines/ultima/ultima8/gumps/menu_gump.cpp
engines/ultima/ultima8/gumps/mini_stats_gump.cpp
engines/ultima/ultima8/gumps/paged_gump.cpp
engines/ultima/ultima8/gumps/paperdoll_gump.cpp
engines/ultima/ultima8/gumps/quit_gump.cpp
engines/ultima/ultima8/gumps/readable_gump.cpp
engines/ultima/ultima8/gumps/scroll_gump.cpp
engines/ultima/ultima8/gumps/slider_gump.cpp
engines/ultima/ultima8/gumps/u8_save_gump.cpp
engines/ultima/ultima8/gumps/widgets/button_widget.cpp
engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
engines/ultima/ultima8/world/item_sorter.cpp
diff --git a/engines/ultima/ultima8/convert/convert_shape.cpp b/engines/ultima/ultima8/convert/convert_shape.cpp
index b24fcd7..28e291a 100644
--- a/engines/ultima/ultima8/convert/convert_shape.cpp
+++ b/engines/ultima/ultima8/convert/convert_shape.cpp
@@ -40,12 +40,12 @@ void ConvertShape::Read(IDataSource *source, const ConvertShapeFormat *csf, uint
uint32 start_pos = source->getPos();
// Read the ident
- if (csf->bytes_ident)
+ if (csf->_bytes_ident)
{
char ident[4];
- source->read(ident, csf->bytes_ident);
+ source->read(ident, csf->_bytes_ident);
- if (Std::memcmp (ident, csf->ident, csf->bytes_ident))
+ if (Std::memcmp (ident, csf->_ident, csf->_bytes_ident))
{
perr << "Warning: Corrupt shape!" << Std::endl;
return;
@@ -54,80 +54,80 @@ void ConvertShape::Read(IDataSource *source, const ConvertShapeFormat *csf, uint
// Read special buffer
uint8 special[256];
- if (csf->bytes_special) {
+ if (csf->_bytes_special) {
memset(special, 0, 256);
- for (uint32 i = 0; i < csf->bytes_special; i++) special[source->read1()&0xFF] = i+2;
+ for (uint32 i = 0; i < csf->_bytes_special; i++) special[source->read1()&0xFF] = i+2;
}
// Read the header unknown
- if (csf->bytes_header_unk) source->read(header_unknown, csf->bytes_header_unk);
+ if (csf->_bytes_header_unk) source->read(_header_unknown, csf->_bytes_header_unk);
#ifdef COMP_SHAPENUM
if (shapenum == COMP_SHAPENUM) pout << Std::hex;
#endif
- // Now read num_frames
- num_frames = 1;
- if (csf->bytes_num_frames) num_frames = source->readX(csf->bytes_num_frames);
- if (num_frames == 0) num_frames = CalcNumFrames(source,csf,real_len,start_pos);
+ // Now read _num_frames
+ _num_frames = 1;
+ if (csf->_bytes_num_frames) _num_frames = source->readX(csf->_bytes_num_frames);
+ if (_num_frames == 0) _num_frames = CalcNumFrames(source,csf,real_len,start_pos);
#ifdef COMP_SHAPENUM
- if (shapenum == COMP_SHAPENUM) pout << "num_frames " << num_frames << Std::endl;
+ if (shapenum == COMP_SHAPENUM) pout << "_num_frames " << _num_frames << Std::endl;
#endif
-// if (num_frames == 0xFFFF || num_frames == 0xFFFFFF || num_frames == -1)
+// if (_num_frames == 0xFFFF || _num_frames == 0xFFFFFF || _num_frames == -1)
// {
// perr << "Corrupt shape? " << Std::endl;
-// num_frames = 0;
-// frames = 0;
+// _num_frames = 0;
+// _frames = 0;
// return;
// }
- // Create frames array
- frames = new ConvertShapeFrame[num_frames];
- Std::memset (frames, 0, num_frames * sizeof(ConvertShapeFrame));
+ // Create _frames array
+ _frames = new ConvertShapeFrame[_num_frames];
+ Std::memset (_frames, 0, _num_frames * sizeof(ConvertShapeFrame));
- // Now read the frames
- for(uint32 f = 0; f < num_frames; ++f)
+ // Now read the _frames
+ for(uint32 f = 0; f < _num_frames; ++f)
{
#ifdef COMP_SHAPENUM
if (shapenum == COMP_SHAPENUM) pout << "Frame " << f << Std::endl;
#endif
- ConvertShapeFrame *frame = frames+f;
+ ConvertShapeFrame *frame = _frames+f;
#ifdef COMP_SHAPENUM
- if (shapenum == COMP_SHAPENUM) pout << "Seeking to " << (csf->len_header + (csf->len_frameheader*f)) << Std::endl;
- if (shapenum == COMP_SHAPENUM) pout << "Real " << (start_pos + csf->len_header + (csf->len_frameheader*f)) << Std::endl;
+ if (shapenum == COMP_SHAPENUM) pout << "Seeking to " << (csf->_len_header + (csf->_len_frameheader*f)) << Std::endl;
+ if (shapenum == COMP_SHAPENUM) pout << "Real " << (start_pos + csf->_len_header + (csf->_len_frameheader*f)) << Std::endl;
#endif
// Seek to initial pos
- source->seek(start_pos + csf->len_header + (csf->len_frameheader*f));
+ source->seek(start_pos + csf->_len_header + (csf->_len_frameheader*f));
#ifdef COMP_SHAPENUM
if (shapenum == COMP_SHAPENUM) pout << "seeked to " << source->getPos() << Std::endl;
#endif
// Read the offset
- uint32 frame_offset = csf->len_header + (csf->len_frameheader*f);
- if (csf->bytes_frame_offset) frame_offset = source->readX(csf->bytes_frame_offset);
+ uint32 frame_offset = csf->_len_header + (csf->_len_frameheader*f);
+ if (csf->_bytes_frame_offset) frame_offset = source->readX(csf->_bytes_frame_offset);
#ifdef COMP_SHAPENUM
if (shapenum == COMP_SHAPENUM) pout << "frame_offset " << frame_offset << Std::endl;
#endif
// Read the unknown
- if (csf->bytes_frameheader_unk) source->read(frame->header_unknown, csf->bytes_frameheader_unk);
+ if (csf->_bytes_frameheader_unk) source->read(frame->_header_unknown, csf->_bytes_frameheader_unk);
// Read frame_length
uint32 frame_length = real_len-frame_offset;
- if (csf->bytes_frame_length) frame_length = source->readX(csf->bytes_frame_length) + csf->bytes_frame_length_kludge;
+ if (csf->_bytes_frame_length) frame_length = source->readX(csf->_bytes_frame_length) + csf->_bytes_frame_length_kludge;
#ifdef COMP_SHAPENUM
if (shapenum == COMP_SHAPENUM) pout << "frame_length " << frame_length << Std::endl;
#endif
// Seek to start of frame
- source->seek(start_pos + frame_offset + csf->bytes_special);
+ source->seek(start_pos + frame_offset + csf->_bytes_special);
- if (csf->bytes_special)
- frame->ReadCmpFrame(source, csf, special, f>0?frames+f-1:0);
+ if (csf->_bytes_special)
+ frame->ReadCmpFrame(source, csf, special, f>0?_frames+f-1:0);
else
frame->Read(source, csf, frame_length);
}
@@ -140,72 +140,69 @@ void ConvertShape::Read(IDataSource *source, const ConvertShapeFormat *csf, uint
void ConvertShapeFrame::Read(IDataSource *source, const ConvertShapeFormat *csf, uint32 frame_length)
{
// Read unknown
- if (csf->bytes_frame_unknown) source->read(unknown, csf->bytes_frame_unknown);
+ if (csf->_bytes_frame_unknown) source->read(_unknown, csf->_bytes_frame_unknown);
// Frame details
- compression = source->readX(csf->bytes_frame_compression);
- width = source->readXS(csf->bytes_frame_width);
- height = source->readXS(csf->bytes_frame_height);
- xoff = source->readXS(csf->bytes_frame_xoff);
- yoff = source->readXS(csf->bytes_frame_yoff);
+ _compression = source->readX(csf->_bytes_frame_compression);
+ _width = source->readXS(csf->_bytes_frame_width);
+ _height = source->readXS(csf->_bytes_frame_height);
+ _xoff = source->readXS(csf->_bytes_frame_xoff);
+ _yoff = source->readXS(csf->_bytes_frame_yoff);
#ifdef COMP_SHAPENUM
- if (width <= 0 || height <= 0 ||shapenum == COMP_SHAPENUM )
+ if (_width <= 0 || _height <= 0 ||shapenum == COMP_SHAPENUM )
{
- pout << "compression " << compression << Std::endl;
- pout << "width " << width << Std::endl;
- pout << "height " << height << Std::endl;
- pout << "xoff " << xoff << Std::endl;
- pout << "yoff " << yoff << Std::endl;
+ pout << "_compression " << _compression << Std::endl;
+ pout << "_width " << _width << Std::endl;
+ pout << "_height " << _height << Std::endl;
+ pout << "_xoff " << _xoff << Std::endl;
+ pout << "_yoff " << _yoff << Std::endl;
}
#endif
- if (compression != 0 && compression != 1) {
- compression = 0;
- width = 0;
- height = 0;
- xoff = 0;
- yoff = 0;
+ if (_compression != 0 && _compression != 1) {
+ _compression = 0;
+ _width = 0;
+ _height = 0;
+ _xoff = 0;
+ _yoff = 0;
//perr << "Corrupt frame? (frame " << f << ")" << Std::endl;
perr << "Corrupt frame?" << Std::endl;
}
- if (height) {
+ if (_height) {
// Line offsets
- line_offsets = new uint32 [height];
+ _line_offsets = new uint32 [_height];
- for (int32 i = 0; i < height; ++i)
- {
- line_offsets[i] = source->readX(csf->bytes_line_offset);
+ for (int32 i = 0; i < _height; ++i) {
+ _line_offsets[i] = source->readX(csf->_bytes_line_offset);
// Now fudge with the value and turn it into an offset into the rle data
// If required
- if (!csf->line_offset_absolute)
- line_offsets[i] -= (height-i)*csf->bytes_line_offset;
+ if (!csf->_line_offset_absolute)
+ _line_offsets[i] -= (_height-i)*csf->_bytes_line_offset;
}
// Calculate the number of bytes of RLE data
- bytes_rle = frame_length - (csf->len_frameheader2+(height*csf->bytes_line_offset));
+ _bytes_rle = frame_length - (csf->_len_frameheader2+(_height*csf->_bytes_line_offset));
#ifdef COMP_SHAPENUM
- if (bytes_rle < 0)
+ if (_bytes_rle < 0)
{
- bytes_rle = 0;
+ _bytes_rle = 0;
perr << "Corrupt frame?" << Std::endl;
}
#endif
- }
- else
- line_offsets = 0;
+ } else
+ _line_offsets = 0;
// Read the RLE Data
- if (bytes_rle) {
- rle_data = new uint8[bytes_rle];
- source->read(rle_data, bytes_rle);
- }
- else
- rle_data = 0;
+ if (_bytes_rle) {
+ _rle_data = new uint8[_bytes_rle];
+ source->read(_rle_data, _bytes_rle);
+ } else
+ _rle_data = 0;
}
void ConvertShapeFrame::ReadCmpFrame(IDataSource *source, const ConvertShapeFormat *csf, const uint8 special[256], ConvertShapeFrame *prev)
@@ -214,23 +211,23 @@ void ConvertShapeFrame::ReadCmpFrame(IDataSource *source, const ConvertShapeForm
uint8 outbuf[512];
// Read unknown
- if (csf->bytes_frame_unknown) source->read(unknown, csf->bytes_frame_unknown);
+ if (csf->_bytes_frame_unknown) source->read(_unknown, csf->_bytes_frame_unknown);
// Frame details
- compression = source->readX(csf->bytes_frame_compression);
- width = source->readXS(csf->bytes_frame_width);
- height = source->readXS(csf->bytes_frame_height);
- xoff = source->readXS(csf->bytes_frame_xoff);
- yoff = source->readXS(csf->bytes_frame_yoff);
+ _compression = source->readX(csf->_bytes_frame_compression);
+ _width = source->readXS(csf->_bytes_frame_width);
+ _height = source->readXS(csf->_bytes_frame_height);
+ _xoff = source->readXS(csf->_bytes_frame_xoff);
+ _yoff = source->readXS(csf->_bytes_frame_yoff);
- line_offsets = new uint32 [height];
+ _line_offsets = new uint32 [_height];
if (!rlebuf) rlebuf = new OAutoBufferDataSource(1024);
rlebuf->clear();
- for(int32 y = 0; y < height; ++y)
+ for(int32 y = 0; y < _height; ++y)
{
- line_offsets[y] = rlebuf->getPos();
+ _line_offsets[y] = rlebuf->getPos();
int32 xpos = 0;
@@ -239,14 +236,14 @@ void ConvertShapeFrame::ReadCmpFrame(IDataSource *source, const ConvertShapeForm
uint8 skip = source->read1();
xpos += skip;
- if (xpos > width) {
+ if (xpos > _width) {
source->skip(-1);
- skip = width-(xpos-skip);
+ skip = _width-(xpos-skip);
}
rlebuf->write1(skip);
- if (xpos >= width) break;
+ if (xpos >= _width) break;
uint32 dlen = source->read1();
uint8 *o = outbuf;
@@ -255,13 +252,13 @@ void ConvertShapeFrame::ReadCmpFrame(IDataSource *source, const ConvertShapeForm
if (dlen == 0 || dlen == 1) {
source->skip(-1);
rlebuf->skip(-1);
- rlebuf->write1(skip+(width-xpos));
+ rlebuf->write1(skip+(_width-xpos));
break;
}
int type = 0;
- if (compression) {
+ if (_compression) {
type = dlen & 1;
dlen >>= 1;
}
@@ -276,14 +273,14 @@ void ConvertShapeFrame::ReadCmpFrame(IDataSource *source, const ConvertShapeForm
if (special[c] && prev) {
int32 count = special[c];
- prev->GetPixels(o,count,xpos-xoff,y-yoff);
+ prev->GetPixels(o,count,xpos-_xoff,y-_yoff);
o+=count;
extra += count-1;
xpos += count;
}
else if (c == 0xFF && prev) {
int32 count = source->read1();
- prev->GetPixels(o,count,xpos-xoff,y-yoff);
+ prev->GetPixels(o,count,xpos-_xoff,y-_yoff);
o+=count;
extra += count-2;
xpos += count;
@@ -295,11 +292,11 @@ void ConvertShapeFrame::ReadCmpFrame(IDataSource *source, const ConvertShapeForm
}
}
- if (((dlen+extra) << compression) > 255) {
+ if (((dlen+extra) << _compression) > 255) {
perr << "Error! Corrupt Frame. RLE dlen too large" << Std::endl;
}
- rlebuf->write1((dlen+extra) << compression);
+ rlebuf->write1((dlen+extra) << _compression);
rlebuf->write(outbuf,dlen+extra);
}
else {
@@ -308,33 +305,33 @@ void ConvertShapeFrame::ReadCmpFrame(IDataSource *source, const ConvertShapeForm
xpos+=dlen;
}
- } while (xpos < width);
+ } while (xpos < _width);
}
- bytes_rle = rlebuf->getPos();
- rle_data = new uint8[bytes_rle];
- memcpy (rle_data, rlebuf->getBuf(), bytes_rle);
+ _bytes_rle = rlebuf->getPos();
+ _rle_data = new uint8[_bytes_rle];
+ memcpy (_rle_data, rlebuf->getBuf(), _bytes_rle);
}
void ConvertShapeFrame::GetPixels(uint8 *buf, int32 count, int32 x, int32 y)
{
- x += xoff;
- y += yoff;
+ x += _xoff;
+ y += _yoff;
- if (y > height) return;
+ if (y > _height) return;
int32 xpos = 0;
- const uint8 * linedata = rle_data + line_offsets[y];
+ const uint8 * linedata = _rle_data + _line_offsets[y];
do {
xpos += *linedata++;
- if (xpos == width) break;
+ if (xpos == _width) break;
int32 dlen = *linedata++;
int type = 0;
- if (compression)
+ if (_compression)
{
type = dlen & 1;
dlen >>= 1;
@@ -376,7 +373,7 @@ void ConvertShapeFrame::GetPixels(uint8 *buf, int32 count, int32 x, int32 y)
xpos += dlen;
- } while (xpos < width);
+ } while (xpos < _width);
}
int ConvertShape::CalcNumFrames(IDataSource *source, const ConvertShapeFormat *csf, uint32 real_len, uint32 start_pos)
@@ -389,24 +386,24 @@ int ConvertShape::CalcNumFrames(IDataSource *source, const ConvertShapeFormat *c
for (f=0;;f++) {
// Seek to initial pos
- source->seek(start_pos + csf->len_header + (csf->len_frameheader*f));
+ source->seek(start_pos + csf->_len_header + (csf->_len_frameheader*f));
if ((source->getPos()-start_pos) >= first_offset) break;
// Read the offset
- uint32 frame_offset = csf->len_header + (csf->len_frameheader*f);
- if (csf->bytes_frame_offset) frame_offset = source->readX(csf->bytes_frame_offset) + csf->bytes_special;
+ uint32 frame_offset = csf->_len_header + (csf->_len_frameheader*f);
+ if (csf->_bytes_frame_offset) frame_offset = source->readX(csf->_bytes_frame_offset) + csf->_bytes_special;
if (frame_offset < first_offset) first_offset = frame_offset;
// Read the unknown
- if (csf->bytes_frameheader_unk) source->skip(csf->bytes_frameheader_unk);
+ if (csf->_bytes_frameheader_unk) source->skip(csf->_bytes_frameheader_unk);
// Read frame_length
#ifdef TODO
uint32 frame_length = real_len-frame_offset;
- if (csf->bytes_frame_length)
- frame_length = source->readX(csf->bytes_frame_length) + csf->bytes_frame_length_kludge;
+ if (csf->_bytes_frame_length)
+ frame_length = source->readX(csf->_bytes_frame_length) + csf->_bytes_frame_length_kludge;
#endif
}
@@ -418,7 +415,7 @@ int ConvertShape::CalcNumFrames(IDataSource *source, const ConvertShapeFormat *c
bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uint32 real_len)
{
#if 0
- pout << "Testing " << csf->name << "..." << Std::endl;
+ pout << "Testing " << csf->_name << "..." << Std::endl;
#endif
bool result = true;
@@ -426,13 +423,13 @@ bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uin
int start_pos = source->getPos();
// Read the ident
- if (csf->bytes_ident)
+ if (csf->_bytes_ident)
{
char ident[5];
- ident[csf->bytes_ident] = 0;
- source->read(ident, csf->bytes_ident);
+ ident[csf->_bytes_ident] = 0;
+ source->read(ident, csf->_bytes_ident);
- if (Std::memcmp (ident, csf->ident, csf->bytes_ident))
+ if (Std::memcmp (ident, csf->_ident, csf->_bytes_ident))
{
// Return to start position
source->seek(start_pos);
@@ -441,38 +438,38 @@ bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uin
}
// Read the header special colour
- if (csf->bytes_special) source->skip(csf->bytes_special);
+ if (csf->_bytes_special) source->skip(csf->_bytes_special);
// Read the header unknown
- if (csf->bytes_header_unk) source->skip(csf->bytes_header_unk);
+ if (csf->_bytes_header_unk) source->skip(csf->_bytes_header_unk);
- // Now read num_frames
- int num_frames = 1;
- if (csf->bytes_num_frames) num_frames = source->readX(csf->bytes_num_frames);
- if (num_frames == 0) num_frames = CalcNumFrames(source,csf,real_len,start_pos);
+ // Now read _num_frames
+ int _num_frames = 1;
+ if (csf->_bytes_num_frames) _num_frames = source->readX(csf->_bytes_num_frames);
+ if (_num_frames == 0) _num_frames = CalcNumFrames(source,csf,real_len,start_pos);
- // Create frames array
+ // Create _frames array
ConvertShapeFrame oneframe;
Std::memset (&oneframe, 0, sizeof(ConvertShapeFrame));
- // Now read the frames
- for (int f = 0; f < num_frames; f++)
+ // Now read the _frames
+ for (int f = 0; f < _num_frames; f++)
{
ConvertShapeFrame *frame = &oneframe;
// Seek to initial pos
- source->seek(start_pos + csf->len_header + (csf->len_frameheader*f));
+ source->seek(start_pos + csf->_len_header + (csf->_len_frameheader*f));
// Read the offset
- uint32 frame_offset = csf->len_header + (csf->len_frameheader*f);
- if (csf->bytes_frame_offset) frame_offset = source->readX(csf->bytes_frame_offset) + csf->bytes_special;
+ uint32 frame_offset = csf->_len_header + (csf->_len_frameheader*f);
+ if (csf->_bytes_frame_offset) frame_offset = source->readX(csf->_bytes_frame_offset) + csf->_bytes_special;
// Read the unknown
- if (csf->bytes_frameheader_unk) source->read(frame->header_unknown, csf->bytes_frameheader_unk);
+ if (csf->_bytes_frameheader_unk) source->read(frame->_header_unknown, csf->_bytes_frameheader_unk);
// Read frame_length
uint32 frame_length = real_len-frame_offset;
- if (csf->bytes_frame_length) frame_length = source->readX(csf->bytes_frame_length) + csf->bytes_frame_length_kludge;
+ if (csf->_bytes_frame_length) frame_length = source->readX(csf->_bytes_frame_length) + csf->_bytes_frame_length_kludge;
// Invalid frame length
if ((frame_length + frame_offset) > real_len)
@@ -485,58 +482,58 @@ bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uin
source->seek(start_pos + frame_offset);
// Read unknown
- if (csf->bytes_frame_unknown) source->read(frame->unknown, csf->bytes_frame_unknown);
+ if (csf->_bytes_frame_unknown) source->read(frame->_unknown, csf->_bytes_frame_unknown);
// Frame details
- frame->compression = source->readX(csf->bytes_frame_compression);
- frame->width = source->readXS(csf->bytes_frame_width);
- frame->height = source->readXS(csf->bytes_frame_height);
- frame->xoff = source->readXS(csf->bytes_frame_xoff);
- frame->yoff = source->readXS(csf->bytes_frame_yoff);
+ frame->_compression = source->readX(csf->_bytes_frame_compression);
+ frame->_width = source->readXS(csf->_bytes_frame_width);
+ frame->_height = source->readXS(csf->_bytes_frame_height);
+ frame->_xoff = source->readXS(csf->_bytes_frame_xoff);
+ frame->_yoff = source->readXS(csf->_bytes_frame_yoff);
- if ((frame->compression != 0 && frame->compression != 1) || frame->width < 0 || frame->height < 0)
+ if ((frame->_compression != 0 && frame->_compression != 1) || frame->_width < 0 || frame->_height < 0)
{
- frame->compression = 0;
- frame->width = 0;
- frame->height = 0;
- frame->xoff = 0;
- frame->yoff = 0;
+ frame->_compression = 0;
+ frame->_width = 0;
+ frame->_height = 0;
+ frame->_xoff = 0;
+ frame->_yoff = 0;
result = false;
break;
}
- if (frame->height)
+ if (frame->_height)
{
// Line offsets
int32 highest_offset_byte = 0;
// Calculate the number of bytes of RLE data
- frame->bytes_rle = frame_length - (csf->len_frameheader2+(frame->height*csf->bytes_line_offset));
+ frame->_bytes_rle = frame_length - (csf->_len_frameheader2+(frame->_height*csf->_bytes_line_offset));
// Totally invalid shape
- if (frame->bytes_rle < 0)
+ if (frame->_bytes_rle < 0)
{
result = false;
break;
}
// Only attempt to decompress the shape if we are not a compressed shapes
- if (!csf->bytes_special) {
+ if (!csf->_bytes_special) {
// Seek to first in offset table
- source->seek(start_pos + frame_offset + csf->len_frameheader2);
+ source->seek(start_pos + frame_offset + csf->_len_frameheader2);
- // Loop through each of the frames and find the last rle run
- for (int i = 0; i < frame->height; i++)
+ // Loop through each of the _frames and find the last rle run
+ for (int i = 0; i < frame->_height; i++)
{
- int32 line_offset = source->readX(csf->bytes_line_offset);
+ int32 line_offset = source->readX(csf->_bytes_line_offset);
// Now fudge with the value and turn it into an offset into the rle data
// if required
- if (!csf->line_offset_absolute)
- line_offset -= (frame->height-i)*csf->bytes_line_offset;
+ if (!csf->_line_offset_absolute)
+ line_offset -= (frame->_height-i)*csf->_bytes_line_offset;
- if (line_offset > frame->bytes_rle)
+ if (line_offset > frame->_bytes_rle)
{
result = false;
break;
@@ -549,15 +546,15 @@ bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uin
if (result == false) break;
// Jump to the line offset and calculate the length of the run
- source->seek(highest_offset_byte + start_pos + frame_offset + csf->len_frameheader2 + frame->height*csf->bytes_line_offset);
+ source->seek(highest_offset_byte + start_pos + frame_offset + csf->_len_frameheader2 + frame->_height*csf->_bytes_line_offset);
int xpos = 0;
uint32 dlen = 0;
// Compressed
- if (frame->compression) do
+ if (frame->_compression) do
{
xpos += source->read1();
- if (xpos == frame->width) break;
+ if (xpos == frame->_width) break;
dlen = source->read1();
int type = dlen & 1;
@@ -568,25 +565,25 @@ bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uin
xpos += dlen;
- } while (xpos < frame->width);
+ } while (xpos < frame->_width);
// Uncompressed
else do
{
xpos += source->read1();
- if (xpos == frame->width) break;
+ if (xpos == frame->_width) break;
dlen = source->read1();
source->skip(dlen);
xpos += dlen;
- } while (xpos < frame->width);
+ } while (xpos < frame->_width);
// Calc 'real' bytes rle
int32 highest_rle_byte = source->getPos();
- highest_rle_byte -= start_pos + frame_offset + csf->len_frameheader2 + frame->height*csf->bytes_line_offset;
+ highest_rle_byte -= start_pos + frame_offset + csf->_len_frameheader2 + frame->_height*csf->_bytes_line_offset;
// Too many bytes
- if (highest_rle_byte > frame->bytes_rle)
+ if (highest_rle_byte > frame->_bytes_rle)
{
result = false;
break;
@@ -595,9 +592,9 @@ bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uin
}
}
- // Free frames
+ // Free _frames
oneframe.Free();
- num_frames = 0;
+ _num_frames = 0;
// Return to start position
source->seek(start_pos);
@@ -608,7 +605,7 @@ bool ConvertShape::Check(IDataSource *source, const ConvertShapeFormat *csf, uin
bool ConvertShape::CheckUnsafe(IDataSource *source, const ConvertShapeFormat *csf, uint32 real_len)
{
#if 0
- pout << "Testing " << csf->name << "..." << Std::endl;
+ pout << "Testing " << csf->_name << "..." << Std::endl;
#endif
bool result = true;
@@ -616,13 +613,13 @@ bool ConvertShape::CheckUnsafe(IDataSource *source, const ConvertShapeFormat *cs
int start_pos = source->getPos();
// Read the ident
- if (csf->bytes_ident)
+ if (csf->_bytes_ident)
{
char ident[5];
- ident[csf->bytes_ident] = 0;
- source->read(ident, csf->bytes_ident);
+ ident[csf->_bytes_ident] = 0;
+ source->read(ident, csf->_bytes_ident);
- if (Std::memcmp (ident, csf->ident, csf->bytes_ident))
+ if (Std::memcmp (ident, csf->_ident, csf->_bytes_ident))
{
// Return to start position
source->seek(start_pos);
@@ -631,38 +628,38 @@ bool ConvertShape::CheckUnsafe(IDataSource *source, const ConvertShapeFormat *cs
}
// Read the header special colour
- if (csf->bytes_special) source->skip(csf->bytes_special);
+ if (csf->_bytes_special) source->skip(csf->_bytes_special);
// Read the header unknown
- if (csf->bytes_header_unk) source->skip(csf->bytes_header_unk);
+ if (csf->_bytes_header_unk) source->skip(csf->_bytes_header_unk);
- // Now read num_frames
- int num_frames = 1;
- if (csf->bytes_num_frames) num_frames = source->readX(csf->bytes_num_frames);
- if (num_frames == 0) num_frames = CalcNumFrames(source,csf,real_len,start_pos);
+ // Now read _num_frames
+ int _num_frames = 1;
+ if (csf->_bytes_num_frames) _num_frames = source->readX(csf->_bytes_num_frames);
+ if (_num_frames == 0) _num_frames = CalcNumFrames(source,csf,real_len,start_pos);
- // Create frames array
+ // Create _frames array
ConvertShapeFrame oneframe;
Std::memset (&oneframe, 0, sizeof(ConvertShapeFrame));
- // Now read the frames
- for (int f = 0; f < num_frames; f++)
+ // Now read the _frames
+ for (int f = 0; f < _num_frames; f++)
{
ConvertShapeFrame *frame = &oneframe;
// Seek to initial pos
- source->seek(start_pos + csf->len_header + (csf->len_frameheader*f));
+ source->seek(start_pos + csf->_len_header + (csf->_len_frameheader*f));
// Read the offset
- uint32 frame_offset = csf->len_header + (csf->len_frameheader*f);
- if (csf->bytes_frame_offset) frame_offset = source->readX(csf->bytes_frame_offset) + csf->bytes_special;
+ uint32 frame_offset = csf->_len_header + (csf->_len_frameheader*f);
+ if (csf->_bytes_frame_offset) frame_offset = source->readX(csf->_bytes_frame_offset) + csf->_bytes_special;
// Read the unknown
- if (csf->bytes_frameheader_unk) source->read(frame->header_unknown, csf->bytes_frameheader_unk);
+ if (csf->_bytes_frameheader_unk) source->read(frame->_header_unknown, csf->_bytes_frameheader_unk);
// Read frame_length
uint32 frame_length = real_len-frame_offset;
- if (csf->bytes_frame_length) frame_length = source->readX(csf->bytes_frame_length) + csf->bytes_frame_length_kludge;
+ if (csf->_bytes_frame_length) frame_length = source->readX(csf->_bytes_frame_length) + csf->_bytes_frame_length_kludge;
// Invalid frame length
if ((frame_length + frame_offset) > real_len)
@@ -675,33 +672,33 @@ bool ConvertShape::CheckUnsafe(IDataSource *source, const ConvertShapeFormat *cs
source->seek(start_pos + frame_offset);
// Read unknown
- if (csf->bytes_frame_unknown) source->read(frame->unknown, csf->bytes_frame_unknown);
+ if (csf->_bytes_frame_unknown) source->read(frame->_unknown, csf->_bytes_frame_unknown);
// Frame details
- frame->compression = source->readX(csf->bytes_frame_compression);
- frame->width = source->readXS(csf->bytes_frame_width);
- frame->height = source->readXS(csf->bytes_frame_height);
- frame->xoff = source->readXS(csf->bytes_frame_xoff);
- frame->yoff = source->readXS(csf->bytes_frame_yoff);
+ frame->_compression = source->readX(csf->_bytes_frame_compression);
+ frame->_width = source->readXS(csf->_bytes_frame_width);
+ frame->_height = source->readXS(csf->_bytes_frame_height);
+ frame->_xoff = source->readXS(csf->_bytes_frame_xoff);
+ frame->_yoff = source->readXS(csf->_bytes_frame_yoff);
- if ((frame->compression != 0 && frame->compression != 1) || frame->width < 0 || frame->height < 0)
+ if ((frame->_compression != 0 && frame->_compression != 1) || frame->_width < 0 || frame->_height < 0)
{
- frame->compression = 0;
- frame->width = 0;
- frame->height = 0;
- frame->xoff = 0;
- frame->yoff = 0;
+ frame->_compression = 0;
+ frame->_width = 0;
+ frame->_height = 0;
+ frame->_xoff = 0;
+ frame->_yoff = 0;
result = false;
break;
}
- if (frame->height)
+ if (frame->_height)
{
// Calculate the number of bytes of RLE data (may not be accurate but we don't care)
- frame->bytes_rle = frame_length - (csf->len_frameheader2+(frame->height*csf->bytes_line_offset));
+ frame->_bytes_rle = frame_length - (csf->_len_frameheader2+(frame->_height*csf->_bytes_line_offset));
// Totally invalid shape
- if (frame->bytes_rle < 0)
+ if (frame->_bytes_rle < 0)
{
result = false;
break;
@@ -709,9 +706,9 @@ bool ConvertShape::CheckUnsafe(IDataSource *source, const ConvertShapeFormat *cs
}
}
- // Free frames
+ // Free _frames
oneframe.Free();
- num_frames = 0;
+ _num_frames = 0;
// Return to start position
source->seek(start_pos);
@@ -725,73 +722,73 @@ void ConvertShape::Write(ODataSource *dest, const ConvertShapeFormat *csf, uint3
uint32 start_pos = dest->getPos();
// Write the ident
- if (csf->bytes_ident) dest->write(csf->ident, csf->bytes_ident);
+ if (csf->_bytes_ident) dest->write(csf->_ident, csf->_bytes_ident);
// Write the header unknown
- if (csf->bytes_header_unk) dest->write(header_unknown, csf->bytes_header_unk);
+ if (csf->_bytes_header_unk) dest->write(_header_unknown, csf->_bytes_header_unk);
- // Now write num_frames
- if (csf->bytes_num_frames) dest->writeX(num_frames, csf->bytes_num_frames);
- else if (!csf->bytes_num_frames && num_frames > 1)
+ // Now write _num_frames
+ if (csf->_bytes_num_frames) dest->writeX(_num_frames, csf->_bytes_num_frames);
+ else if (!csf->_bytes_num_frames && _num_frames > 1)
{
- perr << "Error: Unable to convert multiple frame shapes to " << csf->name << Std::endl;
+ perr << "Error: Unable to convert multiple frame shapes to " << csf->_name << Std::endl;
return;
}
// Write filler space for the frame details
- for (uint32 i = 0; i < num_frames*csf->len_frameheader; i++) dest->write1(0);
+ for (uint32 i = 0; i < _num_frames*csf->_len_frameheader; i++) dest->write1(0);
- // Now write the frames
- for(uint32 f = 0; f < num_frames; f++)
+ // Now write the _frames
+ for(uint32 f = 0; f < _num_frames; f++)
{
- ConvertShapeFrame *frame = frames+f;
+ ConvertShapeFrame *frame = _frames+f;
// Get the frame offset
uint32 frame_offset = dest->getPos() - start_pos;
// Seek to the frame header pos
- dest->seek(start_pos + csf->len_header + (csf->len_frameheader*f));
+ dest->seek(start_pos + csf->_len_header + (csf->_len_frameheader*f));
// Write the offset
- if (csf->bytes_frame_offset) dest->writeX(frame_offset, csf->bytes_frame_offset);
+ if (csf->_bytes_frame_offset) dest->writeX(frame_offset, csf->_bytes_frame_offset);
// Write the unknown
- if (csf->bytes_frameheader_unk) dest->write(frame->header_unknown, csf->bytes_frameheader_unk);
+ if (csf->_bytes_frameheader_unk) dest->write(frame->_header_unknown, csf->_bytes_frameheader_unk);
// Calc and write frame_length
- if (csf->bytes_frame_length)
+ if (csf->_bytes_frame_length)
{
- uint32 frame_length = csf->len_frameheader2 + (frame->height*csf->bytes_line_offset) + frame->bytes_rle;
- dest->writeX(frame_length - csf->bytes_frame_length_kludge, csf->bytes_frame_length);
+ uint32 frame_length = csf->_len_frameheader2 + (frame->_height*csf->_bytes_line_offset) + frame->_bytes_rle;
+ dest->writeX(frame_length - csf->_bytes_frame_length_kludge, csf->_bytes_frame_length);
}
// Seek to start of frame
dest->seek(start_pos + frame_offset);
// Write unknown
- if (csf->bytes_frame_unknown) dest->write(frame->unknown, csf->bytes_frame_unknown);
+ if (csf->_bytes_frame_unknown) dest->write(frame->_unknown, csf->_bytes_frame_unknown);
// Frame details
- dest->writeX(frame->compression, csf->bytes_frame_compression);
- dest->writeX(frame->width, csf->bytes_frame_width);
- dest->writeX(frame->height, csf->bytes_frame_height);
- dest->writeX(frame->xoff, csf->bytes_frame_xoff);
- dest->writeX(frame->yoff, csf->bytes_frame_yoff);
+ dest->writeX(frame->_compression, csf->_bytes_frame_compression);
+ dest->writeX(frame->_width, csf->_bytes_frame_width);
+ dest->writeX(frame->_height, csf->_bytes_frame_height);
+ dest->writeX(frame->_xoff, csf->_bytes_frame_xoff);
+ dest->writeX(frame->_yoff, csf->_bytes_frame_yoff);
// Line offsets
- for (int32 i = 0; i < frame->height; i++)
+ for (int32 i = 0; i < frame->_height; i++)
{
- int32 actual_offset = frame->line_offsets[i];
+ int32 actual_offset = frame->_line_offsets[i];
// Unfudge the value and write it, if requiretd
- if (!csf->line_offset_absolute)
- actual_offset += (frame->height-i)*csf->bytes_line_offset;
+ if (!csf->_line_offset_absolute)
+ actual_offset += (frame->_height-i)*csf->_bytes_line_offset;
- dest->writeX(actual_offset, csf->bytes_line_offset);
+ dest->writeX(actual_offset, csf->_bytes_line_offset);
}
// Write the RLE Data
- dest->write(frame->rle_data, frame->bytes_rle);
+ dest->write(frame->_rle_data, frame->_bytes_rle);
}
// Just cheat
@@ -808,7 +805,7 @@ const ConvertShapeFormat PentagramShapeFormat =
4, // bytes_ident
0, // bytes_special
0, // header_unk
- 4, // num_frames
+ 4, // _num_frames
8, // frameheader
4, // frame_offset
diff --git a/engines/ultima/ultima8/convert/convert_shape.h b/engines/ultima/ultima8/convert/convert_shape.h
index 3a15936..4cc8f4f 100644
--- a/engines/ultima/ultima8/convert/convert_shape.h
+++ b/engines/ultima/ultima8/convert/convert_shape.h
@@ -34,60 +34,57 @@ class ODataSource;
// Convert shape C
/********** Update AutoShapeFormat in shapeconv/ShapeConv.cpp when changed! **********/
-struct ConvertShapeFormat
-{
- const char * name;
+struct ConvertShapeFormat {
+ const char * _name;
// U8 U8 Gump U8.SKF Cru Cru2D Pent Comp
- uint32 len_header; // 6 6 2 6 6 8 11
- const char * ident; // "" "" "\2\0" "" "" "PSHP" ""
- uint32 bytes_ident; // 0 0 2 0 0 4 0
- uint32 bytes_special; // 0 0 0 0 0 0 5
- uint32 bytes_header_unk; // 4 4 0 4 4 0 4
- uint32 bytes_num_frames; // 2 2 0 2 2 4 2
-
- uint32 len_frameheader; // 6 6 0 8 8 8 6
- uint32 bytes_frame_offset; // 3 3 0 3 3 4 4
- uint32 bytes_frameheader_unk; // 1 2 0 2 2 0 0
- uint32 bytes_frame_length; // 2 2 0 3 3 4 2
- uint32 bytes_frame_length_kludge; // 0 8 0 0 0 0 0
-
- uint32 len_frameheader2; // 18 18 10 28 20 20 10
- uint32 bytes_frame_unknown; // 8 8 0 8 0 0 0
- uint32 bytes_frame_compression; // 2 2 2 4 4 4 2
- uint32 bytes_frame_width; // 2 2 2 4 4 4 2
- uint32 bytes_frame_height; // 2 2 2 4 4 4 2
- uint32 bytes_frame_xoff; // 2 2 2 4 4 4 2
- uint32 bytes_frame_yoff; // 2 2 2 4 4 4 2
-
- uint32 bytes_line_offset; // 2 2 2 4 4 4 0
- uint32 line_offset_absolute; // 0 0 0 0 0 1 0
+ uint32 _len_header; // 6 6 2 6 6 8 11
+ const char * _ident; // "" "" "\2\0" "" "" "PSHP" ""
+ uint32 _bytes_ident; // 0 0 2 0 0 4 0
+ uint32 _bytes_special; // 0 0 0 0 0 0 5
+ uint32 _bytes_header_unk; // 4 4 0 4 4 0 4
+ uint32 _bytes_num_frames; // 2 2 0 2 2 4 2
+
+ uint32 _len_frameheader; // 6 6 0 8 8 8 6
+ uint32 _bytes_frame_offset; // 3 3 0 3 3 4 4
+ uint32 _bytes_frameheader_unk; // 1 2 0 2 2 0 0
+ uint32 _bytes_frame_length; // 2 2 0 3 3 4 2
+ uint32 _bytes_frame_length_kludge; // 0 8 0 0 0 0 0
+
+ uint32 _len_frameheader2; // 18 18 10 28 20 20 10
+ uint32 _bytes_frame_unknown; // 8 8 0 8 0 0 0
+ uint32 _bytes_frame_compression; // 2 2 2 4 4 4 2
+ uint32 _bytes_frame_width; // 2 2 2 4 4 4 2
+ uint32 _bytes_frame_height; // 2 2 2 4 4 4 2
+ uint32 _bytes_frame_xoff; // 2 2 2 4 4 4 2
+ uint32 _bytes_frame_yoff; // 2 2 2 4 4 4 2
+
+ uint32 _bytes_line_offset; // 2 2 2 4 4 4 0
+ uint32 _line_offset_absolute; // 0 0 0 0 0 1 0
};
// ConvertShapeFrame structure
-struct ConvertShapeFrame
-{
- uint8 header_unknown[2];
+struct ConvertShapeFrame {
+ uint8 _header_unknown[2];
- uint8 unknown[8];
- uint32 compression;
- int32 width;
- int32 height;
- int32 xoff;
- int32 yoff;
+ uint8 _unknown[8];
+ uint32 _compression;
+ int32 _width;
+ int32 _height;
+ int32 _xoff;
+ int32 _yoff;
- uint32 *line_offsets; // Note these are offsets into rle_data
+ uint32 *_line_offsets; // Note these are offsets into rle_data
- int32 bytes_rle; // Number of bytes of RLE Data
- uint8 *rle_data;
+ int32 _bytes_rle; // Number of bytes of RLE Data
+ uint8 *_rle_data;
- void Free()
- {
- delete [] line_offsets;
- line_offsets = 0;
+ void Free() {
+ delete [] _line_offsets;
+ _line_offsets = 0;
- delete [] rle_data;
- rle_data = 0;
+ delete [] _rle_data;
+ _rle_data = 0;
}
void Read(IDataSource *source, const ConvertShapeFormat *csf, uint32 frame_length);
@@ -102,12 +99,12 @@ struct ConvertShapeFrame
class ConvertShape
{
- uint8 header_unknown[4];
- uint32 num_frames;
- ConvertShapeFrame *frames;
+ uint8 _header_unknown[4];
+ uint32 _num_frames;
+ ConvertShapeFrame *_frames;
public:
- ConvertShape() : num_frames(0), frames(0)
+ ConvertShape() : _num_frames(0), _frames(0)
{
}
@@ -118,13 +115,13 @@ public:
void Free()
{
- if (frames)
- for(uint32 i = 0; i < num_frames; ++i)
- frames[i].Free();
+ if (_frames)
+ for(uint32 i = 0; i < _num_frames; ++i)
+ _frames[i].Free();
- delete [] frames;
- frames = 0;
- num_frames = 0;
+ delete [] _frames;
+ _frames = 0;
+ _num_frames = 0;
}
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_font.cpp b/engines/ultima/ultima8/graphics/fonts/jp_font.cpp
index f4e5944..9a7d93a 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/jp_font.cpp
@@ -45,7 +45,7 @@ JPFont::~JPFont() {
}
int JPFont::getWidth(int c) {
- return shapefont->getFrame(c)->width;
+ return shapefont->getFrame(c)->_width;
}
int JPFont::getHeight() {
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
index 10a50a6..295bd67 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
@@ -79,7 +79,7 @@ void JPRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmaske
1, iter->dims.h);
}
- line_x += (font->getFrame(u8char))->width - font->getHlead();
+ line_x += (font->getFrame(u8char))->_width - font->getHlead();
}
if (iter->cursor == textsize) {
@@ -120,7 +120,7 @@ void JPRenderedText::drawBlended(RenderSurface *surface, int x, int y,
surface->PaintHighlight(font, u8char, line_x, line_y,
false, false, col);
- line_x += (font->getFrame(u8char))->width - font->getHlead();
+ line_x += (font->getFrame(u8char))->_width - font->getHlead();
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/shape_font.cpp b/engines/ultima/ultima8/graphics/fonts/shape_font.cpp
index 442fa41..0529d6b 100644
--- a/engines/ultima/ultima8/graphics/fonts/shape_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/shape_font.cpp
@@ -46,13 +46,13 @@ ShapeFont::~ShapeFont() {
int ShapeFont::getWidth(char c) {
- return getFrame(static_cast<unsigned char>(c))->width;
+ return getFrame(static_cast<unsigned char>(c))->_width;
}
int ShapeFont::getHeight() {
if (height == 0) {
for (uint32 i = 0; i < frameCount(); i++) {
- int h = getFrame(i)->height;
+ int h = getFrame(i)->_height;
if (h > height) height = h;
}
@@ -64,7 +64,7 @@ int ShapeFont::getHeight() {
int ShapeFont::getBaseline() {
if (baseline == 0) {
for (uint32 i = 0; i < frameCount(); i++) {
- int b = getFrame(i)->yoff;
+ int b = getFrame(i)->_yoff;
if (b > baseline) baseline = b;
}
diff --git a/engines/ultima/ultima8/graphics/shape.cpp b/engines/ultima/ultima8/graphics/shape.cpp
index 1f84bc5..e047b9d 100644
--- a/engines/ultima/ultima8/graphics/shape.cpp
+++ b/engines/ultima/ultima8/graphics/shape.cpp
@@ -151,10 +151,10 @@ void Shape::LoadGenericFormat(const uint8 *data_, uint32 size_, const ConvertSha
uint32 framesize;
IBufferDataSource ds(data_, size_);
- if (format->bytes_ident) {
- uint8 *ident = new uint8[format->bytes_ident];
- ds.read(ident, format->bytes_ident);
- bool match = Std::memcmp(ident, format->ident, format->bytes_ident) == 0;
+ if (format->_bytes_ident) {
+ uint8 *ident = new uint8[format->_bytes_ident];
+ ds.read(ident, format->_bytes_ident);
+ bool match = Std::memcmp(ident, format->_ident, format->_bytes_ident) == 0;
delete[] ident;
if (!match) {
@@ -165,16 +165,16 @@ void Shape::LoadGenericFormat(const uint8 *data_, uint32 size_, const ConvertSha
// Read special buffer
uint8 special[256];
- if (format->bytes_special) {
+ if (format->_bytes_special) {
memset(special, 0, 256);
- for (uint32 i = 0; i < format->bytes_special; i++) special[ds.read1() & 0xFF] = i + 2;
+ for (uint32 i = 0; i < format->_bytes_special; i++) special[ds.read1() & 0xFF] = i + 2;
}
// Skip unknown
- ds.skip(format->bytes_header_unk);
+ ds.skip(format->_bytes_header_unk);
// Read framecount, default 1 if no
- if (format->bytes_num_frames) framecount = ds.readX(format->bytes_num_frames);
+ if (format->_bytes_num_frames) framecount = ds.readX(format->_bytes_num_frames);
else framecount = 1;
if (framecount == 0) framecount = ConvertShape::CalcNumFrames(&ds, format, size_, 0);
@@ -182,19 +182,19 @@ void Shape::LoadGenericFormat(const uint8 *data_, uint32 size_, const ConvertSha
for (unsigned int i = 0; i < framecount; ++i) {
// Read the offset
- if (format->bytes_frame_offset) frameoffset = ds.readX(format->bytes_frame_offset) + format->bytes_special;
- else frameoffset = format->len_header + (format->len_frameheader * i);
+ if (format->_bytes_frame_offset) frameoffset = ds.readX(format->_bytes_frame_offset) + format->_bytes_special;
+ else frameoffset = format->_len_header + (format->_len_frameheader * i);
// Skip the unknown
- ds.skip(format->bytes_frameheader_unk);
+ ds.skip(format->_bytes_frameheader_unk);
// Read frame_length
- if (format->bytes_frame_length) framesize = ds.readX(format->bytes_frame_length) + format->bytes_frame_length_kludge;
+ if (format->_bytes_frame_length) framesize = ds.readX(format->_bytes_frame_length) + format->_bytes_frame_length_kludge;
else framesize = size_ - frameoffset;
ConvertShapeFrame *prev = 0, p;
- if (format->bytes_special && i > 0) {
+ if (format->_bytes_special && i > 0) {
prev = &p;
frames[i - 1]->getConvertShapeFrame(p);
}
@@ -244,14 +244,14 @@ void Shape::getTotalDimensions(int32 &w, int32 &h, int32 &x, int32 &y) const {
for (unsigned int i = 0; i < frames.size(); ++i) {
ShapeFrame *frame = frames[i];
- if (-frame->xoff < minx)
- minx = -frame->xoff;
- if (-frame->yoff < miny)
- miny = -frame->yoff;
- if (frame->width - frame->xoff - 1 > maxx)
- maxx = frame->width - frame->xoff - 1;
- if (frame->height - frame->yoff - 1 > maxy)
- maxy = frame->height - frame->yoff - 1;
+ if (-frame->_xoff < minx)
+ minx = -frame->_xoff;
+ if (-frame->_yoff < miny)
+ miny = -frame->_yoff;
+ if (frame->_width - frame->_xoff - 1 > maxx)
+ maxx = frame->_width - frame->_xoff - 1;
+ if (frame->_height - frame->_yoff - 1 > maxy)
+ maxy = frame->_height - frame->_yoff - 1;
}
w = maxx - minx + 1;
diff --git a/engines/ultima/ultima8/graphics/shape_archive.cpp b/engines/ultima/ultima8/graphics/shape_archive.cpp
index a2fb95f..01e40c0 100644
--- a/engines/ultima/ultima8/graphics/shape_archive.cpp
+++ b/engines/ultima/ultima8/graphics/shape_archive.cpp
@@ -57,7 +57,7 @@ void ShapeArchive::cache(uint32 shapenum) {
// Auto detect format
if (!format) {
format = Shape::DetectShapeFormat(data, shpsize);
- if (format) pout << "Detected Shape Format: " << format->name << Std::endl;
+ if (format) pout << "Detected Shape Format: " << format->_name << Std::endl;
}
if (!format) {
diff --git a/engines/ultima/ultima8/graphics/shape_frame.cpp b/engines/ultima/ultima8/graphics/shape_frame.cpp
index 690a22a..8fcf6f6 100644
--- a/engines/ultima/ultima8/graphics/shape_frame.cpp
+++ b/engines/ultima/ultima8/graphics/shape_frame.cpp
@@ -34,7 +34,7 @@ namespace Ultima8 {
parse data and fill class
*/
ShapeFrame::ShapeFrame(const uint8 *data, uint32 size, const ConvertShapeFormat *format,
- const uint8 special[256], ConvertShapeFrame *prev) : line_offsets(0) {
+ const uint8 special[256], ConvertShapeFrame *prev) : _line_offsets(0) {
// Load it as u8
if (!format || format == &U8ShapeFormat || format == &U82DShapeFormat)
LoadU8Format(data, size);
@@ -47,7 +47,7 @@ ShapeFrame::ShapeFrame(const uint8 *data, uint32 size, const ConvertShapeFormat
}
ShapeFrame::~ShapeFrame() {
- delete [] line_offsets;
+ delete [] _line_offsets;
}
// Some macros to make things easier
@@ -57,69 +57,70 @@ ShapeFrame::~ShapeFrame() {
// This will load a u8 style shape 'optimzed'.
void ShapeFrame::LoadU8Format(const uint8 *data, uint32 /*size*/) {
- compressed = READ1(data, 8);
- width = static_cast<int16>(READ2(data, 10));
- height = static_cast<int16>(READ2(data, 12));
- xoff = static_cast<int16>(READ2(data, 14));
- yoff = static_cast<int16>(READ2(data, 16));
+ _compressed = READ1(data, 8);
+ _width = static_cast<int16>(READ2(data, 10));
+ _height = static_cast<int16>(READ2(data, 12));
+ _xoff = static_cast<int16>(READ2(data, 14));
+ _yoff = static_cast<int16>(READ2(data, 16));
- if (height == 0) return;
+ if (_height == 0)
+ return;
- line_offsets = new uint32[height];
+ _line_offsets = new uint32[_height];
data += 18;
- for (int32 i = 0; i < height; i++) {
- line_offsets[i] = READ2(data, 0) - ((height - i) * 2);
+ for (int32 i = 0; i < _height; i++) {
+ _line_offsets[i] = READ2(data, 0) - ((_height - i) * 2);
data += 2;
}
- rle_data = data;
+ _rle_data = data;
}
// This will load a pentagram style shape 'optimzed'.
void ShapeFrame::LoadPentagramFormat(const uint8 *data, uint32 /*size*/) {
- compressed = READ1(data, 0);
- width = static_cast<int32>(READ4(data, 4));
- height = static_cast<int32>(READ4(data, 8));
- xoff = static_cast<int32>(READ4(data, 12));
- yoff = static_cast<int32>(READ4(data, 16));
+ _compressed = READ1(data, 0);
+ _width = static_cast<int32>(READ4(data, 4));
+ _height = static_cast<int32>(READ4(data, 8));
+ _xoff = static_cast<int32>(READ4(data, 12));
+ _yoff = static_cast<int32>(READ4(data, 16));
- if (height == 0) return;
+ if (_height == 0) return;
- line_offsets = new uint32[height];
+ _line_offsets = new uint32[_height];
data += 20;
- for (int32 i = 0; i < height; i++) {
- line_offsets[i] = READ4(data, 0);
+ for (int32 i = 0; i < _height; i++) {
+ _line_offsets[i] = READ4(data, 0);
data += 4;
}
- rle_data = data;
+ _rle_data = data;
}
// This will load any sort of shape via a ConvertShapeFormat struct
void ShapeFrame::LoadGenericFormat(const uint8 *data, uint32 size, const ConvertShapeFormat *format) {
IBufferDataSource ds(data, size);
- ds.skip(format->bytes_frame_unknown);
- compressed = ds.readX(format->bytes_frame_compression);
- width = ds.readXS(format->bytes_frame_width);
- height = ds.readXS(format->bytes_frame_height);
- xoff = ds.readXS(format->bytes_frame_xoff);
- yoff = ds.readXS(format->bytes_frame_yoff);
+ ds.skip(format->_bytes_frame_unknown);
+ _compressed = ds.readX(format->_bytes_frame_compression);
+ _width = ds.readXS(format->_bytes_frame_width);
+ _height = ds.readXS(format->_bytes_frame_height);
+ _xoff = ds.readXS(format->_bytes_frame_xoff);
+ _yoff = ds.readXS(format->_bytes_frame_yoff);
- if (height == 0) return;
+ if (_height == 0) return;
- line_offsets = new uint32[height];
+ _line_offsets = new uint32[_height];
- if (format->line_offset_absolute) for (int32 i = 0; i < height; i++) {
- line_offsets[i] = ds.readX(format->bytes_line_offset);
+ if (format->_line_offset_absolute) for (int32 i = 0; i < _height; i++) {
+ _line_offsets[i] = ds.readX(format->_bytes_line_offset);
}
- else for (int32 i = 0; i < height; i++) {
- line_offsets[i] = ds.readX(format->bytes_line_offset) - ((height - i) * format->bytes_line_offset);
+ else for (int32 i = 0; i < _height; i++) {
+ _line_offsets[i] = ds.readX(format->_bytes_line_offset) - ((_height - i) * format->_bytes_line_offset);
}
- rle_data = data + format->len_frameheader2 + height * format->bytes_line_offset;
+ _rle_data = data + format->_len_frameheader2 + _height * format->_bytes_line_offset;
}
// This will load an U8-compressed shape
@@ -130,18 +131,18 @@ void ShapeFrame::LoadU8CMPFormat(const uint8 *data, uint32 size, const ConvertSh
f.ReadCmpFrame(&ds, format, special, prev);
- uint32 to_alloc = f.height + (f.bytes_rle + 3) / 4;
- line_offsets = new uint32[to_alloc];
- rle_data = reinterpret_cast<uint8 *>(line_offsets + f.height);
+ uint32 to_alloc = f._height + (f._bytes_rle + 3) / 4;
+ _line_offsets = new uint32[to_alloc];
+ _rle_data = reinterpret_cast<uint8 *>(_line_offsets + f._height);
- compressed = f.compression;
- height = f.height;
- width = f.width;
- xoff = f.xoff;
- yoff = f.yoff;
+ _compressed = f._compression;
+ _height = f._height;
+ _width = f._width;
+ _xoff = f._xoff;
+ _yoff = f._yoff;
- Std::memcpy(line_offsets, f.line_offsets, f.height * 4);
- Std::memcpy(const_cast<uint8 *>(rle_data), f.rle_data, f.bytes_rle);
+ Std::memcpy(_line_offsets, f._line_offsets, f._height * 4);
+ Std::memcpy(const_cast<uint8 *>(_rle_data), f._rle_data, f._bytes_rle);
f.Free();
}
@@ -149,11 +150,11 @@ void ShapeFrame::LoadU8CMPFormat(const uint8 *data, uint32 size, const ConvertSh
// Checks to see if the frame has a pixel at the point
bool ShapeFrame::hasPoint(int32 x, int32 y) const {
// Add the offset
- x += xoff;
- y += yoff;
+ x += _xoff;
+ y += _yoff;
// First gross culling based on dims
- if (x < 0 || y < 0 || x >= width || y >= height) return false;
+ if (x < 0 || y < 0 || x >= _width || y >= _height) return false;
//
// This is all pretty simple.
@@ -163,17 +164,17 @@ bool ShapeFrame::hasPoint(int32 x, int32 y) const {
//
int32 xpos = 0;
- const uint8 *linedata = rle_data + line_offsets[y];
+ const uint8 *linedata = _rle_data + _line_offsets[y];
do {
xpos += *linedata++;
- if (xpos == width) break;
+ if (xpos == _width) break;
int32 dlen = *linedata++;
int type = 0;
- if (compressed) {
+ if (_compressed) {
type = dlen & 1;
dlen >>= 1;
}
@@ -183,7 +184,7 @@ bool ShapeFrame::hasPoint(int32 x, int32 y) const {
if (!type) linedata += dlen;
else linedata++;
- } while (xpos < width);
+ } while (xpos < _width);
return false;
}
@@ -191,11 +192,12 @@ bool ShapeFrame::hasPoint(int32 x, int32 y) const {
// Get the pixel at the point
uint8 ShapeFrame::getPixelAtPoint(int32 x, int32 y) const {
// Add the offset
- x += xoff;
- y += yoff;
+ x += _xoff;
+ y += _yoff;
// First gross culling based on dims
- if (x < 0 || y < 0 || x >= width || y >= height) return 0xFF;
+ if (x < 0 || y < 0 || x >= _width || y >= _height)
+ return 0xFF;
//
// This is all pretty simple.
@@ -205,17 +207,18 @@ uint8 ShapeFrame::getPixelAtPoint(int32 x, int32 y) const {
//
int32 xpos = 0;
- const uint8 *linedata = rle_data + line_offsets[y];
+ const uint8 *linedata = _rle_data + _line_offsets[y];
do {
xpos += *linedata++;
- if (xpos == width) break;
+ if (xpos == _width)
+ break;
int32 dlen = *linedata++;
int type = 0;
- if (compressed) {
+ if (_compressed) {
type = dlen & 1;
dlen >>= 1;
}
@@ -228,20 +231,20 @@ uint8 ShapeFrame::getPixelAtPoint(int32 x, int32 y) const {
if (!type) linedata += dlen;
else linedata++;
- } while (xpos < width);
+ } while (xpos < _width);
return 0xFF;
}
void ShapeFrame::getConvertShapeFrame(ConvertShapeFrame &csf, bool need_bytes_rle) {
- csf.compression = compressed;
- csf.width = width;
- csf.height = height;
- csf.xoff = xoff;
- csf.yoff = yoff;
- csf.line_offsets = line_offsets;
- csf.bytes_rle = 0;
- csf.rle_data = const_cast<uint8 *>(rle_data);
+ csf._compression = _compressed;
+ csf._width = _width;
+ csf._height = _height;
+ csf._xoff = _xoff;
+ csf._yoff = _yoff;
+ csf._line_offsets = _line_offsets;
+ csf._bytes_rle = 0;
+ csf._rle_data = const_cast<uint8 *>(_rle_data);
}
} // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/graphics/shape_frame.h b/engines/ultima/ultima8/graphics/shape_frame.h
index 49ff85c..b80182c 100644
--- a/engines/ultima/ultima8/graphics/shape_frame.h
+++ b/engines/ultima/ultima8/graphics/shape_frame.h
@@ -42,12 +42,12 @@ public:
const uint8 special[256] = 0, ConvertShapeFrame *prev = 0);
~ShapeFrame();
- uint32 compressed;
- int32 width, height;
- int32 xoff, yoff;
+ uint32 _compressed;
+ int32 _width, _height;
+ int32 _xoff, _yoff;
- uint32 *line_offsets; // Note these are offsets into rle_data
- const uint8 *rle_data;
+ uint32 *_line_offsets; // Note these are offsets into rle_data
+ const uint8 *_rle_data;
bool hasPoint(int32 x, int32 y) const; // Check to see if a point is in the frame
diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.inl b/engines/ultima/ultima8/graphics/soft_render_surface.inl
index d2d3ebb..c53a4bb 100644
--- a/engines/ultima/ultima8/graphics/soft_render_surface.inl
+++ b/engines/ultima/ultima8/graphics/soft_render_surface.inl
@@ -176,12 +176,14 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0;
uint32 pix;
// Sanity check
- if (framenum >= s->frameCount()) return;
- if (s->getPalette() == 0) return;
+ if (framenum >= s->frameCount())
+ return;
+ if (s->getPalette() == 0)
+ return;
ShapeFrame *frame = s->getFrame(framenum);
- const uint8 *rle_data = frame->rle_data;
- const uint32 *line_offsets = frame->line_offsets;
+ const uint8 *rle_data = frame->_rle_data;
+ const uint32 *line_offsets = frame->_line_offsets;
const uint32 *pal = untformed_pal?
&(s->getPalette()->native_untransformed[0]):
&(s->getPalette()->native[0]);
@@ -193,13 +195,13 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0;
&(s->getPalette()->xform[0]);
#endif
- int32 width_ = frame->width;
- int32 height_ = frame->height;
- x -= XNEG(frame->xoff);
- y -= frame->yoff;
+ int32 width_ = frame->_width;
+ int32 height_ = frame->_height;
+ x -= XNEG(frame->_xoff);
+ y -= frame->_yoff;
// Do it this way if compressed
- if (frame->compressed) for (int i=0; i<height_; i++)
+ if (frame->_compressed) for (int i=0; i<height_; i++)
{
xpos = 0;
line = y+i;
diff --git a/engines/ultima/ultima8/gumps/book_gump.cpp b/engines/ultima/ultima8/gumps/book_gump.cpp
index 843a169..6b5569b 100644
--- a/engines/ultima/ultima8/gumps/book_gump.cpp
+++ b/engines/ultima/ultima8/gumps/book_gump.cpp
@@ -77,8 +77,8 @@ void BookGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = shapeP->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
}
void BookGump::NextText() {
diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index fc5ab86..a0aa221 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -70,8 +70,8 @@ void ContainerGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
// Wait with ItemRelativeGump initialization until we calculated our size.
ItemRelativeGump::InitGump(newparent, take_focus);
@@ -412,10 +412,10 @@ bool ContainerGump::DraggingItem(Item *item, int mx, int my) {
ShapeFrame *fr = sh->getFrame(_draggingFrame);
assert(fr);
- if (dragging_x - fr->xoff < 0 ||
- dragging_x - fr->xoff + fr->width > _itemArea.w ||
- dragging_y - fr->yoff < 0 ||
- dragging_y - fr->yoff + fr->height > _itemArea.h) {
+ if (dragging_x - fr->_xoff < 0 ||
+ dragging_x - fr->_xoff + fr->_width > _itemArea.w ||
+ dragging_y - fr->_yoff < 0 ||
+ dragging_y - fr->_yoff + fr->_height > _itemArea.h) {
_displayDragging = false;
return false;
}
diff --git a/engines/ultima/ultima8/gumps/gump.cpp b/engines/ultima/ultima8/gumps/gump.cpp
index e74368d..f9140d4 100644
--- a/engines/ultima/ultima8/gumps/gump.cpp
+++ b/engines/ultima/ultima8/gumps/gump.cpp
@@ -83,8 +83,8 @@ void Gump::SetShape(FrameID frame, bool adjustsize) {
if (adjustsize && _shape) {
ShapeFrame *sf = _shape->getFrame(_frameNum);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
}
}
diff --git a/engines/ultima/ultima8/gumps/menu_gump.cpp b/engines/ultima/ultima8/gumps/menu_gump.cpp
index 862f533..a046149 100644
--- a/engines/ultima/ultima8/gumps/menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/menu_gump.cpp
@@ -96,15 +96,15 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
Shape *logoShape;
logoShape = GameData::get_instance()->getGumps()->getShape(paganShape);
sf = logoShape->getFrame(0);
assert(sf);
- Gump *logo = new Gump(42, 10, sf->width, sf->height);
+ Gump *logo = new Gump(42, 10, sf->_width, sf->_height);
logo->SetShape(logoShape, 0);
logo->InitGump(this, false);
diff --git a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
index 2405505..c26419d 100644
--- a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
+++ b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
@@ -71,8 +71,8 @@ void MiniStatsGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
}
void MiniStatsGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
diff --git a/engines/ultima/ultima8/gumps/paged_gump.cpp b/engines/ultima/ultima8/gumps/paged_gump.cpp
index 3517fbb..b21e512 100644
--- a/engines/ultima/ultima8/gumps/paged_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paged_gump.cpp
@@ -63,8 +63,8 @@ void PagedGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
FrameID buttonleft(GameData::GUMPS, pageOverShape, 0);
FrameID buttonright(GameData::GUMPS, pageOverShape, 1);
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
index 0a6660b..d561469 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
@@ -303,8 +303,8 @@ bool PaperdollGump::StartDraggingItem(Item *item, int mx, int my) {
ShapeFrame *frame = s->getFrame(item->getFrame());
assert(frame);
- Mouse::get_instance()->setDraggingOffset(frame->width / 2 - frame->xoff,
- frame->height / 2 - frame->yoff);
+ Mouse::get_instance()->setDraggingOffset(frame->_width / 2 - frame->_xoff,
+ frame->_height / 2 - frame->_yoff);
return ret;
}
diff --git a/engines/ultima/ultima8/gumps/quit_gump.cpp b/engines/ultima/ultima8/gumps/quit_gump.cpp
index e1f874c..21f797d 100644
--- a/engines/ultima/ultima8/gumps/quit_gump.cpp
+++ b/engines/ultima/ultima8/gumps/quit_gump.cpp
@@ -60,8 +60,8 @@ void QuitGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
FrameID askshape(GameData::GUMPS, askShapeId, 0);
askshape = _TL_SHP_(askshape);
@@ -70,7 +70,7 @@ void QuitGump::InitGump(Gump *newparent, bool take_focus) {
sf = askShape->getFrame(askshape._frameNum);
assert(sf);
- Gump *ask = new Gump(0, 0, sf->width, sf->height);
+ Gump *ask = new Gump(0, 0, sf->_width, sf->_height);
ask->SetShape(askShape, askshape._frameNum);
ask->InitGump(this);
ask->setRelativePosition(TOP_CENTER, 0, 5);
diff --git a/engines/ultima/ultima8/gumps/readable_gump.cpp b/engines/ultima/ultima8/gumps/readable_gump.cpp
index b1f4aab..fcde806 100644
--- a/engines/ultima/ultima8/gumps/readable_gump.cpp
+++ b/engines/ultima/ultima8/gumps/readable_gump.cpp
@@ -66,8 +66,8 @@ void ReadableGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = shape_->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
if (CoreApp::get_instance()->getGameInfo()->language ==
GameInfo::GAMELANG_JAPANESE) {
diff --git a/engines/ultima/ultima8/gumps/scroll_gump.cpp b/engines/ultima/ultima8/gumps/scroll_gump.cpp
index c27ff1d..bae97e3 100644
--- a/engines/ultima/ultima8/gumps/scroll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/scroll_gump.cpp
@@ -70,8 +70,8 @@ void ScrollGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = shape_->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
}
void ScrollGump::NextText() {
diff --git a/engines/ultima/ultima8/gumps/slider_gump.cpp b/engines/ultima/ultima8/gumps/slider_gump.cpp
index fa11eea..0c16088 100644
--- a/engines/ultima/ultima8/gumps/slider_gump.cpp
+++ b/engines/ultima/ultima8/gumps/slider_gump.cpp
@@ -131,8 +131,8 @@ void SliderGump::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(0);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
Shape *childshape = GameData::get_instance()->
getGumps()->getShape(slidershape);
diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
index 4cf6ac2..117053d 100644
--- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp
+++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
@@ -72,8 +72,8 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
Shape *entryShape;
entryShape = GameData::get_instance()->getShape(entry_id);
ShapeFrame *sf = entryShape->getFrame(entry_id._frameNum);
- int entrywidth = sf->width;
- int entryheight = sf->height;
+ int entrywidth = sf->_width;
+ int entryheight = sf->_height;
if (_save)
_editWidgets.resize(6); // constant!
@@ -102,7 +102,7 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
entrynum1_id = _TL_SHP_(entrynum1_id);
entryShape = GameData::get_instance()->getShape(entrynum1_id);
sf = entryShape->getFrame(entrynum1_id._frameNum);
- x_ += 1 + sf->width;
+ x_ += 1 + sf->_width;
gump = new Gump(xbase + 2 + entrywidth, 3 + 40 * yi, 1, 1);
gump->SetShape(entrynum1_id, true);
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
index 491f76d..7bde38b 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
@@ -85,8 +85,8 @@ void ButtonWidget::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
}
}
diff --git a/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp b/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
index d9fe0e4..1a488f3 100644
--- a/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
@@ -52,8 +52,8 @@ void SlidingWidget::InitGump(Gump *newparent, bool take_focus) {
ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
- _dims.w = sf->width;
- _dims.h = sf->height;
+ _dims.w = sf->_width;
+ _dims.h = sf->_height;
}
uint16 SlidingWidget::TraceObjId(int32 mx, int32 my) {
diff --git a/engines/ultima/ultima8/world/item_sorter.cpp b/engines/ultima/ultima8/world/item_sorter.cpp
index e33c278..81cd167 100644
--- a/engines/ultima/ultima8/world/item_sorter.cpp
+++ b/engines/ultima/ultima8/world/item_sorter.cpp
@@ -713,13 +713,13 @@ void ItemSorter::AddItem(int32 x, int32 y, int32 z, uint32 shape_num, uint32 fra
// si->sybot += sho2;
// Real Screenspace coords
- si->sx = si->sxbot - frame->xoff; // Left
- si->sy = si->sybot - frame->yoff; // Top
- si->sx2 = si->sx + frame->width; // Right
- si->sy2 = si->sy + frame->height; // Bottom
+ si->sx = si->sxbot - frame->_xoff; // Left
+ si->sy = si->sybot - frame->_yoff; // Top
+ si->sx2 = si->sx + frame->_width; // Right
+ si->sy2 = si->sy + frame->_height; // Bottom
// Do Clipping here
- si->clipped = surf->CheckClipped(Rect(si->sx, si->sy, frame->width, frame->height));
+ si->clipped = surf->CheckClipped(Rect(si->sx, si->sy, frame->_width, frame->_height));
if (si->clipped < 0) return;
// These help out with sorting. We calc them now, so it will be faster
@@ -890,13 +890,13 @@ void ItemSorter::AddItem(Item *add) {
// si->sybot += sho2;
// Real Screenspace coords
- si->sx = si->sxbot - frame->xoff; // Left
- si->sy = si->sybot - frame->yoff; // Top
- si->sx2 = si->sx + frame->width; // Right
- si->sy2 = si->sy + frame->height; // Bottom
+ si->sx = si->sxbot - frame->_xoff; // Left
+ si->sy = si->sybot - frame->_yoff; // Top
+ si->sx2 = si->sx + frame->_width; // Right
+ si->sy2 = si->sy + frame->_height; // Bottom
// Do Clipping here
- si->clipped = surf->CheckClipped(Rect(si->sx, si->sy, frame->width, frame->height));
+ si->clipped = surf->CheckClipped(Rect(si->sx, si->sy, frame->_width, frame->_height));
if (si->clipped < 0) return;
// These help out with sorting. We calc them now, so it will be faster
More information about the Scummvm-git-logs
mailing list