Microsoft Compilers : Which part of the standard do you want to break today ?
svn-id: r11866
This commit is contained in:
parent
4abee14310
commit
a1831ee4fb
7 changed files with 57 additions and 44 deletions
|
@ -531,6 +531,7 @@ void SwordControl::renderText(const char *str, int16 x, uint16 y) {
|
||||||
// I can hardly believe this is all it takes for loading and saving...
|
// I can hardly believe this is all it takes for loading and saving...
|
||||||
void SwordControl::saveGameToFile(uint8 slot) {
|
void SwordControl::saveGameToFile(uint8 slot) {
|
||||||
char fName[15];
|
char fName[15];
|
||||||
|
uint16 cnt;
|
||||||
sprintf(fName, "SAVEGAME.%03d", slot);
|
sprintf(fName, "SAVEGAME.%03d", slot);
|
||||||
uint16 liveBuf[TOTAL_SECTIONS];
|
uint16 liveBuf[TOTAL_SECTIONS];
|
||||||
SaveFileManager *mgr = _system->get_savefile_manager();
|
SaveFileManager *mgr = _system->get_savefile_manager();
|
||||||
|
@ -540,7 +541,7 @@ void SwordControl::saveGameToFile(uint8 slot) {
|
||||||
error("unable to create file %s", fName);
|
error("unable to create file %s", fName);
|
||||||
|
|
||||||
_objMan->saveLiveList(liveBuf);
|
_objMan->saveLiveList(liveBuf);
|
||||||
for (uint16 cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
|
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
|
||||||
outf->writeUint16LE(liveBuf[cnt]);
|
outf->writeUint16LE(liveBuf[cnt]);
|
||||||
|
|
||||||
BsObject *cpt = _objMan->fetchObject(PLAYER);
|
BsObject *cpt = _objMan->fetchObject(PLAYER);
|
||||||
|
@ -550,19 +551,20 @@ void SwordControl::saveGameToFile(uint8 slot) {
|
||||||
SwordLogic::_scriptVars[CHANGE_STANCE] = STAND;
|
SwordLogic::_scriptVars[CHANGE_STANCE] = STAND;
|
||||||
SwordLogic::_scriptVars[CHANGE_PLACE] = cpt->o_place;
|
SwordLogic::_scriptVars[CHANGE_PLACE] = cpt->o_place;
|
||||||
|
|
||||||
for (uint16 cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++)
|
for (cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++)
|
||||||
outf->writeUint32LE(SwordLogic::_scriptVars[cnt]);
|
outf->writeUint32LE(SwordLogic::_scriptVars[cnt]);
|
||||||
|
|
||||||
uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
|
uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
|
||||||
uint32 *playerRaw = (uint32*)cpt;
|
uint32 *playerRaw = (uint32*)cpt;
|
||||||
for (uint32 cnt = 0; cnt < playerSize; cnt++)
|
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++)
|
||||||
outf->writeUint32LE(playerRaw[cnt]);
|
outf->writeUint32LE(playerRaw[cnt2]);
|
||||||
delete outf;
|
delete outf;
|
||||||
delete mgr;
|
delete mgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordControl::restoreGameFromFile(uint8 slot) {
|
void SwordControl::restoreGameFromFile(uint8 slot) {
|
||||||
char fName[15];
|
char fName[15];
|
||||||
|
uint16 cnt;
|
||||||
sprintf(fName, "SAVEGAME.%03d", slot);
|
sprintf(fName, "SAVEGAME.%03d", slot);
|
||||||
SaveFileManager *mgr = _system->get_savefile_manager();
|
SaveFileManager *mgr = _system->get_savefile_manager();
|
||||||
SaveFile *inf;
|
SaveFile *inf;
|
||||||
|
@ -579,15 +581,15 @@ void SwordControl::restoreGameFromFile(uint8 slot) {
|
||||||
uint32 *scriptBuf = (uint32*)(_restoreBuf + 2 * TOTAL_SECTIONS);
|
uint32 *scriptBuf = (uint32*)(_restoreBuf + 2 * TOTAL_SECTIONS);
|
||||||
uint32 *playerBuf = (uint32*)(_restoreBuf + 2 * TOTAL_SECTIONS + 4 * NUM_SCRIPT_VARS);
|
uint32 *playerBuf = (uint32*)(_restoreBuf + 2 * TOTAL_SECTIONS + 4 * NUM_SCRIPT_VARS);
|
||||||
|
|
||||||
for (uint16 cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
|
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
|
||||||
liveBuf[cnt] = inf->readUint16LE();
|
liveBuf[cnt] = inf->readUint16LE();
|
||||||
|
|
||||||
for (uint16 cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++)
|
for (cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++)
|
||||||
scriptBuf[cnt] = inf->readUint32LE();
|
scriptBuf[cnt] = inf->readUint32LE();
|
||||||
|
|
||||||
uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
|
uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
|
||||||
for (uint32 cnt = 0; cnt < playerSize; cnt++)
|
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++)
|
||||||
playerBuf[cnt] = inf->readUint32LE();
|
playerBuf[cnt2] = inf->readUint32LE();
|
||||||
|
|
||||||
delete inf;
|
delete inf;
|
||||||
delete mgr;
|
delete mgr;
|
||||||
|
@ -604,7 +606,7 @@ void SwordControl::doRestore(void) {
|
||||||
uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
|
uint32 playerSize = (sizeof(BsObject) - 12000) / 4;
|
||||||
uint32 *playerRaw = (uint32*)_objMan->fetchObject(PLAYER);
|
uint32 *playerRaw = (uint32*)_objMan->fetchObject(PLAYER);
|
||||||
BsObject *cpt = _objMan->fetchObject(PLAYER);
|
BsObject *cpt = _objMan->fetchObject(PLAYER);
|
||||||
for (uint32 cnt = 0; cnt < playerSize; cnt++) {
|
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++) {
|
||||||
*playerRaw = *(uint32*)bufPos;
|
*playerRaw = *(uint32*)bufPos;
|
||||||
playerRaw++;
|
playerRaw++;
|
||||||
bufPos += 4;
|
bufPos += 4;
|
||||||
|
|
|
@ -87,15 +87,16 @@ void SwordMenuIcon::draw(const byte *fadeMask, int8 fadeStatus) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SwordMenu::SwordMenu(SwordScreen *pScreen, SwordMouse *pMouse) {
|
SwordMenu::SwordMenu(SwordScreen *pScreen, SwordMouse *pMouse) {
|
||||||
|
uint8 cnt;
|
||||||
_screen = pScreen;
|
_screen = pScreen;
|
||||||
_mouse = pMouse;
|
_mouse = pMouse;
|
||||||
_subjectBarStatus = MENU_CLOSED;
|
_subjectBarStatus = MENU_CLOSED;
|
||||||
_objectBarStatus = MENU_CLOSED;
|
_objectBarStatus = MENU_CLOSED;
|
||||||
_fadeSubject = 0;
|
_fadeSubject = 0;
|
||||||
_fadeObject = 0;
|
_fadeObject = 0;
|
||||||
for (uint8 cnt = 0; cnt < TOTAL_subjects; cnt++)
|
for (cnt = 0; cnt < TOTAL_subjects; cnt++)
|
||||||
_subjects[cnt] = NULL;
|
_subjects[cnt] = NULL;
|
||||||
for (uint8 cnt = 0; cnt < TOTAL_pockets; cnt++)
|
for (cnt = 0; cnt < TOTAL_pockets; cnt++)
|
||||||
_objects[cnt] = NULL;
|
_objects[cnt] = NULL;
|
||||||
_inMenu = 0;
|
_inMenu = 0;
|
||||||
}
|
}
|
||||||
|
@ -170,12 +171,13 @@ uint8 SwordMenu::checkMenuClick(uint8 menuType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordMenu::buildSubjects(void) {
|
void SwordMenu::buildSubjects(void) {
|
||||||
for (uint8 cnt = 0; cnt < 16; cnt++)
|
uint8 cnt;
|
||||||
|
for (cnt = 0; cnt < 16; cnt++)
|
||||||
if (_subjects[cnt]) {
|
if (_subjects[cnt]) {
|
||||||
delete _subjects[cnt];
|
delete _subjects[cnt];
|
||||||
_subjects[cnt] = NULL;
|
_subjects[cnt] = NULL;
|
||||||
}
|
}
|
||||||
for (uint8 cnt = 0; cnt < SwordLogic::_scriptVars[IN_SUBJECT]; cnt++) {
|
for (cnt = 0; cnt < SwordLogic::_scriptVars[IN_SUBJECT]; cnt++) {
|
||||||
uint32 res = _subjectList[(_subjectBar[cnt] & 65535) - BASE_SUBJECT].subjectRes;
|
uint32 res = _subjectList[(_subjectBar[cnt] & 65535) - BASE_SUBJECT].subjectRes;
|
||||||
uint32 frame = _subjectList[(_subjectBar[cnt] & 65535) - BASE_SUBJECT].frameNo;
|
uint32 frame = _subjectList[(_subjectBar[cnt] & 65535) - BASE_SUBJECT].frameNo;
|
||||||
_subjects[cnt] = new SwordMenuIcon(MENU_BOT, cnt, res, frame, _screen);
|
_subjects[cnt] = new SwordMenuIcon(MENU_BOT, cnt, res, frame, _screen);
|
||||||
|
|
|
@ -32,7 +32,8 @@ ObjectMan::ObjectMan(ResMan *pResourceMan) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMan::initialize(void) {
|
void ObjectMan::initialize(void) {
|
||||||
for (uint16 cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
|
uint16 cnt;
|
||||||
|
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
|
||||||
_liveList[cnt] = 0; // we don't need to close the files here. When this routine is
|
_liveList[cnt] = 0; // we don't need to close the files here. When this routine is
|
||||||
// called, the memory was flushed() anyways, so these resources
|
// called, the memory was flushed() anyways, so these resources
|
||||||
// already *are* closed.
|
// already *are* closed.
|
||||||
|
@ -40,7 +41,7 @@ void ObjectMan::initialize(void) {
|
||||||
_liveList[128] = _liveList[129] = _liveList[130] = _liveList[131] = _liveList[133] =
|
_liveList[128] = _liveList[129] = _liveList[130] = _liveList[131] = _liveList[133] =
|
||||||
_liveList[134] = _liveList[145] = _liveList[146] = _liveList[TEXT_sect] = 1;
|
_liveList[134] = _liveList[145] = _liveList[146] = _liveList[TEXT_sect] = 1;
|
||||||
|
|
||||||
for (uint16 cnt = 0; cnt < TOTAL_SECTIONS; cnt++) {
|
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++) {
|
||||||
if (_liveList[cnt])
|
if (_liveList[cnt])
|
||||||
_cptData[cnt] = (uint8*)_resMan->cptResOpen(_objectList[cnt]) + sizeof(Header);
|
_cptData[cnt] = (uint8*)_resMan->cptResOpen(_objectList[cnt]) + sizeof(Header);
|
||||||
else
|
else
|
||||||
|
|
|
@ -2314,6 +2314,9 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
|
||||||
int32 walkGridResourceId;
|
int32 walkGridResourceId;
|
||||||
BsObject *floorObject;
|
BsObject *floorObject;
|
||||||
|
|
||||||
|
int32 cnt;
|
||||||
|
uint32 cntu;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// load in floor grid for current mega
|
// load in floor grid for current mega
|
||||||
|
@ -2356,7 +2359,7 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
|
||||||
|
|
||||||
/*memmove(&bars[0],fPolygrid,nbars*sizeof(BarData));
|
/*memmove(&bars[0],fPolygrid,nbars*sizeof(BarData));
|
||||||
fPolygrid += nbars*sizeof(BarData);//move pointer to start of node data*/
|
fPolygrid += nbars*sizeof(BarData);//move pointer to start of node data*/
|
||||||
for (int32 cnt = 0; cnt < nbars; cnt++) {
|
for (cnt = 0; cnt < nbars; cnt++) {
|
||||||
bars[cnt].x1 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
bars[cnt].x1 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
||||||
bars[cnt].y1 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
bars[cnt].y1 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
||||||
bars[cnt].x2 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
bars[cnt].x2 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
||||||
|
@ -2378,7 +2381,7 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
|
||||||
j ++;
|
j ++;
|
||||||
}
|
}
|
||||||
while(j < nnodes);//array starts at 0*/
|
while(j < nnodes);//array starts at 0*/
|
||||||
for (int32 cnt = 1; cnt < nnodes; cnt++) {
|
for (cnt = 1; cnt < nnodes; cnt++) {
|
||||||
node[cnt].x = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
node[cnt].x = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
||||||
node[cnt].y = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
node[cnt].y = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
||||||
}
|
}
|
||||||
|
@ -2433,11 +2436,11 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
|
||||||
nTurnFrames = fMegaWalkData[1];
|
nTurnFrames = fMegaWalkData[1];
|
||||||
fMegaWalkData += 2;
|
fMegaWalkData += 2;
|
||||||
|
|
||||||
for (int32 cnt = 0; cnt < NO_DIRECTIONS * (nWalkFrames + 1 + nTurnFrames); cnt++) {
|
for (cnt = 0; cnt < NO_DIRECTIONS * (nWalkFrames + 1 + nTurnFrames); cnt++) {
|
||||||
_dx[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
_dx[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
||||||
fMegaWalkData += 4;
|
fMegaWalkData += 4;
|
||||||
}
|
}
|
||||||
for (int32 cnt = 0; cnt < NO_DIRECTIONS * (nWalkFrames + 1 + nTurnFrames); cnt++) {
|
for (cnt = 0; cnt < NO_DIRECTIONS * (nWalkFrames + 1 + nTurnFrames); cnt++) {
|
||||||
_dy[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
_dy[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
||||||
fMegaWalkData += 4;
|
fMegaWalkData += 4;
|
||||||
}
|
}
|
||||||
|
@ -2446,12 +2449,12 @@ int32 SwordRouter::LoadWalkResources(BsObject *megaObject, int32 x, int32 y, int
|
||||||
memmove(&_dy[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
|
memmove(&_dy[0],fMegaWalkData,NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32));
|
||||||
fMegaWalkData += NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32);*/
|
fMegaWalkData += NO_DIRECTIONS*(nWalkFrames+1+nTurnFrames)*sizeof(int32);*/
|
||||||
|
|
||||||
for (uint32 cnt = 0; cnt < NO_DIRECTIONS; cnt++) {
|
for (cntu = 0; cntu < NO_DIRECTIONS; cntu++) {
|
||||||
modX[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
modX[cntu] = (int32)READ_LE_UINT32(fMegaWalkData);
|
||||||
fMegaWalkData += 4;
|
fMegaWalkData += 4;
|
||||||
}
|
}
|
||||||
for (uint32 cnt = 0; cnt < NO_DIRECTIONS; cnt++) {
|
for (cntu = 0; cntu < NO_DIRECTIONS; cntu++) {
|
||||||
modY[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
modY[cntu] = (int32)READ_LE_UINT32(fMegaWalkData);
|
||||||
fMegaWalkData += 4;
|
fMegaWalkData += 4;
|
||||||
}
|
}
|
||||||
/*memmove(&modX[0],fMegaWalkData,NO_DIRECTIONS*sizeof(int32));
|
/*memmove(&modX[0],fMegaWalkData,NO_DIRECTIONS*sizeof(int32));
|
||||||
|
|
|
@ -221,6 +221,7 @@ void SwordScreen::updateScreen(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::newScreen(uint32 screen) {
|
void SwordScreen::newScreen(uint32 screen) {
|
||||||
|
uint8 cnt;
|
||||||
// set sizes and scrolling, initialize/load screengrid, force screen refresh
|
// set sizes and scrolling, initialize/load screengrid, force screen refresh
|
||||||
_currentScreen = screen;
|
_currentScreen = screen;
|
||||||
_scrnSizeX = _roomDefTable[screen].sizeX;
|
_scrnSizeX = _roomDefTable[screen].sizeX;
|
||||||
|
@ -243,13 +244,13 @@ void SwordScreen::newScreen(uint32 screen) {
|
||||||
_screenBuf = (uint8*)malloc(_scrnSizeX * _scrnSizeY);
|
_screenBuf = (uint8*)malloc(_scrnSizeX * _scrnSizeY);
|
||||||
_screenGrid = (uint8*)malloc(_gridSizeX * _gridSizeY);
|
_screenGrid = (uint8*)malloc(_gridSizeX * _gridSizeY);
|
||||||
memset(_screenGrid, 0x80, _gridSizeX * _gridSizeY); // force refresh
|
memset(_screenGrid, 0x80, _gridSizeX * _gridSizeY); // force refresh
|
||||||
for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++) {
|
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++) {
|
||||||
// open and lock all resources, will be closed in quitScreen()
|
// open and lock all resources, will be closed in quitScreen()
|
||||||
_layerBlocks[cnt] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].layers[cnt]);
|
_layerBlocks[cnt] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].layers[cnt]);
|
||||||
if (cnt > 0)
|
if (cnt > 0)
|
||||||
_layerBlocks[cnt] += sizeof(Header);
|
_layerBlocks[cnt] += sizeof(Header);
|
||||||
}
|
}
|
||||||
for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++) {
|
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++) {
|
||||||
// there's no grid for the background layer, so it's totalLayers - 1
|
// there's no grid for the background layer, so it's totalLayers - 1
|
||||||
_layerGrid[cnt] = (uint16*)_resMan->openFetchRes(_roomDefTable[_currentScreen].grids[cnt]);
|
_layerGrid[cnt] = (uint16*)_resMan->openFetchRes(_roomDefTable[_currentScreen].grids[cnt]);
|
||||||
_layerGrid[cnt] += 14;
|
_layerGrid[cnt] += 14;
|
||||||
|
@ -265,9 +266,10 @@ void SwordScreen::newScreen(uint32 screen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::quitScreen(void) {
|
void SwordScreen::quitScreen(void) {
|
||||||
for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++)
|
uint8 cnt;
|
||||||
|
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++)
|
||||||
_resMan->resClose(_roomDefTable[_currentScreen].layers[cnt]);
|
_resMan->resClose(_roomDefTable[_currentScreen].layers[cnt]);
|
||||||
for (uint8 cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++)
|
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++)
|
||||||
_resMan->resClose(_roomDefTable[_currentScreen].grids[cnt]);
|
_resMan->resClose(_roomDefTable[_currentScreen].grids[cnt]);
|
||||||
if (_roomDefTable[_currentScreen].parallax[0])
|
if (_roomDefTable[_currentScreen].parallax[0])
|
||||||
_resMan->resClose(_roomDefTable[_currentScreen].parallax[0]);
|
_resMan->resClose(_roomDefTable[_currentScreen].parallax[0]);
|
||||||
|
@ -276,6 +278,7 @@ void SwordScreen::quitScreen(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::draw(void) {
|
void SwordScreen::draw(void) {
|
||||||
|
uint8 cnt;
|
||||||
if (_currentScreen == 54) {
|
if (_currentScreen == 54) {
|
||||||
// rm54 has a BACKGROUND parallax layer in parallax[0]
|
// rm54 has a BACKGROUND parallax layer in parallax[0]
|
||||||
if (_parallax[0])
|
if (_parallax[0])
|
||||||
|
@ -292,15 +295,15 @@ void SwordScreen::draw(void) {
|
||||||
} else
|
} else
|
||||||
memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
|
memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
|
||||||
|
|
||||||
for (uint8 cnt = 0; cnt < _backLength; cnt++)
|
for (cnt = 0; cnt < _backLength; cnt++)
|
||||||
processImage(_backList[cnt]);
|
processImage(_backList[cnt]);
|
||||||
|
|
||||||
for (uint8 cnt = 0; cnt < _sortLength - 1; cnt++)
|
for (cnt = 0; cnt < _sortLength - 1; cnt++)
|
||||||
for (uint8 sCnt = 0; sCnt < _sortLength - 1; sCnt++)
|
for (uint8 sCnt = 0; sCnt < _sortLength - 1; sCnt++)
|
||||||
if (_sortList[sCnt].y > _sortList[sCnt + 1].y) {
|
if (_sortList[sCnt].y > _sortList[sCnt + 1].y) {
|
||||||
SWAP(_sortList[sCnt], _sortList[sCnt + 1]);
|
SWAP(_sortList[sCnt], _sortList[sCnt + 1]);
|
||||||
}
|
}
|
||||||
for (uint8 cnt = 0; cnt < _sortLength; cnt++)
|
for (cnt = 0; cnt < _sortLength; cnt++)
|
||||||
processImage(_sortList[cnt].id);
|
processImage(_sortList[cnt].id);
|
||||||
|
|
||||||
if ((_currentScreen != 54) && _parallax[0])
|
if ((_currentScreen != 54) && _parallax[0])
|
||||||
|
@ -308,7 +311,7 @@ void SwordScreen::draw(void) {
|
||||||
if (_parallax[1])
|
if (_parallax[1])
|
||||||
renderParallax(_parallax[1]);
|
renderParallax(_parallax[1]);
|
||||||
|
|
||||||
for (uint8 cnt = 0; cnt < _foreLength; cnt++)
|
for (cnt = 0; cnt < _foreLength; cnt++)
|
||||||
processImage(_foreList[cnt]);
|
processImage(_foreList[cnt]);
|
||||||
|
|
||||||
_backLength = _sortLength = _foreLength = 0;
|
_backLength = _sortLength = _foreLength = 0;
|
||||||
|
@ -543,7 +546,8 @@ void SwordScreen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 sca
|
||||||
uint32 oldRow = 0;
|
uint32 oldRow = 0;
|
||||||
|
|
||||||
uint8 *destPos = dest;
|
uint8 *destPos = dest;
|
||||||
for (uint16 lnCnt = 0; lnCnt < resHeight; lnCnt++) {
|
uint16 lnCnt;
|
||||||
|
for (lnCnt = 0; lnCnt < resHeight; lnCnt++) {
|
||||||
while (oldRow < (newRow >> 8)) {
|
while (oldRow < (newRow >> 8)) {
|
||||||
oldRow++;
|
oldRow++;
|
||||||
src += width;
|
src += width;
|
||||||
|
@ -554,7 +558,7 @@ void SwordScreen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 sca
|
||||||
newRow += step;
|
newRow += step;
|
||||||
}
|
}
|
||||||
// scaled, now stipple shadows if there are any
|
// scaled, now stipple shadows if there are any
|
||||||
for (uint16 lnCnt = 0; lnCnt < resHeight; lnCnt++) {
|
for (lnCnt = 0; lnCnt < resHeight; lnCnt++) {
|
||||||
uint16 xCnt = lnCnt & 1;
|
uint16 xCnt = lnCnt & 1;
|
||||||
destPos = dest + lnCnt * resWidth + (lnCnt & 1);
|
destPos = dest + lnCnt * resWidth + (lnCnt & 1);
|
||||||
while (xCnt < resWidth) {
|
while (xCnt < resWidth) {
|
||||||
|
|
|
@ -73,16 +73,16 @@ void SwordSound::engine(void) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// now process the queue
|
// now process the queue
|
||||||
for (uint8 cnt = 0; cnt < _endOfQueue; cnt++) {
|
for (uint8 cnt2 = 0; cnt2 < _endOfQueue; cnt2++) {
|
||||||
if (_fxQueue[cnt].delay > 0) {
|
if (_fxQueue[cnt2].delay > 0) {
|
||||||
_fxQueue[cnt].delay--;
|
_fxQueue[cnt2].delay--;
|
||||||
if (_fxQueue[cnt].delay == 0)
|
if (_fxQueue[cnt2].delay == 0)
|
||||||
playSample(&_fxQueue[cnt]);
|
playSample(&_fxQueue[cnt2]);
|
||||||
} else {
|
} else {
|
||||||
if (!_fxQueue[cnt].handle) { // sound finished
|
if (!_fxQueue[cnt2].handle) { // sound finished
|
||||||
_resMan->resClose(_fxList[_fxQueue[cnt].id].sampleId);
|
_resMan->resClose(_fxList[_fxQueue[cnt2].id].sampleId);
|
||||||
if (cnt != _endOfQueue-1)
|
if (cnt2 != _endOfQueue-1)
|
||||||
_fxQueue[cnt] = _fxQueue[_endOfQueue - 1];
|
_fxQueue[cnt2] = _fxQueue[_endOfQueue - 1];
|
||||||
_endOfQueue--;
|
_endOfQueue--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,8 @@ void SwordText::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 p
|
||||||
uint16 numLines = analyzeSentence(text, maxWidth, lines);
|
uint16 numLines = analyzeSentence(text, maxWidth, lines);
|
||||||
|
|
||||||
uint16 sprWidth = 0;
|
uint16 sprWidth = 0;
|
||||||
for (uint16 lineCnt = 0; lineCnt < numLines; lineCnt++)
|
uint16 lineCnt;
|
||||||
|
for (lineCnt = 0; lineCnt < numLines; lineCnt++)
|
||||||
if (lines[lineCnt].width > sprWidth)
|
if (lines[lineCnt].width > sprWidth)
|
||||||
sprWidth = lines[lineCnt].width;
|
sprWidth = lines[lineCnt].width;
|
||||||
uint16 sprHeight = _charHeight * numLines;
|
uint16 sprHeight = _charHeight * numLines;
|
||||||
|
@ -93,7 +94,7 @@ void SwordText::makeTextSprite(uint8 slot, uint8 *text, uint16 maxWidth, uint8 p
|
||||||
|
|
||||||
uint8 *linePtr = ((uint8*)_textBlocks[slot]) + sizeof(FrameHeader);
|
uint8 *linePtr = ((uint8*)_textBlocks[slot]) + sizeof(FrameHeader);
|
||||||
memset(linePtr, NO_COL, sprSize);
|
memset(linePtr, NO_COL, sprSize);
|
||||||
for (uint16 lineCnt = 0; lineCnt < numLines; lineCnt++) {
|
for (lineCnt = 0; lineCnt < numLines; lineCnt++) {
|
||||||
uint8 *sprPtr = linePtr + (sprWidth - lines[lineCnt].width) / 2; // center the text
|
uint8 *sprPtr = linePtr + (sprWidth - lines[lineCnt].width) / 2; // center the text
|
||||||
for (uint16 pos = 0; pos < lines[lineCnt].length; pos++)
|
for (uint16 pos = 0; pos < lines[lineCnt].length; pos++)
|
||||||
sprPtr += copyChar(*text++, sprPtr, sprWidth, pen) - OVERLAP;
|
sprPtr += copyChar(*text++, sprPtr, sprWidth, pen) - OVERLAP;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue