GRIFFON: Simplify some assignments, reduce some variable scopes

This commit is contained in:
Strangerke 2019-09-13 08:36:43 +02:00 committed by Eugene Sandulenko
parent b1bd677ad0
commit a27a54433c
4 changed files with 24 additions and 31 deletions

View File

@ -169,10 +169,6 @@ void GriffonEngine::showLogos() {
}
void GriffonEngine::intro() {
float xofs = 0;
float ld = 0, add;
int cnt = 0;
_videobuffer2->fillRect(Common::Rect(0, 0, _videobuffer2->w, _videobuffer2->h), 0);
_videobuffer3->fillRect(Common::Rect(0, 0, _videobuffer3->w, _videobuffer3->h), 0);
@ -194,7 +190,9 @@ void GriffonEngine::intro() {
_secstart = 0;
bool ldstop = false;
int cnt = 0;
float xofs = 0.0;
float ld = 0.0;
do {
Common::Rect rc;
@ -223,11 +221,9 @@ void GriffonEngine::intro() {
}
for (int i = 0; i <= 37; i++) {
int yy, x;
yy = y + i * 10;
int yy = y + i * 10;
if (yy > -8 && yy < 240) {
x = 160 - strlen(story[i]) * 4;
int x = 160 - strlen(story[i]) * 4;
drawString(_videobuffer, story[i], x, yy, 4);
}
@ -251,7 +247,7 @@ void GriffonEngine::intro() {
_fp = 0;
}
add = 0.5 * _fpsr;
float add = 0.5 * _fpsr;
if (add > 1)
add = 1;
xofs += add;

View File

@ -633,11 +633,8 @@ void GriffonEngine::saveLoadNew() {
loadPlayer(ff);
if (_playera.level > 0) {
char line[256];
int sx, sy, cc, ss, nx;
sx = 8;
sy = 57 + ff * 48;
int sx = 8;
int sy = 57 + ff * 48;
// time
int ase = _asecstart;
@ -646,12 +643,13 @@ void GriffonEngine::saveLoadNew() {
int m = ((ase - (ase % 60)) / 60);
int s = (ase - m * 60);
char line[256];
sprintf(line, "Game Time: %02i:%02i:%02i", h, m, s);
drawString(_videobuffer, line, 160 - strlen(line) * 4, sy, 0);
sx = 12;
sy = sy + 11;
cc = 0;
int cc = 0;
sprintf(line, "Health: %i/%i", _playera.hp, _playera.maxhp);
drawString(_videobuffer, line, sx, sy, cc);
@ -666,7 +664,7 @@ void GriffonEngine::saveLoadNew() {
rcSrc.left = sx + 15 * 8 + 24;
rcSrc.top = sy + 1;
ss = (_playera.sword - 1) * 3;
int ss = (_playera.sword - 1) * 3;
if (_playera.sword == 3)
ss = 18;
_itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
@ -683,7 +681,7 @@ void GriffonEngine::saveLoadNew() {
ss = 20;
_itemimg[ss]->blit(*_videobuffer, rcSrc.left, rcSrc.top);
nx = rcSrc.left + 13 + 3 * 8;
int nx = rcSrc.left + 13 + 3 * 8;
rcSrc.left = nx - 17;
if (_playera.foundspell[0] == 1) {

View File

@ -747,9 +747,9 @@ void GriffonEngine::drawNPCs(int mode) {
float frame = _npcinfo[i].frame;
int cframe = _npcinfo[i].cframe;
frame = frame + 0.5 * _fpsr;
frame += 0.5 * _fpsr;
while (frame >= 16)
frame = frame - 16;
frame -= 16;
cframe = (int)(frame);
if (cframe > 16)
@ -810,9 +810,9 @@ void GriffonEngine::drawNPCs(int mode) {
float frame = _npcinfo[i].frame2;
frame = frame + 0.5 * _fpsr;
frame += 0.5 * _fpsr;
while (frame >= 16)
frame = frame - 16;
frame -= 16;
_npcinfo[i].frame2 = frame;
@ -842,7 +842,7 @@ void GriffonEngine::drawNPCs(int mode) {
float fr3 = frame - 3 + i2;
if (fr3 < 0)
fr3 = fr3 + 16;
fr3 += 16;
rcDest.left = (float)(sx + 36 + ii * 8 - ii * cos(3.14159 * 2 * (fr3 - ii) / 16) * 2);
rcDest.top = (float)(sy + 16 + ii * sin(3.14159 * 2 * (fr3 - ii) / 16) * 3 - ii); // * 4
@ -939,9 +939,9 @@ void GriffonEngine::drawNPCs(int mode) {
float frame = _npcinfo[i].frame;
int cframe = _npcinfo[i].cframe;
frame = frame + 0.5 * _fpsr;
frame += 0.5 * _fpsr;
while (frame >= 16)
frame = frame - 16;
frame -= 16;
cframe = (int)(frame);
if (cframe > 16)

View File

@ -84,9 +84,9 @@ void GriffonEngine::updateAnims() {
// _objectinfo[i][6] = 0; // ?? out of bounds
if (nframes > 1) {
frame = frame + o_animspd / 50 * _fpsr;
frame += o_animspd / 50 * _fpsr;
while (frame >= nframes)
frame = frame - nframes;
frame -= nframes;
cframe = (int)frame; // truncate fractional part
if (cframe > nframes)
@ -515,13 +515,12 @@ void GriffonEngine::updateNPCs() {
if (_npcinfo[i].moving == 1) {
float frame = _npcinfo[i].frame;
int cframe = _npcinfo[i].cframe;
frame = frame + aspd * _fpsr;
frame += aspd * _fpsr;
while (frame >= 16)
frame = frame - 16;
frame -= 16;
cframe = (int)(frame);
int cframe = (int)(frame);
if (cframe > 16)
cframe = 16 - 1;
if (cframe < 0)