mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-09 11:20:56 +00:00
KINGDOM: Fix a crash, get rid of the off by one in resource handler, implement some stubs
This commit is contained in:
parent
1be5596b22
commit
9016cacdd7
@ -48,10 +48,12 @@ KingdomGame::KingdomGame(OSystem *syst, const ADGameDescription *gameDesc) : Eng
|
||||
_rnd = new Common::RandomSource("kingdom");
|
||||
|
||||
DebugMan.addDebugChannel(kDebugGeneral, "general", "General debug level");
|
||||
for (int i = 0; i < 509; i++) {
|
||||
for (int i = 0; i < 510; i++) {
|
||||
_RezPointers[i] = nullptr;
|
||||
_RezSize[i] = 0;
|
||||
}
|
||||
|
||||
_ASPtr = nullptr;
|
||||
}
|
||||
|
||||
KingdomGame::~KingdomGame() {
|
||||
@ -123,7 +125,7 @@ void KingdomGame::drawScreen() {
|
||||
void KingdomGame::SetupPics() {
|
||||
// Load Pics\kingArt.art
|
||||
LoadAResource(0x97);
|
||||
_ArtPtr = _RezPointers[0x97 - 1];
|
||||
_ArtPtr = _RezPointers[0x97];
|
||||
}
|
||||
|
||||
void KingdomGame::InitTools() {
|
||||
@ -369,9 +371,6 @@ void KingdomGame::GPLogic4() {
|
||||
}
|
||||
|
||||
void KingdomGame::LoadAResource(int reznum) {
|
||||
// CHECKME: Weird off-by-one here?
|
||||
reznum--;
|
||||
|
||||
Common::String path = Common::String(_RezNames[reznum]);
|
||||
path.toUppercase();
|
||||
|
||||
@ -390,11 +389,19 @@ void KingdomGame::LoadAResource(int reznum) {
|
||||
}
|
||||
}
|
||||
|
||||
void KingdomGame::ReleaseAResource(int reznum) {
|
||||
if (_RezSize[reznum]) {
|
||||
delete _RezPointers[reznum];
|
||||
_RezSize[reznum] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void KingdomGame::ShowPic(int reznum) {
|
||||
debug("STUB ShowPic %i\n", reznum);
|
||||
EraseCursor();
|
||||
|
||||
LoadAResource(reznum);
|
||||
Image::IFFDecoder decoder;
|
||||
if (!decoder.loadStream(*_RezPointers[reznum - 1]))
|
||||
if (!decoder.loadStream(*_RezPointers[reznum]))
|
||||
return;
|
||||
|
||||
const byte *palette = decoder.getPalette();
|
||||
@ -404,10 +411,15 @@ void KingdomGame::ShowPic(int reznum) {
|
||||
const Graphics::Surface *surface = decoder.getSurface();
|
||||
g_system->copyRectToScreen(surface->getPixels(), 320, 0, 0, 320, 200);
|
||||
g_system->updateScreen();
|
||||
|
||||
ReleaseAResource(reznum);
|
||||
}
|
||||
|
||||
void KingdomGame::FShowPic(int v1) {
|
||||
debug("STUB: FShowPic");
|
||||
void KingdomGame::FShowPic(int reznum) {
|
||||
EraseCursor();
|
||||
FadeToBlack1();
|
||||
DrawRect(4, 17, 228, 161, 0);
|
||||
ShowPic(reznum);
|
||||
}
|
||||
|
||||
void KingdomGame::InitCursor() {
|
||||
@ -427,7 +439,19 @@ void KingdomGame::PlayMovie(int movieNum) {
|
||||
}
|
||||
|
||||
void KingdomGame::EnAll() {
|
||||
debug("STUB: EnAll");
|
||||
_Help = true;
|
||||
_Eye = true;
|
||||
_Replay = true;
|
||||
_Pouch = true;
|
||||
_FstFwd = true;
|
||||
}
|
||||
|
||||
void KingdomGame::DsAll() {
|
||||
_Help = false;
|
||||
_Eye = false;
|
||||
_Replay = false;
|
||||
_Pouch = false;
|
||||
_FstFwd = false;
|
||||
}
|
||||
|
||||
void KingdomGame::SaveAS() {
|
||||
@ -457,4 +481,8 @@ void KingdomGame::SaveGame() {
|
||||
void KingdomGame::PlaySound(int v1) {
|
||||
debug("STUB: PlaySound");
|
||||
}
|
||||
|
||||
void KingdomGame::EraseCursor() {
|
||||
debug("STUB: EraseCursor");
|
||||
}
|
||||
} // End of namespace Kingdom
|
||||
|
@ -116,14 +116,15 @@ namespace Kingdom {
|
||||
int _PMovie;
|
||||
bool _KeyActive;
|
||||
bool _IconRedraw;
|
||||
bool _Replay;
|
||||
|
||||
// Game Flags - Will be renames later into _Nodes[]
|
||||
int16 word_2D77E;
|
||||
int16 word_2D7CC;
|
||||
|
||||
Common::SeekableReadStream *_ArtPtr;
|
||||
Common::SeekableReadStream *_RezPointers[509];
|
||||
int _RezSize[509];
|
||||
Common::SeekableReadStream *_RezPointers[510];
|
||||
int _RezSize[510];
|
||||
int8 _Inventory[19];
|
||||
int _IconPic[7];
|
||||
uint16 _UserInput;
|
||||
@ -142,13 +143,15 @@ namespace Kingdom {
|
||||
void GPLogic3();
|
||||
void GPLogic4();
|
||||
void LoadAResource(int reznum);
|
||||
void ReleaseAResource(int reznum);
|
||||
void ShowPic(int reznum);
|
||||
void FShowPic(int v1);
|
||||
void FShowPic(int reznum);
|
||||
void InitCursor();
|
||||
void SetMouse();
|
||||
void InitMPlayer();
|
||||
void PlayMovie(int movieNum);
|
||||
void EnAll();
|
||||
void DsAll();
|
||||
void SaveAS();
|
||||
void RestoreAS();
|
||||
void DrawHelpScreen();
|
||||
@ -157,6 +160,7 @@ namespace Kingdom {
|
||||
void GameHelp_Sub43C();
|
||||
void SaveGame();
|
||||
void PlaySound(int v1);
|
||||
void EraseCursor();
|
||||
};
|
||||
} // End of namespace Kingdom
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
char *_RezNames[] = {
|
||||
"",
|
||||
"Maps/KMAP001.lbm",
|
||||
"Maps/KMAP002.lbm",
|
||||
"Maps/KMAP003.lbm",
|
||||
|
Loading…
Reference in New Issue
Block a user