aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorMax Horn2003-10-04 01:09:29 +0000
committerMax Horn2003-10-04 01:09:29 +0000
commit2162df92fc5efbe64bce31c91d880c47e1daa44d (patch)
tree3fba0152ccea9440f760e53031023210e0d6e8f0 /sword2
parent3ef5a410a3337b323b40fc6828df7d11aa4016ae (diff)
downloadscummvm-rg350-2162df92fc5efbe64bce31c91d880c47e1daa44d.tar.gz
scummvm-rg350-2162df92fc5efbe64bce31c91d880c47e1daa44d.tar.bz2
scummvm-rg350-2162df92fc5efbe64bce31c91d880c47e1daa44d.zip
removed Sword2 prefixes of most classes (made obsolete by our namespace usage); renamed Sword2State to Sword2Engine
svn-id: r10583
Diffstat (limited to 'sword2')
-rw-r--r--sword2/controls.cpp274
-rw-r--r--sword2/controls.h6
-rw-r--r--sword2/driver/d_sound.cpp94
-rw-r--r--sword2/driver/d_sound.h16
-rw-r--r--sword2/driver/rdwin.cpp2
-rw-r--r--sword2/mem_view.cpp6
-rw-r--r--sword2/memory.cpp22
-rw-r--r--sword2/memory.h4
-rw-r--r--sword2/resman.cpp44
-rw-r--r--sword2/resman.h4
-rw-r--r--sword2/sword2.cpp18
-rw-r--r--sword2/sword2.h10
12 files changed, 250 insertions, 250 deletions
diff --git a/sword2/controls.cpp b/sword2/controls.cpp
index dab2620b2a..9840820d4e 100644
--- a/sword2/controls.cpp
+++ b/sword2/controls.cpp
@@ -44,7 +44,7 @@ namespace Sword2 {
// our fonts start on SPACE character (32)
#define SIZE_OF_CHAR_SET (256 - 32)
-Sword2Gui gui;
+Gui gui;
enum {
kAlignLeft,
@@ -52,7 +52,7 @@ enum {
kAlignCenter
};
-class Sword2FontRenderer {
+class FontRenderer {
private:
struct Glyph {
uint8 *_data;
@@ -62,7 +62,7 @@ private:
int _fontId;
public:
- Sword2FontRenderer(int fontId) : _fontId(fontId) {
+ FontRenderer(int fontId) : _fontId(fontId) {
uint8 *font = res_man.open(fontId);
_frameHeader *head;
_spriteInfo sprite;
@@ -82,7 +82,7 @@ public:
res_man.close(fontId);
}
- ~Sword2FontRenderer() {
+ ~FontRenderer() {
for (int i = 0; i < SIZE_OF_CHAR_SET; i++)
DeleteSurface(_glyph[i]._data);
}
@@ -119,7 +119,7 @@ public:
void drawText(int textId, int x, int y, int alignment = kAlignLeft);
};
-void Sword2FontRenderer::drawText(char *text, int x, int y, int alignment) {
+void FontRenderer::drawText(char *text, int x, int y, int alignment) {
_spriteInfo sprite;
int i;
@@ -149,23 +149,23 @@ void Sword2FontRenderer::drawText(char *text, int x, int y, int alignment) {
}
}
-void Sword2FontRenderer::drawText(int textId, int x, int y, int alignment) {
+void FontRenderer::drawText(int textId, int x, int y, int alignment) {
char text[MAX_STRING_LEN];
fetchText(textId, text);
drawText(text, x, y, alignment);
}
-class Sword2Dialog;
+class Dialog;
typedef struct Surface {
uint8 *_surface;
bool _original;
} WidgetSurface;
-class Sword2Widget {
+class Widget {
protected:
- Sword2Dialog *_parent;
+ Dialog *_parent;
_spriteInfo *_sprites;
WidgetSurface *_surfaces;
@@ -175,7 +175,7 @@ protected:
Common::Rect _hitRect;
public:
- Sword2Widget(Sword2Dialog *parent, int states) :
+ Widget(Dialog *parent, int states) :
_parent(parent), _numStates(states), _state(0) {
_sprites = (_spriteInfo *) calloc(states, sizeof(_spriteInfo));
_surfaces = (WidgetSurface *) calloc(states, sizeof(WidgetSurface));
@@ -183,7 +183,7 @@ public:
_hitRect.left = _hitRect.right = _hitRect.top = _hitRect.bottom = -1;
}
- virtual ~Sword2Widget() {
+ virtual ~Widget() {
for (int i = 0; i < _numStates; i++) {
if (_surfaces[i]._original)
DeleteSurface(_surfaces[i]._surface);
@@ -193,14 +193,14 @@ public:
}
void createSurfaceImage(int state, uint32 res, int x, int y, uint32 pc);
- void linkSurfaceImage(Sword2Widget *from, int state, int x, int y);
+ void linkSurfaceImage(Widget *from, int state, int x, int y);
void createSurfaceImages(uint32 res, int x, int y) {
for (int i = 0; i < _numStates; i++)
createSurfaceImage(i, res, x, y, i);
}
- void linkSurfaceImages(Sword2Widget *from, int x, int y) {
+ void linkSurfaceImages(Widget *from, int x, int y) {
for (int i = 0; i < from->_numStates; i++)
linkSurfaceImage(from, i, x, y);
}
@@ -242,7 +242,7 @@ public:
virtual void releaseMouse(int x, int y) {}
};
-void Sword2Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint32 pc) {
+void Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint32 pc) {
uint8 *file, *colTablePtr = NULL;
_animHeader *anim_head;
_frameHeader *frame_head;
@@ -298,7 +298,7 @@ void Sword2Widget::createSurfaceImage(int state, uint32 res, int x, int y, uint3
res_man.close(res);
};
-void Sword2Widget::linkSurfaceImage(Sword2Widget *from, int state, int x, int y) {
+void Widget::linkSurfaceImage(Widget *from, int state, int x, int y) {
_sprites[state].x = x;
_sprites[state].y = y;
_sprites[state].w = from->_sprites[state].w;
@@ -313,30 +313,30 @@ void Sword2Widget::linkSurfaceImage(Sword2Widget *from, int state, int x, int y)
#define MAX_WIDGETS 25
-class Sword2Dialog {
+class Dialog {
private:
int _numWidgets;
- Sword2Widget *_widgets[MAX_WIDGETS];
+ Widget *_widgets[MAX_WIDGETS];
bool _finish;
int _result;
public:
- Sword2Dialog() : _numWidgets(0), _finish(false), _result(0) {
+ Dialog() : _numWidgets(0), _finish(false), _result(0) {
SetFullPalette(CONTROL_PANEL_PALETTE);
}
- virtual ~Sword2Dialog() {
+ virtual ~Dialog() {
for (int i = 0; i < _numWidgets; i++)
delete _widgets[i];
}
- void registerWidget(Sword2Widget *widget) {
+ void registerWidget(Widget *widget) {
if (_numWidgets < MAX_WIDGETS) {
_widgets[_numWidgets++] = widget;
}
}
- virtual void onAction(Sword2Widget *widget, int result = 0) {}
+ virtual void onAction(Widget *widget, int result = 0) {}
virtual void paint() {
EraseBackBuffer();
@@ -352,7 +352,7 @@ public:
int run();
};
-int Sword2Dialog::run() {
+int Dialog::run() {
int i;
paint();
@@ -424,10 +424,10 @@ int Sword2Dialog::run() {
return _result;
}
-class Sword2Button : public Sword2Widget {
+class Button : public Widget {
public:
- Sword2Button(Sword2Dialog *parent, int x, int y, int w, int h) :
- Sword2Widget(parent, 2) {
+ Button(Dialog *parent, int x, int y, int w, int h) :
+ Widget(parent, 2) {
setHitRect(x, y, w, h);
}
@@ -447,13 +447,13 @@ public:
}
};
-class Sword2ScrollButton : public Sword2Widget {
+class ScrollButton : public Widget {
private:
uint32 _holdCounter;
public:
- Sword2ScrollButton(Sword2Dialog *parent, int x, int y, int w, int h) :
- Sword2Widget(parent, 2), _holdCounter(0) {
+ ScrollButton(Dialog *parent, int x, int y, int w, int h) :
+ Widget(parent, 2), _holdCounter(0) {
setHitRect(x, y, w, h);
}
@@ -480,14 +480,14 @@ public:
}
};
-class Sword2Switch : public Sword2Widget {
+class Switch : public Widget {
private:
bool _holding, _value;
int _upState, _downState;
public:
- Sword2Switch(Sword2Dialog *parent, int x, int y, int w, int h) :
- Sword2Widget(parent, 2), _holding(false),
+ Switch(Dialog *parent, int x, int y, int w, int h) :
+ Widget(parent, 2), _holding(false),
_value(false), _upState(0), _downState(1) {
setHitRect(x, y, w, h);
}
@@ -537,9 +537,9 @@ public:
}
};
-class Sword2Slider : public Sword2Widget {
+class Slider : public Widget {
private:
- Sword2Widget *_background;
+ Widget *_background;
bool _dragging;
int _value, _targetValue;
int _maxValue;
@@ -554,9 +554,9 @@ private:
}
public:
- Sword2Slider(Sword2Dialog *parent, Sword2Widget *background, int max,
- int x, int y, int w, int h, Sword2Widget *base = NULL) :
- Sword2Widget(parent, 1), _background(background),
+ Slider(Dialog *parent, Widget *background, int max,
+ int x, int y, int w, int h, Widget *base = NULL) :
+ Widget(parent, 1), _background(background),
_dragging(false), _value(0), _targetValue(0),
_maxValue(max) {
setHitRect(x, y, w, h);
@@ -572,7 +572,7 @@ public:
// but I doubt that will make any noticeable difference.
_background->paint(&_hitRect);
- Sword2Widget::paint(clipRect);
+ Widget::paint(clipRect);
}
void setValue(int value) {
@@ -654,25 +654,25 @@ public:
}
};
-class Sword2MiniDialog : public Sword2Dialog {
+class MiniDialog : public Dialog {
private:
int _textId;
- Sword2FontRenderer *_fontRenderer;
- Sword2Widget *_panel;
- Sword2Button *_okButton;
- Sword2Button *_cancelButton;
+ FontRenderer *_fontRenderer;
+ Widget *_panel;
+ Button *_okButton;
+ Button *_cancelButton;
public:
- Sword2MiniDialog(uint32 textId) : _textId(textId) {
- _fontRenderer = new Sword2FontRenderer(controls_font_id);
+ MiniDialog(uint32 textId) : _textId(textId) {
+ _fontRenderer = new FontRenderer(controls_font_id);
- _panel = new Sword2Widget(this, 1);
+ _panel = new Widget(this, 1);
_panel->createSurfaceImages(1996, 203, 104);
- _okButton = new Sword2Button(this, 243, 214, 24, 24);
+ _okButton = new Button(this, 243, 214, 24, 24);
_okButton->createSurfaceImages(2002, 243, 214);
- _cancelButton = new Sword2Button(this, 243, 276, 24, 24);
+ _cancelButton = new Button(this, 243, 276, 24, 24);
_cancelButton->linkSurfaceImages(_okButton, 243, 276);
registerWidget(_panel);
@@ -680,19 +680,19 @@ public:
registerWidget(_cancelButton);
}
- ~Sword2MiniDialog() {
+ ~MiniDialog() {
delete _fontRenderer;
}
virtual void paint() {
- Sword2Dialog::paint();
+ Dialog::paint();
_fontRenderer->drawText(_textId, 310, 134, kAlignCenter);
_fontRenderer->drawText(149618688, 270, 214); // ok
_fontRenderer->drawText(149618689, 270, 276); // cancel
}
- virtual void onAction(Sword2Widget *widget, int result = 0) {
+ virtual void onAction(Widget *widget, int result = 0) {
if (widget == _okButton)
setResult(1);
else if (widget == _cancelButton)
@@ -700,66 +700,66 @@ public:
}
};
-class Sword2OptionsDialog : public Sword2Dialog {
+class OptionsDialog : public Dialog {
private:
- Sword2FontRenderer *_fontRenderer;
- Sword2Widget *_panel;
- Sword2Switch *_objectLabelsSwitch;
- Sword2Switch *_subtitlesSwitch;
- Sword2Switch *_reverseStereoSwitch;
- Sword2Switch *_musicSwitch;
- Sword2Switch *_speechSwitch;
- Sword2Switch *_fxSwitch;
- Sword2Slider *_musicSlider;
- Sword2Slider *_speechSlider;
- Sword2Slider *_fxSlider;
- Sword2Slider *_gfxSlider;
- Sword2Widget *_gfxPreview;
- Sword2Button *_okButton;
- Sword2Button *_cancelButton;
+ FontRenderer *_fontRenderer;
+ Widget *_panel;
+ Switch *_objectLabelsSwitch;
+ Switch *_subtitlesSwitch;
+ Switch *_reverseStereoSwitch;
+ Switch *_musicSwitch;
+ Switch *_speechSwitch;
+ Switch *_fxSwitch;
+ Slider *_musicSlider;
+ Slider *_speechSlider;
+ Slider *_fxSlider;
+ Slider *_gfxSlider;
+ Widget *_gfxPreview;
+ Button *_okButton;
+ Button *_cancelButton;
int32 writeOptionSettings(void);
public:
- Sword2OptionsDialog() {
- _fontRenderer = new Sword2FontRenderer(controls_font_id);
+ OptionsDialog() {
+ _fontRenderer = new FontRenderer(controls_font_id);
- _panel = new Sword2Widget(this, 1);
+ _panel = new Widget(this, 1);
_panel->createSurfaceImages(3405, 0, 40);
- _objectLabelsSwitch = new Sword2Switch(this, 304, 100, 53, 32);
+ _objectLabelsSwitch = new Switch(this, 304, 100, 53, 32);
_objectLabelsSwitch->createSurfaceImages(3687, 304, 100);
- _subtitlesSwitch = new Sword2Switch(this, 510, 100, 53, 32);
+ _subtitlesSwitch = new Switch(this, 510, 100, 53, 32);
_subtitlesSwitch->linkSurfaceImages(_objectLabelsSwitch, 510, 100);
- _reverseStereoSwitch = new Sword2Switch(this, 304, 293, 53, 32);
+ _reverseStereoSwitch = new Switch(this, 304, 293, 53, 32);
_reverseStereoSwitch->linkSurfaceImages(_objectLabelsSwitch, 304, 293);
- _musicSwitch = new Sword2Switch(this, 516, 157, 40, 32);
+ _musicSwitch = new Switch(this, 516, 157, 40, 32);
_musicSwitch->createSurfaceImages(3315, 516, 157);
_musicSwitch->reverseStates();
- _speechSwitch = new Sword2Switch(this, 516, 205, 40, 32);
+ _speechSwitch = new Switch(this, 516, 205, 40, 32);
_speechSwitch->linkSurfaceImages(_musicSwitch, 516, 205);
_speechSwitch->reverseStates();
- _fxSwitch = new Sword2Switch(this, 516, 250, 40, 32);
+ _fxSwitch = new Switch(this, 516, 250, 40, 32);
_fxSwitch->linkSurfaceImages(_musicSwitch, 516, 250);
_fxSwitch->reverseStates();
- _musicSlider = new Sword2Slider(this, _panel, 16, 309, 161, 170, 27);
- _speechSlider = new Sword2Slider(this, _panel, 14, 309, 208, 170, 27, _musicSlider);
- _fxSlider = new Sword2Slider(this, _panel, 14, 309, 254, 170, 27, _musicSlider);
- _gfxSlider = new Sword2Slider(this, _panel, 3, 309, 341, 170, 27, _musicSlider);
+ _musicSlider = new Slider(this, _panel, 16, 309, 161, 170, 27);
+ _speechSlider = new Slider(this, _panel, 14, 309, 208, 170, 27, _musicSlider);
+ _fxSlider = new Slider(this, _panel, 14, 309, 254, 170, 27, _musicSlider);
+ _gfxSlider = new Slider(this, _panel, 3, 309, 341, 170, 27, _musicSlider);
- _gfxPreview = new Sword2Widget(this, 4);
+ _gfxPreview = new Widget(this, 4);
_gfxPreview->createSurfaceImages(256, 495, 310);
- _okButton = new Sword2Button(this, 203, 382, 53, 32);
+ _okButton = new Button(this, 203, 382, 53, 32);
_okButton->createSurfaceImages(901, 203, 382);
- _cancelButton = new Sword2Button(this, 395, 382, 53, 32);
+ _cancelButton = new Button(this, 395, 382, 53, 32);
_cancelButton->linkSurfaceImages(_okButton, 395, 382);
registerWidget(_panel);
@@ -792,12 +792,12 @@ public:
_gfxPreview->setState(GetRenderType());
}
- ~Sword2OptionsDialog() {
+ ~OptionsDialog() {
delete _fontRenderer;
}
virtual void paint() {
- Sword2Dialog::paint();
+ Dialog::paint();
int maxWidth = 0;
int width;
@@ -839,7 +839,7 @@ public:
_fontRenderer->drawText(149618689, 385, 382, kAlignRight);
}
- virtual void onAction(Sword2Widget *widget, int result = 0) {
+ virtual void onAction(Widget *widget, int result = 0) {
// Since there is music playing while the dialog is displayed
// we need to update music volume immediately. Everything else
// is handled when the dialog is terminated.
@@ -887,7 +887,7 @@ public:
}
};
-int32 Sword2OptionsDialog::writeOptionSettings(void) {
+int32 OptionsDialog::writeOptionSettings(void) {
uint8 buff[10];
char filename[256];
SaveFile *fp;
@@ -932,17 +932,17 @@ enum {
kCursorTick = 1
};
-class Sword2Slot : public Sword2Widget {
+class Slot : public Widget {
private:
int _mode;
- Sword2FontRenderer *_fr;
+ FontRenderer *_fr;
char _text[SAVE_DESCRIPTION_LEN];
bool _clickable;
bool _editable;
public:
- Sword2Slot(Sword2Dialog *parent, int x, int y, int w, int h) :
- Sword2Widget(parent, 2), _clickable(false),
+ Slot(Dialog *parent, int x, int y, int w, int h) :
+ Widget(parent, 2), _clickable(false),
_editable(false) {
setHitRect(x, y, w, h);
_text[0] = 0;
@@ -964,7 +964,7 @@ public:
return _editable;
}
- void setText(Sword2FontRenderer *fr, int slot, char *text) {
+ void setText(FontRenderer *fr, int slot, char *text) {
_fr = fr;
if (text)
sprintf(_text, "%d. %s", slot, text);
@@ -977,7 +977,7 @@ public:
}
virtual void paint(Common::Rect *clipRect = NULL) {
- Sword2Widget::paint();
+ Widget::paint();
// HACK: The main dialog is responsible for drawing the text
// when in editing mode.
@@ -1025,66 +1025,66 @@ public:
}
};
-class Sword2SaveLoadDialog : public Sword2Dialog {
+class SaveLoadDialog : public Dialog {
private:
int _mode, _selectedSlot;
char _editBuffer[SAVE_DESCRIPTION_LEN];
int _editPos, _firstPos;
int _cursorTick;
- Sword2FontRenderer *_fontRenderer1;
- Sword2FontRenderer *_fontRenderer2;
- Sword2Widget *_panel;
- Sword2Slot *_slotButton[8];
- Sword2ScrollButton *_zupButton;
- Sword2ScrollButton *_upButton;
- Sword2ScrollButton *_downButton;
- Sword2ScrollButton *_zdownButton;
- Sword2Button *_okButton;
- Sword2Button *_cancelButton;
+ FontRenderer *_fontRenderer1;
+ FontRenderer *_fontRenderer2;
+ Widget *_panel;
+ Slot *_slotButton[8];
+ ScrollButton *_zupButton;
+ ScrollButton *_upButton;
+ ScrollButton *_downButton;
+ ScrollButton *_zdownButton;
+ Button *_okButton;
+ Button *_cancelButton;
void saveLoadError(char *text);
public:
- Sword2SaveLoadDialog(int mode) : _mode(mode), _selectedSlot(-1) {
+ SaveLoadDialog(int mode) : _mode(mode), _selectedSlot(-1) {
int i;
// FIXME: The "control font" and the "red font" are currently
// always the same font, so one should be eliminated.
- _fontRenderer1 = new Sword2FontRenderer(controls_font_id);
- _fontRenderer2 = new Sword2FontRenderer(red_font_id);
+ _fontRenderer1 = new FontRenderer(controls_font_id);
+ _fontRenderer2 = new FontRenderer(red_font_id);
- _panel = new Sword2Widget(this, 1);
+ _panel = new Widget(this, 1);
_panel->createSurfaceImages(2016, 0, 40);
for (i = 0; i < 4; i++) {
- _slotButton[i] = new Sword2Slot(this, 114, 0, 384, 36);
+ _slotButton[i] = new Slot(this, 114, 0, 384, 36);
_slotButton[i]->createSurfaceImages(2006 + i, 114, 0);
_slotButton[i]->setMode(mode);
- _slotButton[i + 4] = new Sword2Slot(this, 114, 0, 384, 36);
+ _slotButton[i + 4] = new Slot(this, 114, 0, 384, 36);
_slotButton[i + 4]->linkSurfaceImages(_slotButton[i], 114, 0);
_slotButton[i + 4]->setMode(mode);
}
updateSlots();
- _zupButton = new Sword2ScrollButton(this, 516, 65, 17, 17);
+ _zupButton = new ScrollButton(this, 516, 65, 17, 17);
_zupButton->createSurfaceImages(1982, 516, 65);
- _upButton = new Sword2ScrollButton(this, 516, 85, 17, 17);
+ _upButton = new ScrollButton(this, 516, 85, 17, 17);
_upButton->createSurfaceImages(2067, 516, 85);
- _downButton = new Sword2ScrollButton(this, 516, 329, 17, 17);
+ _downButton = new ScrollButton(this, 516, 329, 17, 17);
_downButton->createSurfaceImages(1986, 516, 329);
- _zdownButton = new Sword2ScrollButton(this, 516, 350, 17, 17);
+ _zdownButton = new ScrollButton(this, 516, 350, 17, 17);
_zdownButton->createSurfaceImages(1988, 516, 350);
- _okButton = new Sword2Button(this, 130, 377, 24, 24);
+ _okButton = new Button(this, 130, 377, 24, 24);
_okButton->createSurfaceImages(2002, 130, 377);
- _cancelButton = new Sword2Button(this, 350, 377, 24, 24);
+ _cancelButton = new Button(this, 350, 377, 24, 24);
_cancelButton->linkSurfaceImages(_okButton, 350, 377);
registerWidget(_panel);
@@ -1100,7 +1100,7 @@ public:
registerWidget(_cancelButton);
}
- ~Sword2SaveLoadDialog() {
+ ~SaveLoadDialog() {
delete _fontRenderer1;
delete _fontRenderer2;
}
@@ -1110,8 +1110,8 @@ public:
void updateSlots() {
for (int i = 0; i < 8; i++) {
- Sword2Slot *slot = _slotButton[(gui._baseSlot + i) % 8];
- Sword2FontRenderer *fr;
+ Slot *slot = _slotButton[(gui._baseSlot + i) % 8];
+ FontRenderer *fr;
uint8 description[SAVE_DESCRIPTION_LEN];
slot->setY(72 + i * 36);
@@ -1141,7 +1141,7 @@ public:
}
}
- virtual void onAction(Sword2Widget *widget, int result = 0) {
+ virtual void onAction(Widget *widget, int result = 0) {
if (widget == _zupButton) {
if (gui._baseSlot > 0) {
if (gui._baseSlot >= 8)
@@ -1173,7 +1173,7 @@ public:
} else if (widget == _cancelButton) {
setResult(0);
} else {
- Sword2Slot *slot = (Sword2Slot *) widget;
+ Slot *slot = (Slot *) widget;
if (result >= kStartEditing) {
if (result == kStartEditing) {
@@ -1243,7 +1243,7 @@ public:
}
}
- void drawEditBuffer(Sword2Slot *slot) {
+ void drawEditBuffer(Slot *slot) {
if (_selectedSlot == -1)
return;
@@ -1255,7 +1255,7 @@ public:
}
virtual void paint() {
- Sword2Dialog::paint();
+ Dialog::paint();
if (_mode == kLoadDialog) {
// Restore
@@ -1272,7 +1272,7 @@ public:
// Cancel
if (result == 0) {
- Sword2Dialog::setResult(result);
+ Dialog::setResult(result);
return;
}
@@ -1340,11 +1340,11 @@ public:
}
}
- Sword2Dialog::setResult(result);
+ Dialog::setResult(result);
}
};
-void Sword2SaveLoadDialog::saveLoadError(char* text) {
+void SaveLoadDialog::saveLoadError(char* text) {
// Print a message on screen. Second parameter is duration.
DisplayMsg((uint8 *) text, 0);
@@ -1373,21 +1373,21 @@ void Sword2SaveLoadDialog::saveLoadError(char* text) {
RemoveMsg();
}
-uint32 Sword2Gui::restoreControl(void) {
+uint32 Gui::restoreControl(void) {
// returns 0 for no restore
// 1 for restored ok
- Sword2SaveLoadDialog loadDialog(kLoadDialog);
+ SaveLoadDialog loadDialog(kLoadDialog);
return loadDialog.run();
}
-void Sword2Gui::saveControl(void) {
- Sword2SaveLoadDialog saveDialog(kSaveDialog);
+void Gui::saveControl(void) {
+ SaveLoadDialog saveDialog(kSaveDialog);
saveDialog.run();
}
-void Sword2Gui::quitControl(void) {
- Sword2MiniDialog quitDialog(149618692); // quit text
+void Gui::quitControl(void) {
+ MiniDialog quitDialog(149618692); // quit text
if (!quitDialog.run()) {
// just return to game
@@ -1400,10 +1400,10 @@ void Sword2Gui::quitControl(void) {
exit(0);
}
-void Sword2Gui::restartControl(void) {
+void Gui::restartControl(void) {
uint32 temp_demo_flag;
- Sword2MiniDialog restartDialog(149618693); // restart text
+ MiniDialog restartDialog(149618693); // restart text
if (!restartDialog.run()) {
// just return to game
@@ -1466,7 +1466,7 @@ void Sword2Gui::restartControl(void) {
this_screen.new_palette = 99;
}
-int32 Sword2Gui::readOptionSettings(void) {
+int32 Gui::readOptionSettings(void) {
// settings file is 9 bytes long:
// 1 music volume
// 2 speech volume
@@ -1517,14 +1517,14 @@ int32 Sword2Gui::readOptionSettings(void) {
return 0;
}
-void Sword2Gui::optionControl(void) {
- Sword2OptionsDialog optionsDialog;
+void Gui::optionControl(void) {
+ OptionsDialog optionsDialog;
optionsDialog.run();
return;
}
-void Sword2Gui::updateGraphicsLevel(uint8 newLevel) {
+void Gui::updateGraphicsLevel(uint8 newLevel) {
switch (newLevel) {
case 0:
// Lowest setting: no graphics fx
diff --git a/sword2/controls.h b/sword2/controls.h
index 3124e155b9..49e06f0274 100644
--- a/sword2/controls.h
+++ b/sword2/controls.h
@@ -22,7 +22,7 @@
namespace Sword2 {
-class Sword2Gui {
+class Gui {
public:
int _baseSlot;
uint8 _currentGraphicsLevel;
@@ -32,7 +32,7 @@ public:
uint8 _stereoReversed;
uint8 _pointerTextSelected;
- Sword2Gui() : _baseSlot(0), _stereoReversed(0),
+ Gui() : _baseSlot(0), _stereoReversed(0),
_pointerTextSelected(0) {}
uint32 restoreControl(void);
@@ -44,7 +44,7 @@ public:
void updateGraphicsLevel(uint8 newLevel);
};
-extern Sword2Gui gui;
+extern Gui gui;
} // End of namespace Sword2
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 3a21975fa5..66435dedcc 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -65,7 +65,7 @@ static int32 musicVolTable[17] = {
143, 159, 175, 191, 207, 223, 239, 255
};
-int16 Sword2MusicHandle::read() {
+int16 MusicHandle::read() {
uint8 in;
uint16 delta;
int16 out;
@@ -117,17 +117,17 @@ int16 Sword2MusicHandle::read() {
return out;
}
-bool Sword2MusicHandle::eos() const {
+bool MusicHandle::eos() const {
if (!_streaming || _filePos >= _fileEnd)
return true;
return false;
}
static void premix_proc(void *param, int16 *data, uint len) {
- ((Sword2Sound *) param)->fxServer(data, len);
+ ((Sound *) param)->fxServer(data, len);
}
-Sword2Sound::Sword2Sound(SoundMixer *mixer) {
+Sound::Sound(SoundMixer *mixer) {
_mutex = g_system->create_mutex();
_soundOn = 0;
@@ -153,7 +153,7 @@ Sword2Sound::Sword2Sound(SoundMixer *mixer) {
_mixer->setupPremix(premix_proc, this);
}
-Sword2Sound::~Sword2Sound() {
+Sound::~Sound() {
if (_mutex)
g_system->delete_mutex(_mutex);
}
@@ -168,7 +168,7 @@ Sword2Sound::~Sword2Sound() {
* This function reverses the pan table, thus reversing the stereo.
*/
-void Sword2Sound::reverseStereo(void) {
+void Sound::reverseStereo(void) {
for (int i = 0; i < 16; i++) {
int j = panTable[i];
panTable[i] = panTable[32 - i];
@@ -179,7 +179,7 @@ void Sword2Sound::reverseStereo(void) {
// Save/Restore information about current music so that we can restore it
// after the credits.
-void Sword2Sound::saveMusicState() {
+void Sound::saveMusicState() {
StackLock lock(_mutex);
int saveStream;
@@ -202,7 +202,7 @@ void Sword2Sound::saveMusicState() {
_music[2]._lastSample = _music[saveStream]._lastSample;
}
-void Sword2Sound::restoreMusicState() {
+void Sound::restoreMusicState() {
StackLock lock(_mutex);
int restoreStream;
@@ -232,7 +232,7 @@ void Sword2Sound::restoreMusicState() {
_music[restoreStream]._lastSample = _music[2]._lastSample;
}
-void Sword2Sound::playLeadOut(uint8 *leadOut) {
+void Sound::playLeadOut(uint8 *leadOut) {
int i;
if (!leadOut)
@@ -257,7 +257,7 @@ void Sword2Sound::playLeadOut(uint8 *leadOut) {
// This function returns the index of the sound effect with the ID passed in.
// --------------------------------------------------------------------------
-int32 Sword2Sound::getFxIndex(int32 id) {
+int32 Sound::getFxIndex(int32 id) {
for (int i = 0; i < MAXFX; i++) {
if (_fx[i]._id == id)
return i;
@@ -266,12 +266,12 @@ int32 Sword2Sound::getFxIndex(int32 id) {
return MAXFX;
}
-int32 Sword2Sound::isFxOpen(int32 id) {
+int32 Sound::isFxOpen(int32 id) {
// FIXME: This seems backwards to me, but changing it breaks sound.
return getFxIndex(id) == MAXFX;
}
-void Sword2Sound::fxServer(int16 *data, uint len) {
+void Sound::fxServer(int16 *data, uint len) {
StackLock lock(_mutex);
if (!_soundOn)
@@ -287,7 +287,7 @@ void Sword2Sound::fxServer(int16 *data, uint len) {
* Returns either RDSE_QUIET or RDSE_SPEAKING
*/
-int32 Sword2Sound::amISpeaking() {
+int32 Sound::amISpeaking() {
if (!_speechMuted && !_speechPaused && _soundHandleSpeech != 0)
return RDSE_SPEAKING;
@@ -303,7 +303,7 @@ int32 Sword2Sound::amISpeaking() {
* @param buf a pointer to the buffer that will be allocated for the sound
*/
-uint32 Sword2Sound::preFetchCompSpeech(const char *filename, uint32 speechid, uint16 **buf) {
+uint32 Sound::preFetchCompSpeech(const char *filename, uint32 speechid, uint16 **buf) {
uint32 i;
uint8 *data8;
uint32 speechIndex[2];
@@ -393,7 +393,7 @@ uint32 Sword2Sound::preFetchCompSpeech(const char *filename, uint32 speechid, ui
* @param pan panning, -16 (full left) to 16 (full right)
*/
-int32 Sword2Sound::playCompSpeech(const char *filename, uint32 speechid, uint8 vol, int8 pan) {
+int32 Sound::playCompSpeech(const char *filename, uint32 speechid, uint8 vol, int8 pan) {
uint16 *data16;
uint32 bufferSize;
@@ -432,7 +432,7 @@ int32 Sword2Sound::playCompSpeech(const char *filename, uint32 speechid, uint8 v
* Stops the speech from playing.
*/
-int32 Sword2Sound::stopSpeech(void) {
+int32 Sound::stopSpeech(void) {
if (!_soundOn)
return RD_OK;
@@ -448,7 +448,7 @@ int32 Sword2Sound::stopSpeech(void) {
* @return Either RDSE_SAMPLEPLAYING or RDSE_SAMPLEFINISHED
*/
-int32 Sword2Sound::getSpeechStatus(void) {
+int32 Sound::getSpeechStatus(void) {
if (!_soundOn || !_speechStatus)
return RDSE_SAMPLEFINISHED;
@@ -467,7 +467,7 @@ int32 Sword2Sound::getSpeechStatus(void) {
* @param volume volume, from 0 (silent) to 14 (max)
*/
-void Sword2Sound::setSpeechVolume(uint8 volume) {
+void Sound::setSpeechVolume(uint8 volume) {
_speechVol = volume;
if (_soundHandleSpeech != 0 && !_speechMuted && getSpeechStatus() == RDSE_SAMPLEPLAYING) {
g_engine->_mixer->setChannelVolume(_soundHandleSpeech, 16 * _speechVol);
@@ -478,7 +478,7 @@ void Sword2Sound::setSpeechVolume(uint8 volume) {
* @return the volume setting for speech
*/
-uint8 Sword2Sound::getSpeechVolume() {
+uint8 Sound::getSpeechVolume() {
return _speechVol;
}
@@ -488,7 +488,7 @@ uint8 Sword2Sound::getSpeechVolume() {
* Otherwise the speech is muted (volume 0).
*/
-void Sword2Sound::muteSpeech(uint8 mute) {
+void Sound::muteSpeech(uint8 mute) {
_speechMuted = mute;
if (getSpeechStatus() == RDSE_SAMPLEPLAYING) {
@@ -502,7 +502,7 @@ void Sword2Sound::muteSpeech(uint8 mute) {
* @return the speech's mute state, 1 if mute, 0 if not mute
*/
-uint8 Sword2Sound::isSpeechMute(void) {
+uint8 Sound::isSpeechMute(void) {
return _speechMuted;
}
@@ -510,7 +510,7 @@ uint8 Sword2Sound::isSpeechMute(void) {
* Stops the speech dead in its tracks.
*/
-void Sword2Sound::pauseSpeech(void) {
+void Sound::pauseSpeech(void) {
if (getSpeechStatus() == RDSE_SAMPLEPLAYING) {
_speechPaused = 1;
g_engine->_mixer->pauseHandle(_soundHandleSpeech, true);
@@ -521,7 +521,7 @@ void Sword2Sound::pauseSpeech(void) {
* Restarts the speech from where it was stopped.
*/
-void Sword2Sound::unpauseSpeech(void) {
+void Sound::unpauseSpeech(void) {
if (_speechPaused) {
_speechPaused = 0;
g_engine->_mixer->pauseHandle(_soundHandleSpeech, false);
@@ -536,7 +536,7 @@ void Sword2Sound::unpauseSpeech(void) {
* @warning Zero is not a valid id
*/
-int32 Sword2Sound::openFx(int32 id, uint8 *data) {
+int32 Sound::openFx(int32 id, uint8 *data) {
int32 i, fxi;
uint32 *data32 = NULL;
_wavHeader *wav;
@@ -632,7 +632,7 @@ int32 Sword2Sound::openFx(int32 id, uint8 *data) {
* @warning Zero is not a valid id
*/
-int32 Sword2Sound::playFx(int32 id, uint8 *data, uint8 vol, int8 pan, uint8 type) {
+int32 Sound::playFx(int32 id, uint8 *data, uint8 vol, int8 pan, uint8 type) {
int32 i, loop;
uint32 hr;
@@ -719,7 +719,7 @@ int32 Sword2Sound::playFx(int32 id, uint8 *data, uint8 vol, int8 pan, uint8 type
* @param pan panning
*/
-int32 Sword2Sound::setFxIdVolumePan(int32 id, uint8 vol, int8 pan) {
+int32 Sound::setFxIdVolumePan(int32 id, uint8 vol, int8 pan) {
int32 i = getFxIndex(id);
if (i == MAXFX)
@@ -733,7 +733,7 @@ int32 Sword2Sound::setFxIdVolumePan(int32 id, uint8 vol, int8 pan) {
return RD_OK;
}
-int32 Sword2Sound::setFxIdVolume(int32 id, uint8 vol) {
+int32 Sound::setFxIdVolume(int32 id, uint8 vol) {
int32 i = getFxIndex(id);
if (i == MAXFX)
@@ -751,7 +751,7 @@ int32 Sword2Sound::setFxIdVolume(int32 id, uint8 vol) {
* playing, irrespective of type.
*/
-void Sword2Sound::clearAllFx(void) {
+void Sound::clearAllFx(void) {
if (!_soundOn)
return;
@@ -777,7 +777,7 @@ void Sword2Sound::clearAllFx(void) {
* @param id the id of the sound to close
*/
-int32 Sword2Sound::closeFx(int32 id) {
+int32 Sound::closeFx(int32 id) {
int i;
if (!_soundOn)
@@ -801,7 +801,7 @@ int32 Sword2Sound::closeFx(int32 id) {
return RD_OK;
}
-void Sword2Sound::pauseFx(void) {
+void Sound::pauseFx(void) {
if (!_fxPaused) {
for (int i = 0; i < MAXFX; i++) {
if (_fx[i]._id) {
@@ -814,7 +814,7 @@ void Sword2Sound::pauseFx(void) {
}
}
-void Sword2Sound::pauseFxForSequence(void) {
+void Sound::pauseFxForSequence(void) {
if (!_fxPaused) {
for (int i = 0; i < MAXFX; i++) {
if (_fx[i]._id && _fx[i]._id != -2) {
@@ -828,7 +828,7 @@ void Sword2Sound::pauseFxForSequence(void) {
}
}
-void Sword2Sound::unpauseFx(void) {
+void Sound::unpauseFx(void) {
if (_fxPaused) {
for (int i = 0; i < MAXFX; i++) {
if (_fx[i]._paused && _fx[i]._id) {
@@ -843,7 +843,7 @@ void Sword2Sound::unpauseFx(void) {
* @return the master volume setting for sound effects
*/
-uint8 Sword2Sound::getFxVolume() {
+uint8 Sound::getFxVolume() {
return _fxVol;
}
@@ -853,7 +853,7 @@ uint8 Sword2Sound::getFxVolume() {
* @param volume volume, from 0 (silent) to 14 (max)
*/
-void Sword2Sound::setFxVolume(uint8 volume) {
+void Sound::setFxVolume(uint8 volume) {
_fxVol = volume;
// Now update the volume of any fxs playing
@@ -869,7 +869,7 @@ void Sword2Sound::setFxVolume(uint8 volume) {
* Otherwise the sound effects are muted (volume 0).
*/
-void Sword2Sound::muteFx(uint8 mute) {
+void Sound::muteFx(uint8 mute) {
_fxMuted = mute;
// Now update the volume of any fxs playing
@@ -886,7 +886,7 @@ void Sword2Sound::muteFx(uint8 mute) {
* @return the sound effects's mute state, 1 if mute, 0 if not mute
*/
-uint8 Sword2Sound::isFxMute(void) {
+uint8 Sound::isFxMute(void) {
return _fxMuted;
}
@@ -898,7 +898,7 @@ uint8 Sword2Sound::isFxMute(void) {
* @return RD_OK or an error code
*/
-int32 Sword2Sound::streamCompMusic(const char *filename, uint32 musicId, bool looping) {
+int32 Sound::streamCompMusic(const char *filename, uint32 musicId, bool looping) {
StackLock lock(_mutex);
uint32 len;
@@ -968,7 +968,7 @@ int32 Sword2Sound::streamCompMusic(const char *filename, uint32 musicId, bool lo
return RD_OK;
}
-void Sword2Sound::updateCompSampleStreaming(int16 *data, uint len) {
+void Sound::updateCompSampleStreaming(int16 *data, uint len) {
for (int i = 0; i < MAXMUS; i++) {
if (!_music[i]._streaming || _music[i]._paused)
continue;
@@ -982,7 +982,7 @@ void Sword2Sound::updateCompSampleStreaming(int16 *data, uint len) {
// DipMusic();
}
-int32 Sword2Sound::dipMusic() {
+int32 Sound::dipMusic() {
// disable this func for now
return RD_OK;
@@ -1061,7 +1061,7 @@ int32 Sword2Sound::dipMusic() {
* @return the time left for the current music, in seconds.
*/
-int32 Sword2Sound::musicTimeRemaining() {
+int32 Sound::musicTimeRemaining() {
StackLock lock(_mutex);
for (int i = 0; i < MAXMUS; i++) {
@@ -1076,7 +1076,7 @@ int32 Sword2Sound::musicTimeRemaining() {
* Fades out and stops the music.
*/
-void Sword2Sound::stopMusic(void) {
+void Sound::stopMusic(void) {
StackLock lock(_mutex);
for (int i = 0; i < MAXMUS; i++) {
@@ -1091,7 +1091,7 @@ void Sword2Sound::stopMusic(void) {
* Stops the music dead in its tracks.
*/
-void Sword2Sound::pauseMusic(void) {
+void Sound::pauseMusic(void) {
StackLock lock(_mutex);
if (_soundOn) {
@@ -1109,7 +1109,7 @@ void Sword2Sound::pauseMusic(void) {
* Restarts the music from where it was stopped.
*/
-void Sword2Sound::unpauseMusic(void) {
+void Sound::unpauseMusic(void) {
StackLock lock(_mutex);
if (_soundOn) {
@@ -1123,7 +1123,7 @@ void Sword2Sound::unpauseMusic(void) {
* @param volume volume, from 0 (silent) to 16 (max)
*/
-void Sword2Sound::setMusicVolume(uint8 volume) {
+void Sound::setMusicVolume(uint8 volume) {
_musicVol = volume;
}
@@ -1131,7 +1131,7 @@ void Sword2Sound::setMusicVolume(uint8 volume) {
* @return the volume setting for music
*/
-uint8 Sword2Sound::getMusicVolume() {
+uint8 Sound::getMusicVolume() {
return _musicVol;
}
@@ -1141,7 +1141,7 @@ uint8 Sword2Sound::getMusicVolume() {
* Otherwise the music is muted (volume 0).
*/
-void Sword2Sound::muteMusic(uint8 mute) {
+void Sound::muteMusic(uint8 mute) {
_musicMuted = mute;
}
@@ -1149,7 +1149,7 @@ void Sword2Sound::muteMusic(uint8 mute) {
* @return the music's mute state, 1 if mute, 0 if not mute
*/
-uint8 Sword2Sound::isMusicMute(void) {
+uint8 Sound::isMusicMute(void) {
return _musicMuted;
}
diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h
index 9a8f7a4b0c..aaae7e9086 100644
--- a/sword2/driver/d_sound.h
+++ b/sword2/driver/d_sound.h
@@ -38,9 +38,9 @@ typedef struct {
uint16 *_buf;
int32 _bufSize;
PlayingSoundHandle _handle;
-} Sword2FxHandle;
+} FxHandle;
-class Sword2MusicHandle : public MusicStream {
+class MusicHandle : public MusicStream {
public:
uint32 _id;
bool _firstTime;
@@ -59,21 +59,21 @@ public:
int16 read();
bool eos() const;
- Sword2MusicHandle() : MusicStream(), _firstTime(false),
+ MusicHandle() : MusicStream(), _firstTime(false),
_streaming(false), _paused(false), _looping(false),
_fading(0), _fileStart(0), _filePos(0), _fileEnd(0),
_lastSample(0) {}
};
-class Sword2Sound {
+class Sound {
private:
SoundMixer *_mixer;
OSystem::MutexRef _mutex;
RateConverter *_converter;
- Sword2FxHandle _fx[MAXFX];
- Sword2MusicHandle _music[MAXMUS + 1];
+ FxHandle _fx[MAXFX];
+ MusicHandle _music[MAXMUS + 1];
uint8 _musicVol;
@@ -95,8 +95,8 @@ private:
void updateCompSampleStreaming(int16 *data, uint len);
public:
- Sword2Sound(SoundMixer *mixer);
- ~Sword2Sound();
+ Sound(SoundMixer *mixer);
+ ~Sound();
void fxServer(int16 *data, uint len);
int32 playCompSpeech(const char *filename, uint32 speechid, uint8 vol, int8 pan);
uint32 preFetchCompSpeech(const char *filename, uint32 speechid, uint16 **buf);
diff --git a/sword2/driver/rdwin.cpp b/sword2/driver/rdwin.cpp
index 1612f28ca5..88b870bee9 100644
--- a/sword2/driver/rdwin.cpp
+++ b/sword2/driver/rdwin.cpp
@@ -41,7 +41,7 @@ namespace Sword2 {
// OSystem Event Handler. Full of cross platform goodness and 99% fat free!
// ---------------------------------------------------------------------------
-void Sword2State::parseEvents() {
+void Sword2Engine::parseEvents() {
OSystem::Event event;
while (_system->poll_event(&event)) {
diff --git a/sword2/mem_view.cpp b/sword2/mem_view.cpp
index 852c9895c3..dba3f31eca 100644
--- a/sword2/mem_view.cpp
+++ b/sword2/mem_view.cpp
@@ -29,7 +29,7 @@ namespace Sword2 {
// has to be global because a local in Fetch_mem_owner is destroyed on exit
char buf[50];
-void Sword2MemoryManager::displayMemory(void) {
+void MemoryManager::displayMemory(void) {
int pass, found_end, k, j, free = 0;
_standardHeader *file_header;
int scrolls = 0;
@@ -122,7 +122,7 @@ void Sword2MemoryManager::displayMemory(void) {
(free * 100) / _totalFreeMemory);
}
-const char *Sword2MemoryManager::fetchOwner(uint32 uid) {
+const char *MemoryManager::fetchOwner(uint32 uid) {
switch (uid) {
case UID_memman:
return "MEMMAN";
@@ -148,7 +148,7 @@ const char *Sword2MemoryManager::fetchOwner(uint32 uid) {
}
}
-void Sword2MemoryManager::memoryString(char *string) {
+void MemoryManager::memoryString(char *string) {
int blockNo = _baseMemBlock;
int blocksUsed = 0;
int mem_free = 0;
diff --git a/sword2/memory.cpp b/sword2/memory.cpp
index 60dabf18c2..b05f106b11 100644
--- a/sword2/memory.cpp
+++ b/sword2/memory.cpp
@@ -45,17 +45,17 @@
namespace Sword2 {
-Sword2MemoryManager memory;
+MemoryManager memory;
#define MEMORY_POOL (1024 * 12000)
// #define MEMDEBUG 1
-void Sword2MemoryManager::exit(void) {
+void MemoryManager::exit(void) {
free(_freeMemman);
}
-void Sword2MemoryManager::init(void) {
+void MemoryManager::init(void) {
uint32 j;
uint8 *memory_base;
@@ -91,7 +91,7 @@ void Sword2MemoryManager::init(void) {
_baseMemBlock = 0; // for now
}
-mem *Sword2MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id) {
+mem *MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_id) {
// allocate a block of memory - locked or float
// returns 0 if fails to allocate the memory
@@ -225,7 +225,7 @@ mem *Sword2MemoryManager::lowLevelAlloc(uint32 size, uint32 type, uint32 unique_
return &_memList[nu_block];
}
-void Sword2MemoryManager::freeMemory(mem *block) {
+void MemoryManager::freeMemory(mem *block) {
// kill a block of memory - which was presumably floating or locked
// once you've done this the memory may be recycled
@@ -237,7 +237,7 @@ void Sword2MemoryManager::freeMemory(mem *block) {
#endif
}
-void Sword2MemoryManager::floatMemory(mem *block) {
+void MemoryManager::floatMemory(mem *block) {
// set a block to float
// wont be trashed but will move around in memory
@@ -248,7 +248,7 @@ void Sword2MemoryManager::floatMemory(mem *block) {
#endif
}
-void Sword2MemoryManager::lockMemory(mem *block) {
+void MemoryManager::lockMemory(mem *block) {
// set a block to lock
// wont be moved - don't lock memory for any longer than necessary
// unless you know the locked memory is at the bottom of the heap
@@ -263,7 +263,7 @@ void Sword2MemoryManager::lockMemory(mem *block) {
#endif
}
-int32 Sword2MemoryManager::defragMemory(uint32 req_size) {
+int32 MemoryManager::defragMemory(uint32 req_size) {
// moves floating blocks down and/or merges free blocks until a large
// enough space is found or there is nothing left to do and a big
// enough block cannot be found we stop when we find/create a large
@@ -422,7 +422,7 @@ int32 Sword2MemoryManager::defragMemory(uint32 req_size) {
return -1; //no luck, couldn't find a big enough block
}
-void Sword2MemoryManager::debugMemory(void) {
+void MemoryManager::debugMemory(void) {
// gets called with lowLevelAlloc, Mem_free, Mem_lock & Mem_float if
// MEMDEBUG has been #defined otherwise can be called at any time
// anywhere else
@@ -460,7 +460,7 @@ void Sword2MemoryManager::debugMemory(void) {
} while (j != -1);
}
-mem *Sword2MemoryManager::allocMemory(uint32 size, uint32 type, uint32 unique_id) {
+mem *MemoryManager::allocMemory(uint32 size, uint32 type, uint32 unique_id) {
// the high level allocator
// can ask the resman to remove old resources to make space - will
@@ -499,7 +499,7 @@ mem *Sword2MemoryManager::allocMemory(uint32 size, uint32 type, uint32 unique_id
// Maximum allowed wasted memory.
#define MAX_WASTAGE 51200
-int32 Sword2MemoryManager::virtualDefrag(uint32 size) {
+int32 MemoryManager::virtualDefrag(uint32 size) {
// Virutually defrags memory...
//
// Used to determine if there is potentially are large enough free
diff --git a/sword2/memory.h b/sword2/memory.h
index ad54e3b316..7286b71437 100644
--- a/sword2/memory.h
+++ b/sword2/memory.h
@@ -62,7 +62,7 @@ typedef struct {
#define UID_savegame_buffer 0xfffffff6
#define UID_restoregame_buffer 0xfffffff5
-class Sword2MemoryManager {
+class MemoryManager {
private:
// Address of init malloc to be freed later
uint8 *_freeMemman;
@@ -102,7 +102,7 @@ public:
void displayMemory(void);
};
-extern Sword2MemoryManager memory;
+extern MemoryManager memory;
} // End of namespace Sword2
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 391bb7fe67..76ce70b31d 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -61,7 +61,7 @@ namespace Sword2 {
#define BUFFERSIZE 4096
-Sword2ResourceManager res_man; //declare the object global
+ResourceManager res_man; //declare the object global
// ---------------------------------------------------------------------------
//
@@ -92,7 +92,7 @@ struct _cd_inf {
// FIXME: Should init() / exit() be moved to constructor / destructor instead?
-void Sword2ResourceManager::init(void) {
+void ResourceManager::init(void) {
// We read in the resource info which tells us the names of the
// resource cluster files ultimately, although there might be groups
// within the clusters at this point it makes no difference. We only
@@ -242,7 +242,7 @@ void Sword2ResourceManager::init(void) {
file.close();
}
-void Sword2ResourceManager::exit(void) {
+void ResourceManager::exit(void) {
// free up our mallocs
free(_resList);
free(_age);
@@ -435,7 +435,7 @@ void convertEndian(uint8 *file, uint32 len) {
}
}
-uint8 *Sword2ResourceManager::open(uint32 res) {
+uint8 *ResourceManager::open(uint32 res) {
// returns ad of resource. Loads if not in memory
// retains a count
// resource can be aged out of memory if count = 0
@@ -565,7 +565,7 @@ uint8 *Sword2ResourceManager::open(uint32 res) {
return (uint8 *) _resList[res]->ad;
}
-uint8 Sword2ResourceManager::checkValid(uint32 res) {
+uint8 ResourceManager::checkValid(uint32 res) {
// returns '1' if resource is valid, otherwise returns '0'
// used in startup.cpp to ignore invalid screen-manager resources
@@ -586,7 +586,7 @@ uint8 Sword2ResourceManager::checkValid(uint32 res) {
return 1;
}
-void Sword2ResourceManager::nextCycle(void) {
+void ResourceManager::nextCycle(void) {
// increment the cycle and calculate actual per-cycle memory useage
#ifdef _SWORD2_DEBUG
@@ -616,12 +616,12 @@ void Sword2ResourceManager::nextCycle(void) {
_resTime++;
}
-uint32 Sword2ResourceManager::fetchUsage(void) {
+uint32 ResourceManager::fetchUsage(void) {
// returns memory usage previous cycle
return _currentMemoryUsage;
}
-void Sword2ResourceManager::close(uint32 res) {
+void ResourceManager::close(uint32 res) {
// decrements the count
// resource floats when count = 0
@@ -644,7 +644,7 @@ void Sword2ResourceManager::close(uint32 res) {
}
}
-uint32 Sword2ResourceManager::fetchLen(uint32 res) {
+uint32 ResourceManager::fetchLen(uint32 res) {
// returns the total file length of a resource - i.e. all headers are
// included too
@@ -677,23 +677,23 @@ uint32 Sword2ResourceManager::fetchLen(uint32 res) {
return len;
}
-char *Sword2ResourceManager::fetchCluster(uint32 res) {
+char *ResourceManager::fetchCluster(uint32 res) {
// returns a pointer to the ascii name of the cluster file which
// contains resource res
return _resourceFiles[_resConvTable[res * 2]];
}
-uint32 Sword2ResourceManager::fetchAge(uint32 res) {
+uint32 ResourceManager::fetchAge(uint32 res) {
// return the age of res
return _age[res];
}
-uint32 Sword2ResourceManager::fetchCount(uint32 res) {
+uint32 ResourceManager::fetchCount(uint32 res) {
// return the open count of res
return _count[res];
}
-uint32 Sword2ResourceManager::helpTheAgedOut(void) {
+uint32 ResourceManager::helpTheAgedOut(void) {
// remove from memory the oldest closed resource
uint32 oldest_res; // holds id of oldest found so far when we have to chuck stuff out of memory
@@ -735,7 +735,7 @@ uint32 Sword2ResourceManager::helpTheAgedOut(void) {
return _resList[oldest_res]->size; // return bytes freed
}
-void Sword2ResourceManager::printConsoleClusters(void) {
+void ResourceManager::printConsoleClusters(void) {
uint32 j;
if (_totalClusters) {
@@ -748,7 +748,7 @@ void Sword2ResourceManager::printConsoleClusters(void) {
Scroll_console();
}
-void Sword2ResourceManager::examine(uint8 *input) {
+void ResourceManager::examine(uint8 *input) {
uint32 j = 0;
uint32 res;
_standardHeader *file_header;
@@ -861,7 +861,7 @@ void Sword2ResourceManager::examine(uint8 *input) {
}
}
-void Sword2ResourceManager::kill(uint8 *input) {
+void ResourceManager::kill(uint8 *input) {
int j = 0;
uint32 res;
@@ -899,7 +899,7 @@ void Sword2ResourceManager::kill(uint8 *input) {
}
}
-void Sword2ResourceManager::remove(uint32 res) {
+void ResourceManager::remove(uint32 res) {
if (_age[res]) {
_age[res] = 0; // effectively gone from _resList
memory.freeMemory(_resList[res]); // release the memory too
@@ -908,7 +908,7 @@ void Sword2ResourceManager::remove(uint32 res) {
debug(5, "remove(%d) not even in memory!", res);
}
-void Sword2ResourceManager::removeAll(void) {
+void ResourceManager::removeAll(void) {
// remove all res files from memory - ready for a total restart
// including player object & global variables resource
@@ -928,7 +928,7 @@ void Sword2ResourceManager::removeAll(void) {
} while (j != -1);
}
-void Sword2ResourceManager::killAll(uint8 wantInfo) {
+void ResourceManager::killAll(uint8 wantInfo) {
// remove all res files from memory
// its quicker to search the mem blocs for res files than search
// resource lists for those in memory
@@ -1001,7 +1001,7 @@ void Sword2ResourceManager::killAll(uint8 wantInfo) {
// disappear forever, or some plaster-filled holes in sand to crash the game &
// get James in trouble again.
-void Sword2ResourceManager::killAllObjects(uint8 wantInfo) {
+void ResourceManager::killAllObjects(uint8 wantInfo) {
// remove all object res files from memory, excluding George
// its quicker to search the mem blocs for res files than search
// resource lists for those in memory
@@ -1065,7 +1065,7 @@ void Sword2ResourceManager::killAllObjects(uint8 wantInfo) {
Print_to_console(" expelled %d object resource(s)", nuked);
}
-void Sword2ResourceManager::cacheNewCluster(uint32 newCluster) {
+void ResourceManager::cacheNewCluster(uint32 newCluster) {
// Stop any music from streaming off the CD before we start the
// cluster-copy!
//
@@ -1300,7 +1300,7 @@ void Sword2ResourceManager::cacheNewCluster(uint32 newCluster) {
fclose(file);
}
-void Sword2ResourceManager::getCd(int cd) {
+void ResourceManager::getCd(int cd) {
// TODO support a seperate path for cd data?
bool done = false;
diff --git a/sword2/resman.h b/sword2/resman.h
index 28157b79d7..e3c67287bb 100644
--- a/sword2/resman.h
+++ b/sword2/resman.h
@@ -26,7 +26,7 @@ namespace Sword2 {
#define MAX_res_files 20
-class Sword2ResourceManager {
+class ResourceManager {
public:
void init(void); // read in the config file
void exit(void);
@@ -105,7 +105,7 @@ private:
char _cdDrives[24];
};
-extern Sword2ResourceManager res_man; //declare the object global
+extern ResourceManager res_man; //declare the object global
} // End of namespace Sword2
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index c01e9fc981..334a47ad09 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -64,7 +64,7 @@ const TargetSettings *Engine_SWORD2_targetList() {
}
Engine *Engine_SWORD2_create(GameDetector *detector, OSystem *syst) {
- return new Sword2::Sword2State(detector, syst);
+ return new Sword2::Sword2Engine(detector, syst);
}
REGISTER_PLUGIN("Broken Sword II", Engine_SWORD2_targetList, Engine_SWORD2_create);
@@ -97,10 +97,10 @@ uint8 gamePaused = 0;
uint8 graphics_level_fudged = 0;
uint8 stepOneCycle = 0; // for use while game paused
-Sword2State *g_sword2 = NULL;
-Sword2Sound *g_sound = NULL;
+Sword2Engine *g_sword2 = NULL;
+Sound *g_sound = NULL;
-Sword2State::Sword2State(GameDetector *detector, OSystem *syst)
+Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst)
: Engine(detector, syst) {
_detector = detector;
@@ -122,16 +122,16 @@ Sword2State::Sword2State(GameDetector *detector, OSystem *syst)
_mixer->setVolume(256);
_mixer->setMusicVolume(256);
- g_sound = _sound = new Sword2Sound(_mixer);
+ g_sound = _sound = new Sound(_mixer);
File::setDefaultDirectory(_gameDataPath);
}
-void Sword2State::errorString(const char *buf1, char *buf2) {
+void Sword2Engine::errorString(const char *buf1, char *buf2) {
strcpy(buf2, buf1);
}
-int32 Sword2State::InitialiseGame(void) {
+int32 Sword2Engine::InitialiseGame(void) {
// init engine drivers
uint8 *file;
@@ -254,7 +254,7 @@ int32 GameCycle(void) {
return 0;
}
-void Sword2State::go() {
+void Sword2Engine::go() {
OSystem::Property prop;
uint32 rv;
uint8 breakOut = 0;
@@ -433,7 +433,7 @@ void Sword2State::go() {
return; //quit the game
}
-void Sword2State::Start_game(void) {
+void Sword2Engine::Start_game(void) {
// boot the game straight into a start script
int screen_manager_id;
diff --git a/sword2/sword2.h b/sword2/sword2.h
index 2bf3c0476a..7a9f9dfcf6 100644
--- a/sword2/sword2.h
+++ b/sword2/sword2.h
@@ -52,9 +52,9 @@ extern uint8 unencoded_name[];
// TODO move stuff into class
-class Sword2State : public Engine {
+class Sword2Engine : public Engine {
public:
- Sword2State(GameDetector *detector, OSystem *syst);
+ Sword2Engine(GameDetector *detector, OSystem *syst);
void go(void);
void parseEvents(void);
void Start_game(void);
@@ -63,7 +63,7 @@ public:
uint32 _features;
byte _gameId;
char *_game_name; // target name for saves
- Sword2Sound *_sound;
+ Sound *_sound;
private:
bool _quit;
@@ -74,8 +74,8 @@ public:
void errorString(const char *buf_input, char *buf_output);
};
-extern Sword2State *g_sword2;
-extern Sword2Sound *g_sound;
+extern Sword2Engine *g_sword2;
+extern Sound *g_sound;
} // End of namespace Sword2