1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#include "m4/m4.h"
#include "m4/mads_logic.h"
#include "m4/scene.h"
namespace M4 {
/*--------------------------------------------------------------------------*/
const char *MadsSceneLogic::formAnimName(char sepChar, int16 suffixNum) {
return MADSResourceManager::getResourceName(sepChar, _sceneNumber, EXTTYPE_NONE, NULL, suffixNum);
}
void MadsSceneLogic::getSceneSpriteSet() {
char prefix[100];
// Room change sound
_madsVm->_sound->playSound(5);
// Set up sprite set prefix to use
if ((_sceneNumber <= 103) || (_sceneNumber == 111)) {
if (_madsVm->globals()->_globals[0] == SEX_FEMALE)
strcpy(prefix, "ROX");
else
strcpy(prefix, "RXM");
} else if (_sceneNumber <= 110) {
strcpy(prefix, "RXSW");
_madsVm->globals()->_globals[0] = SEX_UNKNOWN;
} else if (_sceneNumber == 112)
strcpy(prefix, "");
_madsVm->globals()->playerSpriteChanged = true;
_madsVm->scene()->loadPlayerSprites(prefix);
// if ((_sceneNumber == 105) ((_sceneNumber == 109) && (word_84800 != 0)))
// _madsVm->globals()->playerSpriteChanged = true;
// _vm->_palette->setEntry(16, 0x38, 0xFF, 0xFF);
// _vm->_palette->setEntry(17, 0x38, 0xb4, 0xb4);
}
void MadsSceneLogic::getAnimName() {
const char *newName = MADSResourceManager::getAAName(
((_sceneNumber <= 103) || (_sceneNumber > 111)) ? 0 : 1);
strcpy(_madsVm->scene()->_aaName, newName);
}
/*--------------------------------------------------------------------------*/
uint16 MadsSceneLogic::loadSpriteSet(uint16 suffixNum, uint16 sepChar) {
assert(sepChar < 256);
const char *resName = formAnimName((char)sepChar, (int16)suffixNum);
return _madsVm->scene()->loadSceneSpriteSet(resName);
}
/*--------------------------------------------------------------------------*/
/**
* FIXME:
* Currently I'm only working at providing manual implementation of the first Rex Nebular scene.
* It will make more sense to convert the remaining game logic from the games into some
* kind of bytecode scripts
*/
void MadsSceneLogic::selectScene(int sceneNum) {
assert(sceneNum == 101);
_sceneNumber = sceneNum;
}
void MadsSceneLogic::setupScene() {
// FIXME: This is the hardcoded logic for Rex scene 101 only
const char *animName = formAnimName('A', -1);
warning("anim - %s\n", animName);
// sub_1e754(animName, 3);
getSceneSpriteSet();
getAnimName();
}
void MadsSceneLogic::enterScene() {
for (int i = 1; i <= 7; ++i)
_spriteIndexes[i - 1] = loadSpriteSet(i, 'x');
_spriteIndexes[7] = loadSpriteSet(0xFFFF, 'm');
_spriteIndexes[8] = loadSpriteSet(1, 'b');
_spriteIndexes[9] = loadSpriteSet(2, 'b');
_spriteIndexes[10] = loadSpriteSet(0, 'a');
_spriteIndexes[11] = loadSpriteSet(1, 'a');
_spriteIndexes[12] = loadSpriteSet(8, 'x');
_spriteIndexes[13] = loadSpriteSet(0, 'x');
}
void MadsSceneLogic::doAction() {
}
}
|