Fix scene description structure data types and rename it.

svn-id: r14556
This commit is contained in:
Eugene Sandulenko 2004-08-11 18:02:03 +00:00
parent 23d5d1fb82
commit 39137da10d
4 changed files with 46 additions and 39 deletions

View File

@ -335,8 +335,8 @@ int Scene::getMode() {
int Scene::getZInfo(SCENE_ZINFO *zinfo) {
assert(_initialized);
zinfo->begin_slope = _desc.begin_slope;
zinfo->end_slope = _desc.end_slope;
zinfo->beginSlope = _desc.beginSlope;
zinfo->endSlope = _desc.endSlope;
return R_SUCCESS;
}
@ -436,11 +436,11 @@ int Scene::loadScene(int scene_num, int load_flag, R_SCENE_PROC scene_proc, R_SC
break;
case BY_DESC:
assert(scene_desc_param != NULL);
assert(scene_desc_param->res_list != NULL);
assert(scene_desc_param->resList != NULL);
_loadDesc = false;
_desc = *scene_desc_param;
_resList = scene_desc_param->res_list;
_resListEntries = scene_desc_param->res_list_ct;
_resList = scene_desc_param->resList;
_resListEntries = scene_desc_param->resListCnt;
break;
default:
warning("Scene::loadScene(): Error: Invalid scene load flag");
@ -460,7 +460,7 @@ int Scene::loadScene(int scene_num, int load_flag, R_SCENE_PROC scene_proc, R_SC
return R_FAILURE;
}
if (loadSceneResourceList(_desc.res_list_rn) != R_SUCCESS) {
if (loadSceneResourceList(_desc.resListRN) != R_SUCCESS) {
warning("Scene::loadScene(): Error reading scene resource list");
return R_FAILURE;
}
@ -485,8 +485,8 @@ int Scene::loadScene(int scene_num, int load_flag, R_SCENE_PROC scene_proc, R_SC
}
// Load scene script data
if (_desc.script_num > 0) {
if (_vm->_script->loadScript(_desc.script_num) != R_SUCCESS) {
if (_desc.scriptNum > 0) {
if (_vm->_script->loadScript(_desc.scriptNum) != R_SUCCESS) {
warning("Scene::loadScene(): Error loading scene script");
return R_FAILURE;
}
@ -525,14 +525,14 @@ int Scene::loadSceneDescriptor(uint32 res_number) {
MemoryReadStream readS(scene_desc_data, scene_desc_len);
_desc.unknown0 = readS.readUint16LE();
_desc.res_list_rn = readS.readUint16LE();
_desc.end_slope = readS.readUint16LE();
_desc.begin_slope = readS.readUint16LE();
_desc.script_num = readS.readUint16LE();
_desc.scene_scriptnum = readS.readUint16LE();
_desc.start_scriptnum = readS.readUint16LE();
_desc.music_rn = readS.readSint16LE();
_desc.flags = readS.readSint16LE();
_desc.resListRN = readS.readSint16LE();
_desc.endSlope = readS.readSint16LE();
_desc.beginSlope = readS.readSint16LE();
_desc.scriptNum = readS.readUint16LE();
_desc.sceneScriptNum = readS.readUint16LE();
_desc.startScriptNum = readS.readUint16LE();
_desc.musicRN = readS.readSint16LE();
RSC_FreeResource(scene_desc_data);
@ -779,7 +779,7 @@ int Scene::endScene() {
_sceneProc(SCENE_END, &scene_info);
if (_desc.script_num > 0) {
if (_desc.scriptNum > 0) {
_vm->_script->freeScript();
}
@ -853,14 +853,14 @@ void Scene::sceneInfoCmd(int argc, char *argv[]) {
_vm->_console->print(fmt, "Scene number:", _sceneNumber);
_vm->_console->print(fmt, "Descriptor R#:", _sceneResNum);
_vm->_console->print("-------------------------");
_vm->_console->print(fmt, "Unknown:", _desc.unknown0);
_vm->_console->print(fmt, "Resource list R#:", _desc.res_list_rn);
_vm->_console->print(fmt, "End slope:", _desc.end_slope);
_vm->_console->print(fmt, "Begin slope:", _desc.begin_slope);
_vm->_console->print(fmt, "Script resource:", _desc.script_num);
_vm->_console->print(fmt, "Scene script:", _desc.scene_scriptnum);
_vm->_console->print(fmt, "Start script:", _desc.start_scriptnum);
_vm->_console->print(fmt, "Music R#", _desc.music_rn);
_vm->_console->print(fmt, "Flags:", _desc.flags);
_vm->_console->print(fmt, "Resource list R#:", _desc.resListRN);
_vm->_console->print(fmt, "End slope:", _desc.endSlope);
_vm->_console->print(fmt, "Begin slope:", _desc.beginSlope);
_vm->_console->print(fmt, "Script resource:", _desc.scriptNum);
_vm->_console->print(fmt, "Scene script:", _desc.sceneScriptNum);
_vm->_console->print(fmt, "Start script:", _desc.startScriptNum);
_vm->_console->print(fmt, "Music R#", _desc.musicRN);
}
static void CF_sceneinfo(int argc, char *argv[], void *refCon) {

View File

@ -37,9 +37,8 @@ enum R_SCENE_MODES {
};
struct SCENE_ZINFO {
int begin_slope;
int end_slope;
int beginSlope;
int endSlope;
};
struct SCENE_BGINFO {
@ -105,16 +104,16 @@ struct R_SCENE_RESLIST {
#define SAGA_SCENE_DESC_LEN 16
struct R_SCENE_DESC {
int unknown0;
int res_list_rn;
int end_slope;
int begin_slope;
int script_num;
int scene_scriptnum;
int start_scriptnum;
int music_rn;
R_SCENE_RESLIST *res_list;
size_t res_list_ct;
int16 flags;
int16 resListRN;
int16 endSlope;
int16 beginSlope;
uint16 scriptNum;
uint16 sceneScriptNum;
uint16 startScriptNum;
int16 musicRN;
R_SCENE_RESLIST *resList;
size_t resListCnt;
};
struct SCENE_IMAGE {

View File

@ -319,7 +319,7 @@ int Sprite::drawOccluded(R_SURFACE *ds, R_SPRITELIST *sprite_list, int sprite_nu
// Create actor Z occlusion LUT
_vm->_scene->getZInfo(&zinfo);
e_slope = zinfo.end_slope;
e_slope = zinfo.endSlope;
for (i = 0; i < R_SPRITE_ZMAX; i++) {
z_lut[i] = (int)(e_slope + ((137.0 - e_slope) / 14.0) * (15.0 - i));

View File

@ -38,3 +38,11 @@ Sceneres.h
Scene.c
=======
ResToImage() _vm->decodeBGImage()
resInfo->sceneFlags _desc.flags
resInfo->loadList _desc.resListRN
resInfo->horizon _desc.endSlope
resInfo->nearFigureLimit _desc.beginSlope
resInfo->scriptModule _desc.scriptNum
resInfo->entryScript _desc.sceneScriptNum
resInfo->preScript _desc.startScriptNum
resInfo->backgroundMusic _desc.musicRN