Whitespace changes
svn-id: r11760
This commit is contained in:
parent
b7a5d97207
commit
b179e8f6ec
17 changed files with 617 additions and 619 deletions
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
class SwordDebug {
|
class SwordDebug {
|
||||||
public:
|
public:
|
||||||
static void interpretScript(uint32 id, uint32 level, uint32 script, uint32 pc);
|
static void interpretScript(uint32 id, uint32 level, uint32 script, uint32 pc);
|
||||||
static void callMCode(uint32 mcodeNum, uint32 paramCount, int32 a, int32 b, int32 c, int32 d, int32 e, int32 f);
|
static void callMCode(uint32 mcodeNum, uint32 paramCount, int32 a, int32 b, int32 c, int32 d, int32 e, int32 f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -65,7 +65,7 @@ int EventManager::fnCheckForEvent(BsObject *cpt, int32 id, int32 pause) {
|
||||||
if (pause) {
|
if (pause) {
|
||||||
cpt->o_pause = pause;
|
cpt->o_pause = pause;
|
||||||
cpt->o_logic = LOGIC_pause_for_event;
|
cpt->o_logic = LOGIC_pause_for_event;
|
||||||
return SCRIPT_STOP;
|
return SCRIPT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8 objCnt = 0; objCnt < O_TOTAL_EVENTS; objCnt++) {
|
for (uint8 objCnt = 0; objCnt < O_TOTAL_EVENTS; objCnt++) {
|
||||||
|
|
|
@ -184,7 +184,7 @@ void SwordLogic::processLogic(BsObject *compact, uint32 id) {
|
||||||
logicRet=1;
|
logicRet=1;
|
||||||
break;
|
break;
|
||||||
case LOGIC_bookmark:
|
case LOGIC_bookmark:
|
||||||
memcpy(&(compact->o_tree.o_script_level), &(compact->o_bookmark.o_script_level), sizeof(ScriptTree));
|
memcpy(&(compact->o_tree.o_script_level), &(compact->o_bookmark.o_script_level), sizeof(ScriptTree));
|
||||||
compact->o_logic = LOGIC_script;
|
compact->o_logic = LOGIC_script;
|
||||||
logicRet = 1;
|
logicRet = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -395,7 +395,7 @@ int SwordLogic::scriptManager(BsObject *compact, uint32 id) {
|
||||||
} else
|
} else
|
||||||
compact->o_tree.o_script_pc[level] = ret;
|
compact->o_tree.o_script_pc[level] = ret;
|
||||||
} while (!ret);
|
} while (!ret);
|
||||||
return 1;
|
return 1;
|
||||||
//Logic continues - but the script must have changed logic mode
|
//Logic continues - but the script must have changed logic mode
|
||||||
//this is a radical change from S2.0 where once a script finished there
|
//this is a radical change from S2.0 where once a script finished there
|
||||||
//was no more processing for that object on that cycle - the Logic_engine terminated.
|
//was no more processing for that object on that cycle - the Logic_engine terminated.
|
||||||
|
@ -549,7 +549,7 @@ int SwordLogic::interpretScript(BsObject *compact, int id, Header *scriptModule,
|
||||||
debug(9, "IT_SCRIPTEND");
|
debug(9, "IT_SCRIPTEND");
|
||||||
return 0;
|
return 0;
|
||||||
case IT_POPVAR: // pop a variable
|
case IT_POPVAR: // pop a variable
|
||||||
debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx-1]);
|
debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx-1]);
|
||||||
_scriptVars[scriptCode[pc++]] = stack[--stackIdx];
|
_scriptVars[scriptCode[pc++]] = stack[--stackIdx];
|
||||||
break;
|
break;
|
||||||
case IT_POPLONGOFFSET:
|
case IT_POPLONGOFFSET:
|
||||||
|
@ -788,7 +788,7 @@ int SwordLogic::fnAnim(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32 e, i
|
||||||
cpt->o_logic = LOGIC_anim;
|
cpt->o_logic = LOGIC_anim;
|
||||||
cpt->o_anim_pc = 0;
|
cpt->o_anim_pc = 0;
|
||||||
cpt->o_sync = 0;
|
cpt->o_sync = 0;
|
||||||
return SCRIPT_STOP;
|
return SCRIPT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SwordLogic::fnSetFrame(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
|
int SwordLogic::fnSetFrame(BsObject *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
|
||||||
|
@ -1067,7 +1067,7 @@ int SwordLogic::fnISpeak(BsObject *cpt, int32 id, int32 cdt, int32 textNo, int32
|
||||||
_speechRunning = _sound->startSpeech(textNo >> 16, textNo & 0xFFFF);
|
_speechRunning = _sound->startSpeech(textNo >> 16, textNo & 0xFFFF);
|
||||||
else
|
else
|
||||||
_speechRunning = false;
|
_speechRunning = false;
|
||||||
_speechFinished = false;
|
_speechFinished = false;
|
||||||
if (SwordEngine::_systemVars.showText || (!_speechRunning)) {
|
if (SwordEngine::_systemVars.showText || (!_speechRunning)) {
|
||||||
_textRunning = true;
|
_textRunning = true;
|
||||||
|
|
||||||
|
@ -1125,7 +1125,7 @@ int SwordLogic::fnTheyDo(BsObject *cpt, int32 id, int32 tar, int32 instruc, int3
|
||||||
target->o_ins1 = param1;
|
target->o_ins1 = param1;
|
||||||
target->o_ins2 = param2;
|
target->o_ins2 = param2;
|
||||||
target->o_ins3 = param3;
|
target->o_ins3 = param3;
|
||||||
return SCRIPT_CONT;
|
return SCRIPT_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
//send an instruction to mega we're talking to and wait
|
//send an instruction to mega we're talking to and wait
|
||||||
|
@ -1176,7 +1176,7 @@ int SwordLogic::fnStartTalk(BsObject *cpt, int32 id, int32 target, int32 d, int3
|
||||||
|
|
||||||
int SwordLogic::fnCheckForTextLine(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
|
int SwordLogic::fnCheckForTextLine(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
|
||||||
_scriptVars[RETURN_VALUE] = _objMan->fnCheckForTextLine(id);
|
_scriptVars[RETURN_VALUE] = _objMan->fnCheckForTextLine(id);
|
||||||
return SCRIPT_CONT;
|
return SCRIPT_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SwordLogic::fnAddTalkWaitStatusBit(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
|
int SwordLogic::fnAddTalkWaitStatusBit(BsObject *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
|
||||||
|
@ -1306,7 +1306,7 @@ int SwordLogic::fnChangeFloor(BsObject *cpt, int32 id, int32 floor, int32 d, int
|
||||||
BsObject *floorCpt = _objMan->fetchObject(floor);
|
BsObject *floorCpt = _objMan->fetchObject(floor);
|
||||||
cpt->o_scale_a = floorCpt->o_scale_a;
|
cpt->o_scale_a = floorCpt->o_scale_a;
|
||||||
cpt->o_scale_b = floorCpt->o_scale_b;
|
cpt->o_scale_b = floorCpt->o_scale_b;
|
||||||
return SCRIPT_CONT;
|
return SCRIPT_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SwordLogic::fnWalk(BsObject *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stance, int32 a, int32 b) {
|
int SwordLogic::fnWalk(BsObject *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stance, int32 a, int32 b) {
|
||||||
|
@ -1350,7 +1350,7 @@ int SwordLogic::fnWalk(BsObject *cpt, int32 id, int32 x, int32 y, int32 dir, int
|
||||||
cpt->o_down_flag = 1; // pretend it was successful
|
cpt->o_down_flag = 1; // pretend it was successful
|
||||||
else
|
else
|
||||||
cpt->o_down_flag = 0; // 0 means error
|
cpt->o_down_flag = 0; // 0 means error
|
||||||
|
|
||||||
return SCRIPT_CONT;
|
return SCRIPT_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1446,7 +1446,7 @@ int SwordLogic::fnGetTo(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int3
|
||||||
cpt->o_tree.o_script_level++;
|
cpt->o_tree.o_script_level++;
|
||||||
cpt->o_tree.o_script_pc[cpt->o_tree.o_script_level] = place->o_get_to_script;
|
cpt->o_tree.o_script_pc[cpt->o_tree.o_script_level] = place->o_get_to_script;
|
||||||
cpt->o_tree.o_script_id[cpt->o_tree.o_script_level] = place->o_get_to_script;
|
cpt->o_tree.o_script_id[cpt->o_tree.o_script_level] = place->o_get_to_script;
|
||||||
return SCRIPT_STOP;
|
return SCRIPT_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SwordLogic::fnGetToError(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
|
int SwordLogic::fnGetToError(BsObject *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ void MemMan::alloc(BsMemHandle *bsMem, uint32 pSize, uint16 pCond) {
|
||||||
warning("%d Bytes alloced as FREEABLE.", pSize); // why should one want to alloc mem if it can be freed?
|
warning("%d Bytes alloced as FREEABLE.", pSize); // why should one want to alloc mem if it can be freed?
|
||||||
addToFreeList(bsMem);
|
addToFreeList(bsMem);
|
||||||
} else if (bsMem->next || bsMem->prev) // it's in our _freeAble list, remove it from there
|
} else if (bsMem->next || bsMem->prev) // it's in our _freeAble list, remove it from there
|
||||||
removeFromFreeList(bsMem);
|
removeFromFreeList(bsMem);
|
||||||
checkMemoryUsage();
|
checkMemoryUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ void SwordMouse::setPointer(uint32 resId, uint32 rate) {
|
||||||
_specialPtrId = resId;
|
_specialPtrId = resId;
|
||||||
_specialPtr = (MousePtr*)_resMan->mouseResOpen(resId);
|
_specialPtr = (MousePtr*)_resMan->mouseResOpen(resId);
|
||||||
}
|
}
|
||||||
animate();
|
animate();
|
||||||
_system->show_mouse(true);
|
_system->show_mouse(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,7 +249,7 @@ void SwordMouse::fnLockMouse(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordMouse::fnUnlockMouse(void) {
|
void SwordMouse::fnUnlockMouse(void) {
|
||||||
_mouseStatus &= 1;
|
_mouseStatus &= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordMouse::giveCoords(uint16 *x, uint16 *y) {
|
void SwordMouse::giveCoords(uint16 *x, uint16 *y) {
|
||||||
|
|
|
@ -67,8 +67,8 @@ class OSystem;
|
||||||
class SwordMouse {
|
class SwordMouse {
|
||||||
public:
|
public:
|
||||||
SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
|
SwordMouse(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan);
|
||||||
void addToList(int id, BsObject *compact);
|
void addToList(int id, BsObject *compact);
|
||||||
void useLogicAndMenu(SwordLogic *pLogic, SwordMenu *pMenu);
|
void useLogicAndMenu(SwordLogic *pLogic, SwordMenu *pMenu);
|
||||||
void setLuggage(uint32 resID, uint32 rate);
|
void setLuggage(uint32 resID, uint32 rate);
|
||||||
void setPointer(uint32 resID, uint32 rate);
|
void setPointer(uint32 resID, uint32 rate);
|
||||||
void animate(void);
|
void animate(void);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
void unlockText(uint32 textId);
|
void unlockText(uint32 textId);
|
||||||
uint32 lastTextNumber(int section);
|
uint32 lastTextNumber(int section);
|
||||||
|
|
||||||
void closeSection(uint32 screen);
|
void closeSection(uint32 screen);
|
||||||
private:
|
private:
|
||||||
ResMan *_resMan;
|
ResMan *_resMan;
|
||||||
static const uint32 _objectList[TOTAL_SECTIONS]; //a table of pointers to object files
|
static const uint32 _objectList[TOTAL_SECTIONS]; //a table of pointers to object files
|
||||||
|
|
|
@ -85,7 +85,7 @@ void ResMan::loadCluDescript(const char *fileName) {
|
||||||
_memMan->initHandle(group->resHandle + resCnt);
|
_memMan->initHandle(group->resHandle + resCnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(resIdIdx);
|
free(resIdIdx);
|
||||||
} else
|
} else
|
||||||
cluster->grp[grpCnt] = NULL;
|
cluster->grp[grpCnt] = NULL;
|
||||||
free(grpIndex);
|
free(grpIndex);
|
||||||
|
@ -200,7 +200,7 @@ void ResMan::resClose(uint32 id) {
|
||||||
|
|
||||||
FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) {
|
FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) {
|
||||||
uint8 *frameFile = (uint8*)resourceData;
|
uint8 *frameFile = (uint8*)resourceData;
|
||||||
uint8 *idxData = frameFile + sizeof(Header);
|
uint8 *idxData = frameFile + sizeof(Header);
|
||||||
if (frameNo >= READ_LE_UINT32(idxData))
|
if (frameNo >= READ_LE_UINT32(idxData))
|
||||||
error("fetchFrame:: frame %d doesn't exist in resource.", frameNo);
|
error("fetchFrame:: frame %d doesn't exist in resource.", frameNo);
|
||||||
frameFile += READ_LE_UINT32(idxData + (frameNo+1) * 4);
|
frameFile += READ_LE_UINT32(idxData + (frameNo+1) * 4);
|
||||||
|
|
|
@ -68,7 +68,7 @@ private:
|
||||||
void openCptResourceBigEndian(uint32 id);
|
void openCptResourceBigEndian(uint32 id);
|
||||||
void openScriptResourceBigEndian(uint32 id);
|
void openScriptResourceBigEndian(uint32 id);
|
||||||
|
|
||||||
File *openClusterFile(uint32 id);
|
File *openClusterFile(uint32 id);
|
||||||
void makePathToCluster(char *str);
|
void makePathToCluster(char *str);
|
||||||
void loadCluDescript(const char *fileName);
|
void loadCluDescript(const char *fileName);
|
||||||
void freeCluDescript(void);
|
void freeCluDescript(void);
|
||||||
|
|
1048
sword1/router.cpp
1048
sword1/router.cpp
File diff suppressed because it is too large
Load diff
|
@ -177,7 +177,7 @@ private:
|
||||||
int32 SmoothestPath();
|
int32 SmoothestPath();
|
||||||
int32 SmoothCheck(int32 best, int32 p, int32 dirS, int32 dirD);
|
int32 SmoothCheck(int32 best, int32 p, int32 dirS, int32 dirD);
|
||||||
|
|
||||||
int32 SolidPath();
|
int32 SolidPath();
|
||||||
int32 SolidWalkAnimator(WalkData *walkAnim);
|
int32 SolidWalkAnimator(WalkData *walkAnim);
|
||||||
void RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour);
|
void RouteLine(int32 x1,int32 y1,int32 x2,int32 y2 ,int32 colour);
|
||||||
void BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *screen, int32 width, int32 height, int32 colour);
|
void BresenhamLine(int32 x1,int32 y1,int32 x2,int32 y2, uint8 *screen, int32 width, int32 height, int32 colour);
|
||||||
|
|
|
@ -292,7 +292,7 @@ void SwordScreen::spritesAndParallax(void) {
|
||||||
for (uint8 cnt = 0; cnt < _sortLength - 1; cnt++)
|
for (uint8 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) {
|
||||||
temp = _sortList[sCnt];
|
temp = _sortList[sCnt];
|
||||||
_sortList[sCnt] = _sortList[sCnt + 1];
|
_sortList[sCnt] = _sortList[sCnt + 1];
|
||||||
_sortList[sCnt + 1] = temp;
|
_sortList[sCnt + 1] = temp;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ void SwordScreen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight
|
||||||
for (uint16 blky = 0; blky < bHeight; blky++) {
|
for (uint16 blky = 0; blky < bHeight; blky++) {
|
||||||
if (*grid) {
|
if (*grid) {
|
||||||
uint8 *blkData = _layerBlocks[level + 1] + (READ_LE_UINT16(grid) - 1) * 128;
|
uint8 *blkData = _layerBlocks[level + 1] + (READ_LE_UINT16(grid) - 1) * 128;
|
||||||
blitBlockClear(x + blkx, y + blky, blkData);
|
blitBlockClear(x + blkx, y + blky, blkData);
|
||||||
}
|
}
|
||||||
grid += lGridSizeX;
|
grid += lGridSizeX;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ void SwordScreen::renderParallax(uint8 *data) {
|
||||||
if (doSkip <= remain)
|
if (doSkip <= remain)
|
||||||
remain -= doSkip;
|
remain -= doSkip;
|
||||||
else {
|
else {
|
||||||
xPos = doSkip - remain;
|
xPos = doSkip - remain;
|
||||||
dest += xPos;
|
dest += xPos;
|
||||||
remain = 0;
|
remain = 0;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ void SwordScreen::fastShrink(uint8 *src, uint32 width, uint32 height, uint32 sca
|
||||||
uint32 newRow = step >> 1;
|
uint32 newRow = step >> 1;
|
||||||
uint32 oldRow = 0;
|
uint32 oldRow = 0;
|
||||||
|
|
||||||
uint8 *destPos = dest;
|
uint8 *destPos = dest;
|
||||||
for (uint16 lnCnt = 0; lnCnt < resHeight; lnCnt++) {
|
for (uint16 lnCnt = 0; lnCnt < resHeight; lnCnt++) {
|
||||||
while (oldRow < (newRow >> 8)) {
|
while (oldRow < (newRow >> 8)) {
|
||||||
oldRow++;
|
oldRow++;
|
||||||
|
@ -681,7 +681,7 @@ void SwordScreen::spriteClipAndSet(uint16 *pSprX, uint16 *pSprY, uint16 *pSprWid
|
||||||
sprH = _scrnSizeY - sprY;
|
sprH = _scrnSizeY - sprY;
|
||||||
if (sprX + sprW > _scrnSizeX)
|
if (sprX + sprW > _scrnSizeX)
|
||||||
sprW = _scrnSizeX - sprX;
|
sprW = _scrnSizeX - sprX;
|
||||||
|
|
||||||
if (sprH < 0)
|
if (sprH < 0)
|
||||||
*pSprHeight = 0;
|
*pSprHeight = 0;
|
||||||
else
|
else
|
||||||
|
@ -742,48 +742,48 @@ void SwordScreen::vline(uint16 x, uint16 y1, uint16 y2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::hline(uint16 x1, uint16 x2, uint16 y) {
|
void SwordScreen::hline(uint16 x1, uint16 x2, uint16 y) {
|
||||||
for (uint16 cntx = x1; cntx <= x2; cntx++)
|
for (uint16 cntx = x1; cntx <= x2; cntx++)
|
||||||
_screenBuf[y * _scrnSizeX + cntx] = 0;
|
_screenBuf[y * _scrnSizeX + cntx] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::bsubline_1(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
void SwordScreen::bsubline_1(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||||
int x, y, ddx, ddy, e;
|
int x, y, ddx, ddy, e;
|
||||||
ddx = abs(x2 - x1);
|
ddx = abs(x2 - x1);
|
||||||
ddy = abs(y2 - y1) << 1;
|
ddy = abs(y2 - y1) << 1;
|
||||||
e = ddx - ddy;
|
e = ddx - ddy;
|
||||||
ddx <<= 1;
|
ddx <<= 1;
|
||||||
|
|
||||||
if (x1 > x2) {
|
if (x1 > x2) {
|
||||||
uint16 tmp;
|
uint16 tmp;
|
||||||
tmp = x1; x1 = x2; x2 = tmp;
|
tmp = x1; x1 = x2; x2 = tmp;
|
||||||
tmp = y1; y1 = y2; y2 = tmp;
|
tmp = y1; y1 = y2; y2 = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x = x1, y = y1; x <= x2; x++) {
|
for (x = x1, y = y1; x <= x2; x++) {
|
||||||
_screenBuf[y * _scrnSizeX + x] = 0;
|
_screenBuf[y * _scrnSizeX + x] = 0;
|
||||||
if (e < 0) {
|
if (e < 0) {
|
||||||
y++;
|
y++;
|
||||||
e += ddx - ddy;
|
e += ddx - ddy;
|
||||||
} else {
|
} else {
|
||||||
e -= ddy;
|
e -= ddy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::bsubline_2(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
void SwordScreen::bsubline_2(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||||
int x, y, ddx, ddy, e;
|
int x, y, ddx, ddy, e;
|
||||||
ddx = abs(x2 - x1) << 1;
|
ddx = abs(x2 - x1) << 1;
|
||||||
ddy = abs(y2 - y1);
|
ddy = abs(y2 - y1);
|
||||||
e = ddy - ddx;
|
e = ddy - ddx;
|
||||||
ddy <<= 1;
|
ddy <<= 1;
|
||||||
|
|
||||||
if (y1 > y2) {
|
if (y1 > y2) {
|
||||||
uint16 tmp;
|
uint16 tmp;
|
||||||
tmp = x1; x1 = x2; x2 = tmp;
|
tmp = x1; x1 = x2; x2 = tmp;
|
||||||
tmp = y1; y1 = y2; y2 = tmp;
|
tmp = y1; y1 = y2; y2 = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y = y1, x = x1; y <= y2; y++) {
|
for (y = y1, x = x1; y <= y2; y++) {
|
||||||
_screenBuf[y * _scrnSizeX + x] = 0;
|
_screenBuf[y * _scrnSizeX + x] = 0;
|
||||||
if (e < 0) {
|
if (e < 0) {
|
||||||
x++;
|
x++;
|
||||||
|
@ -791,80 +791,80 @@ void SwordScreen::bsubline_2(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||||
} else {
|
} else {
|
||||||
e -= ddx;
|
e -= ddx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::bsubline_3(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
void SwordScreen::bsubline_3(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||||
int x, y, ddx, ddy, e;
|
int x, y, ddx, ddy, e;
|
||||||
ddx = abs(x1 - x2) << 1;
|
ddx = abs(x1 - x2) << 1;
|
||||||
ddy = abs(y2 - y1);
|
ddy = abs(y2 - y1);
|
||||||
e = ddy - ddx;
|
e = ddy - ddx;
|
||||||
ddy <<= 1;
|
ddy <<= 1;
|
||||||
|
|
||||||
if (y1 > y2) {
|
if (y1 > y2) {
|
||||||
uint16 tmp;
|
uint16 tmp;
|
||||||
tmp = x1; x1 = x2; x2 = tmp;
|
tmp = x1; x1 = x2; x2 = tmp;
|
||||||
tmp = y1; y1 = y2; y2 = tmp;
|
tmp = y1; y1 = y2; y2 = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y = y1, x = x1; y <= y2; y++) {
|
for (y = y1, x = x1; y <= y2; y++) {
|
||||||
_screenBuf[y * _scrnSizeX + x] = 0;
|
_screenBuf[y * _scrnSizeX + x] = 0;
|
||||||
if (e < 0) {
|
if (e < 0) {
|
||||||
x--;
|
x--;
|
||||||
e += ddy - ddx;
|
e += ddy - ddx;
|
||||||
} else {
|
} else {
|
||||||
e -= ddx;
|
e -= ddx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::bsubline_4(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
void SwordScreen::bsubline_4(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||||
int x, y, ddx, ddy, e;
|
int x, y, ddx, ddy, e;
|
||||||
ddy = abs(y2 - y1) << 1;
|
ddy = abs(y2 - y1) << 1;
|
||||||
ddx = abs(x1 - x2);
|
ddx = abs(x1 - x2);
|
||||||
e = ddx - ddy;
|
e = ddx - ddy;
|
||||||
ddx <<= 1;
|
ddx <<= 1;
|
||||||
|
|
||||||
if (x1 > x2) {
|
if (x1 > x2) {
|
||||||
uint16 tmp;
|
uint16 tmp;
|
||||||
tmp = x1; x1 = x2; x2 = tmp;
|
tmp = x1; x1 = x2; x2 = tmp;
|
||||||
tmp = y1; y1 = y2; y2 = tmp;
|
tmp = y1; y1 = y2; y2 = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x = x1, y = y1; x <= x2; x++) {
|
for (x = x1, y = y1; x <= x2; x++) {
|
||||||
_screenBuf[y * _scrnSizeX + x] = 0;
|
_screenBuf[y * _scrnSizeX + x] = 0;
|
||||||
if (e < 0) {
|
if (e < 0) {
|
||||||
y--;
|
y--;
|
||||||
e += ddx - ddy;
|
e += ddx - ddy;
|
||||||
} else {
|
} else {
|
||||||
e -= ddy;
|
e -= ddy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordScreen::drawLine(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
void SwordScreen::drawLine(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
||||||
if ((x1 == x2) && (y1 == y2)) {
|
if ((x1 == x2) && (y1 == y2)) {
|
||||||
_screenBuf[x1 + y1 * _scrnSizeX] = 0;
|
_screenBuf[x1 + y1 * _scrnSizeX] = 0;
|
||||||
}
|
}
|
||||||
if (x1 == x2) {
|
if (x1 == x2) {
|
||||||
vline(x1, MIN(y1, y2), MAX(y1, y2));
|
vline(x1, MIN(y1, y2), MAX(y1, y2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y1 == y2) {
|
if (y1 == y2) {
|
||||||
hline(MIN(x1, x2), MAX(x1, x2), y1);
|
hline(MIN(x1, x2), MAX(x1, x2), y1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float k = float(y2 - y1) / float(x2 - x1);
|
float k = float(y2 - y1) / float(x2 - x1);
|
||||||
|
|
||||||
if ((k >= 0) && (k <= 1)) {
|
if ((k >= 0) && (k <= 1)) {
|
||||||
bsubline_1(x1, y1, x2, y2);
|
bsubline_1(x1, y1, x2, y2);
|
||||||
} else if (k > 1) {
|
} else if (k > 1) {
|
||||||
bsubline_2(x1, y1, x2, y2);
|
bsubline_2(x1, y1, x2, y2);
|
||||||
} else if ((k < 0) && (k >= -1)) {
|
} else if ((k < 0) && (k >= -1)) {
|
||||||
bsubline_4(x1, y1, x2, y2);
|
bsubline_4(x1, y1, x2, y2);
|
||||||
} else {
|
} else {
|
||||||
bsubline_3(x1, y1, x2, y2);
|
bsubline_3(x1, y1, x2, y2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,7 @@ private:
|
||||||
ObjectMan *_objMan;
|
ObjectMan *_objMan;
|
||||||
SwordText *_textMan;
|
SwordText *_textMan;
|
||||||
|
|
||||||
uint16 _currentScreen;
|
uint16 _currentScreen;
|
||||||
uint8 *_screenBuf;
|
uint8 *_screenBuf;
|
||||||
uint8 *_screenGrid;
|
uint8 *_screenGrid;
|
||||||
uint16 *_layerGrid[4];
|
uint16 *_layerGrid[4];
|
||||||
|
|
|
@ -95,7 +95,7 @@ void SwordSound::fnStopFx(int32 fxNo) {
|
||||||
if (_fxQueue[cnt].id == (uint32)fxNo) {
|
if (_fxQueue[cnt].id == (uint32)fxNo) {
|
||||||
if (!_fxQueue[cnt].delay) // sound was started
|
if (!_fxQueue[cnt].delay) // sound was started
|
||||||
_resMan->resClose(_fxList[_fxQueue[cnt].id].sampleId);
|
_resMan->resClose(_fxList[_fxQueue[cnt].id].sampleId);
|
||||||
if (cnt != _endOfQueue-1)
|
if (cnt != _endOfQueue-1)
|
||||||
_fxQueue[cnt] = _fxQueue[_endOfQueue-1];
|
_fxQueue[cnt] = _fxQueue[_endOfQueue-1];
|
||||||
_endOfQueue--;
|
_endOfQueue--;
|
||||||
return ;
|
return ;
|
||||||
|
@ -118,7 +118,7 @@ void SwordSound::closeCowSysten(void) {
|
||||||
bool SwordSound::speechFinished(void) {
|
bool SwordSound::speechFinished(void) {
|
||||||
//warning("stub: SwordSound::speechFinished()");
|
//warning("stub: SwordSound::speechFinished()");
|
||||||
//return true;
|
//return true;
|
||||||
return (_speechHandle == 0);
|
return (_speechHandle == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwordSound::newScreen(uint16 screen) {
|
void SwordSound::newScreen(uint16 screen) {
|
||||||
|
@ -171,7 +171,7 @@ bool SwordSound::startSpeech(uint16 roomNo, uint16 localNo) {
|
||||||
uint8 *buf = (uint8*)malloc(sampleSize);
|
uint8 *buf = (uint8*)malloc(sampleSize);
|
||||||
_cowFile.read(buf, sampleSize);
|
_cowFile.read(buf, sampleSize);
|
||||||
uint8 *smpBuf = (uint8*)malloc(uncompressedSize(buf));
|
uint8 *smpBuf = (uint8*)malloc(uncompressedSize(buf));
|
||||||
uint32 size = expandSpeech(buf, smpBuf, sampleSize);
|
uint32 size = expandSpeech(buf, smpBuf, sampleSize);
|
||||||
free(buf);
|
free(buf);
|
||||||
if (!size) {
|
if (!size) {
|
||||||
free(smpBuf);
|
free(smpBuf);
|
||||||
|
|
|
@ -1010,7 +1010,7 @@ void SwordEngine::go(void) {
|
||||||
initialize();
|
initialize();
|
||||||
// check if we have savegames. if we do, show control panel, else start intro.
|
// check if we have savegames. if we do, show control panel, else start intro.
|
||||||
do {
|
do {
|
||||||
mainLoop();
|
mainLoop();
|
||||||
// mainLoop was left, show control panel
|
// mainLoop was left, show control panel
|
||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1081,7 @@ void SwordEngine::mainLoop(void) {
|
||||||
|
|
||||||
_screen->quitScreen(); // close graphic resources
|
_screen->quitScreen(); // close graphic resources
|
||||||
_objectMan->closeSection(SwordLogic::_scriptVars[SCREEN]); // close the section that PLAYER has just left, if it's empty now
|
_objectMan->closeSection(SwordLogic::_scriptVars[SCREEN]); // close the section that PLAYER has just left, if it's empty now
|
||||||
// todo: stop sfx, clear sfx queue, free sfx memory
|
// todo: stop sfx, clear sfx queue, free sfx memory
|
||||||
} while (_systemVars.saveGameFlag < 2);
|
} while (_systemVars.saveGameFlag < 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct SystemVars {
|
||||||
//uint8 framesPerSecond; // toggles one frame pre second mode on "1"
|
//uint8 framesPerSecond; // toggles one frame pre second mode on "1"
|
||||||
//uint8 writingPCXs; // writing a PCX every frame on "f"
|
//uint8 writingPCXs; // writing a PCX every frame on "f"
|
||||||
//int16 parallaxOn; I think we don't need this.
|
//int16 parallaxOn; I think we don't need this.
|
||||||
uint8 language;
|
uint8 language;
|
||||||
int32 currentMusic;
|
int32 currentMusic;
|
||||||
//uint32 gameCycle;
|
//uint32 gameCycle;
|
||||||
};
|
};
|
||||||
|
|
|
@ -85,7 +85,7 @@ struct ParallaxHeader {
|
||||||
char type[16];
|
char type[16];
|
||||||
uint16 sizeX;
|
uint16 sizeX;
|
||||||
uint16 sizeY;
|
uint16 sizeY;
|
||||||
uint32 lineIndexes[2]; //2 is arbitrary number
|
uint32 lineIndexes[2]; //2 is arbitrary number
|
||||||
} GCC_PACK;
|
} GCC_PACK;
|
||||||
|
|
||||||
struct AnimUnit {
|
struct AnimUnit {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue