mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Guard all cases obj.getplayer() is used unchecked
obj.getplayer() can return -1, which can cause out-of-bounds indexing of obj.entities, which is really bad. This was by far the most changes, as obj.getplayer() is the most used entity-getting function that returns -1, as well as the most-used function whose sentinel value goes unchecked. To deal with the usage of obj.getplayer() in mapclass::warpto(), I just added general bounds checks inside that function instead of changing all the callers.
This commit is contained in:
parent
08e47e839f
commit
beab344267
7 changed files with 784 additions and 408 deletions
|
@ -2371,8 +2371,9 @@ bool entityclass::updateentities( int i )
|
||||||
case 16: //MAVERICK BUS FOLLOWS HIS OWN RULES
|
case 16: //MAVERICK BUS FOLLOWS HIS OWN RULES
|
||||||
if (entities[i].state == 0) //Init
|
if (entities[i].state == 0) //Init
|
||||||
{
|
{
|
||||||
|
int player = getplayer();
|
||||||
//first, y position
|
//first, y position
|
||||||
if (entities[getplayer()].yp > 14 * 8)
|
if (player > -1 && entities[player].yp > 14 * 8)
|
||||||
{
|
{
|
||||||
entities[i].tile = 120;
|
entities[i].tile = 120;
|
||||||
entities[i].yp = (28*8)-62;
|
entities[i].yp = (28*8)-62;
|
||||||
|
@ -2383,7 +2384,7 @@ bool entityclass::updateentities( int i )
|
||||||
entities[i].yp = 24;
|
entities[i].yp = 24;
|
||||||
}
|
}
|
||||||
//now, x position
|
//now, x position
|
||||||
if (entities[getplayer()].xp > 20 * 8)
|
if (player > -1 && entities[player].xp > 20 * 8)
|
||||||
{
|
{
|
||||||
//approach from the left
|
//approach from the left
|
||||||
entities[i].xp = -64;
|
entities[i].xp = -64;
|
||||||
|
@ -2592,7 +2593,11 @@ bool entityclass::updateentities( int i )
|
||||||
|
|
||||||
game.saverx = game.roomx;
|
game.saverx = game.roomx;
|
||||||
game.savery = game.roomy;
|
game.savery = game.roomy;
|
||||||
game.savedir = entities[getplayer()].dir;
|
int player = getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
|
game.savedir = entities[player].dir;
|
||||||
|
}
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2622,11 +2627,11 @@ bool entityclass::updateentities( int i )
|
||||||
temp = getplayer();
|
temp = getplayer();
|
||||||
if (game.gravitycontrol == 0)
|
if (game.gravitycontrol == 0)
|
||||||
{
|
{
|
||||||
if (entities[temp].vy < 3) entities[temp].vy = 3;
|
if (temp > -1 && entities[temp].vy < 3) entities[temp].vy = 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (entities[temp].vy > -3) entities[temp].vy = -3;
|
if (temp > -1 && entities[temp].vy > -3) entities[temp].vy = -3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (entities[i].state == 2)
|
else if (entities[i].state == 2)
|
||||||
|
@ -2679,20 +2684,20 @@ bool entityclass::updateentities( int i )
|
||||||
if (entities[k].rule == 7) entities[k].tile = 6;
|
if (entities[k].rule == 7) entities[k].tile = 6;
|
||||||
//Stay close to the hero!
|
//Stay close to the hero!
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
if (entities[j].xp > entities[i].xp + 5)
|
if (j > -1 && entities[j].xp > entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 1;
|
entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 5)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 0;
|
entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entities[j].xp > entities[i].xp + 45)
|
if (j > -1 && entities[j].xp > entities[i].xp + 45)
|
||||||
{
|
{
|
||||||
entities[i].ax = 3;
|
entities[i].ax = 3;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 45)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 45)
|
||||||
{
|
{
|
||||||
entities[i].ax = -3;
|
entities[i].ax = -3;
|
||||||
}
|
}
|
||||||
|
@ -2710,20 +2715,20 @@ bool entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
//Basic rules, don't change expression
|
//Basic rules, don't change expression
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
if (entities[j].xp > entities[i].xp + 5)
|
if (j > -1 && entities[j].xp > entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 1;
|
entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 5)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 0;
|
entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entities[j].xp > entities[i].xp + 45)
|
if (j > -1 && entities[j].xp > entities[i].xp + 45)
|
||||||
{
|
{
|
||||||
entities[i].ax = 3;
|
entities[i].ax = 3;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 45)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 45)
|
||||||
{
|
{
|
||||||
entities[i].ax = -3;
|
entities[i].ax = -3;
|
||||||
}
|
}
|
||||||
|
@ -2733,20 +2738,20 @@ bool entityclass::updateentities( int i )
|
||||||
//Everything from 10 on is for cutscenes
|
//Everything from 10 on is for cutscenes
|
||||||
//Basic rules, don't change expression
|
//Basic rules, don't change expression
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
if (entities[j].xp > entities[i].xp + 5)
|
if (j > -1 && entities[j].xp > entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 1;
|
entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 5)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 0;
|
entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entities[j].xp > entities[i].xp + 45)
|
if (j > -1 && entities[j].xp > entities[i].xp + 45)
|
||||||
{
|
{
|
||||||
entities[i].ax = 3;
|
entities[i].ax = 3;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 45)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 45)
|
||||||
{
|
{
|
||||||
entities[i].ax = -3;
|
entities[i].ax = -3;
|
||||||
}
|
}
|
||||||
|
@ -2890,11 +2895,11 @@ bool entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
//Stand still and face the player
|
//Stand still and face the player
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
if (entities[j].xp > entities[i].xp + 5)
|
if (j > -1 && entities[j].xp > entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 1;
|
entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 5)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 0;
|
entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
@ -3006,7 +3011,7 @@ bool entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
//follow player, but only if he's on the floor!
|
//follow player, but only if he's on the floor!
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
if(entities[j].onground>0)
|
if(j > -1 && entities[j].onground>0)
|
||||||
{
|
{
|
||||||
if (entities[j].xp > entities[i].xp + 5)
|
if (entities[j].xp > entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
|
@ -3032,11 +3037,11 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (entities[j].xp > entities[i].xp + 5)
|
if (j > -1 && entities[j].xp > entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 1;
|
entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 5)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 0;
|
entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
@ -3100,7 +3105,7 @@ bool entityclass::updateentities( int i )
|
||||||
case 51: //Vertical warp line
|
case 51: //Vertical warp line
|
||||||
if (entities[i].state == 2){
|
if (entities[i].state == 2){
|
||||||
int j=getplayer();
|
int j=getplayer();
|
||||||
if(entities[j].xp<=307){
|
if(j > -1 && entities[j].xp<=307){
|
||||||
customwarpmodevon=false;
|
customwarpmodevon=false;
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
}
|
}
|
||||||
|
@ -3115,7 +3120,7 @@ bool entityclass::updateentities( int i )
|
||||||
case 52: //Vertical warp line
|
case 52: //Vertical warp line
|
||||||
if (entities[i].state == 2){
|
if (entities[i].state == 2){
|
||||||
int j=getplayer();
|
int j=getplayer();
|
||||||
if(entities[j].xp<=307){
|
if(j > -1 && entities[j].xp<=307){
|
||||||
customwarpmodevon=false;
|
customwarpmodevon=false;
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
}
|
}
|
||||||
|
@ -3157,11 +3162,11 @@ bool entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
//Basic rules, don't change expression
|
//Basic rules, don't change expression
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
if (entities[j].xp > entities[i].xp + 5)
|
if (j > -1 && entities[j].xp > entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 1;
|
entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (entities[j].xp < entities[i].xp - 5)
|
else if (j > -1 && entities[j].xp < entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
entities[i].dir = 0;
|
entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
@ -3226,7 +3231,11 @@ bool entityclass::updateentities( int i )
|
||||||
|
|
||||||
game.saverx = game.roomx;
|
game.saverx = game.roomx;
|
||||||
game.savery = game.roomy;
|
game.savery = game.roomy;
|
||||||
game.savedir = entities[getplayer()].dir;
|
int player = getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
|
game.savedir = entities[player].dir;
|
||||||
|
}
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4464,7 +4473,7 @@ void entityclass::movingplatformfix( int t )
|
||||||
|
|
||||||
//If this intersects the player, then we move the player along it
|
//If this intersects the player, then we move the player along it
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
if (entitycollide(t, j))
|
if (j > -1 && entitycollide(t, j))
|
||||||
{
|
{
|
||||||
//ok, bollox, let's make sure
|
//ok, bollox, let's make sure
|
||||||
entities[j].yp = entities[j].yp + int(entities[j].vy);
|
entities[j].yp = entities[j].yp + int(entities[j].vy);
|
||||||
|
@ -4759,7 +4768,7 @@ void entityclass::entitycollisioncheck()
|
||||||
//can't have the player being stuck...
|
//can't have the player being stuck...
|
||||||
int j = getplayer();
|
int j = getplayer();
|
||||||
skipdirblocks = true;
|
skipdirblocks = true;
|
||||||
if (!testwallsx(j, entities[j].xp, entities[j].yp))
|
if (j > -1 && !testwallsx(j, entities[j].xp, entities[j].yp))
|
||||||
{
|
{
|
||||||
//Let's try to get out...
|
//Let's try to get out...
|
||||||
if (entities[j].rule == 0)
|
if (entities[j].rule == 0)
|
||||||
|
|
|
@ -504,14 +504,17 @@ void Game::lifesequence()
|
||||||
if (lifeseq > 0)
|
if (lifeseq > 0)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].invis = false;
|
obj.entities[i].invis = false;
|
||||||
if (lifeseq == 2) obj.entities[i].invis = true;
|
if (lifeseq == 2) obj.entities[i].invis = true;
|
||||||
if (lifeseq == 6) obj.entities[i].invis = true;
|
if (lifeseq == 6) obj.entities[i].invis = true;
|
||||||
if (lifeseq >= 8) obj.entities[i].invis = true;
|
if (lifeseq >= 8) obj.entities[i].invis = true;
|
||||||
|
}
|
||||||
if (lifeseq > 5) gravitycontrol = savegc;
|
if (lifeseq > 5) gravitycontrol = savegc;
|
||||||
|
|
||||||
lifeseq--;
|
lifeseq--;
|
||||||
if (lifeseq <= 0)
|
if (i > -1 && lifeseq <= 0)
|
||||||
{
|
{
|
||||||
obj.entities[i].invis = false;
|
obj.entities[i].invis = false;
|
||||||
}
|
}
|
||||||
|
@ -906,19 +909,28 @@ void Game::updatestate()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 15:
|
case 15:
|
||||||
|
{
|
||||||
//leaving the naughty corner
|
//leaving the naughty corner
|
||||||
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[obj.getplayer()].tile = 0;
|
obj.entities[obj.getplayer()].tile = 0;
|
||||||
|
}
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 16:
|
case 16:
|
||||||
//entering the naughty corner
|
|
||||||
if(obj.entities[obj.getplayer()].tile == 0)
|
|
||||||
{
|
{
|
||||||
obj.entities[obj.getplayer()].tile = 144;
|
//entering the naughty corner
|
||||||
|
int i = obj.getplayer();
|
||||||
|
if(i > -1 && obj.entities[i].tile == 0)
|
||||||
|
{
|
||||||
|
obj.entities[i].tile = 144;
|
||||||
music.playef(2);
|
music.playef(2);
|
||||||
}
|
}
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 17:
|
case 17:
|
||||||
//Arrow key tutorial
|
//Arrow key tutorial
|
||||||
|
@ -1504,12 +1516,12 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
hascontrol = false;
|
hascontrol = false;
|
||||||
if (obj.entities[i].onroof > 0 && gravitycontrol == 1)
|
if (i > -1 && obj.entities[i].onroof > 0 && gravitycontrol == 1)
|
||||||
{
|
{
|
||||||
gravitycontrol = 0;
|
gravitycontrol = 0;
|
||||||
music.playef(1);
|
music.playef(1);
|
||||||
}
|
}
|
||||||
if (obj.entities[i].onground > 0)
|
if (i > -1 && obj.entities[i].onground > 0)
|
||||||
{
|
{
|
||||||
state++;
|
state++;
|
||||||
}
|
}
|
||||||
|
@ -1622,12 +1634,12 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
hascontrol = false;
|
hascontrol = false;
|
||||||
if (obj.entities[i].onground > 0 && gravitycontrol == 0)
|
if (i > -1 && obj.entities[i].onground > 0 && gravitycontrol == 0)
|
||||||
{
|
{
|
||||||
gravitycontrol = 1;
|
gravitycontrol = 1;
|
||||||
music.playef(1);
|
music.playef(1);
|
||||||
}
|
}
|
||||||
if (obj.entities[i].onroof > 0)
|
if (i > -1 && obj.entities[i].onroof > 0)
|
||||||
{
|
{
|
||||||
state++;
|
state++;
|
||||||
}
|
}
|
||||||
|
@ -2163,6 +2175,8 @@ void Game::updatestate()
|
||||||
statedelay = 5;
|
statedelay = 5;
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
obj.entities[i].invis = false;
|
obj.entities[i].invis = false;
|
||||||
|
|
||||||
|
@ -2176,6 +2190,7 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
|
|
||||||
i = obj.getteleporter();
|
i = obj.getteleporter();
|
||||||
if (i > -1)
|
if (i > -1)
|
||||||
|
@ -2188,38 +2203,59 @@ void Game::updatestate()
|
||||||
case 2503:
|
case 2503:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2504:
|
case 2504:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
//obj.entities[i].xp += 10;
|
//obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2505:
|
case 2505:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 8;
|
obj.entities[i].xp += 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2506:
|
case 2506:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 6;
|
obj.entities[i].xp += 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2507:
|
case 2507:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
//obj.entities[i].xp += 4;
|
//obj.entities[i].xp += 4;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2508:
|
case 2508:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 2;
|
obj.entities[i].xp += 2;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2509:
|
case 2509:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 1;
|
obj.entities[i].xp += 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2510:
|
case 2510:
|
||||||
advancetext = true;
|
advancetext = true;
|
||||||
|
@ -2315,8 +2351,11 @@ void Game::updatestate()
|
||||||
}
|
}
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
obj.entities[i].invis = true;
|
obj.entities[i].invis = true;
|
||||||
|
}
|
||||||
|
|
||||||
i = obj.getcompanion();
|
i = obj.getcompanion();
|
||||||
if(i>-1)
|
if(i>-1)
|
||||||
|
@ -3309,7 +3348,10 @@ void Game::updatestate()
|
||||||
case 3511:
|
case 3511:
|
||||||
//Activating a teleporter (long version for level complete)
|
//Activating a teleporter (long version for level complete)
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 102;
|
obj.entities[i].colour = 102;
|
||||||
|
}
|
||||||
|
|
||||||
state++;
|
state++;
|
||||||
statedelay = 30;
|
statedelay = 30;
|
||||||
|
@ -3346,8 +3388,11 @@ void Game::updatestate()
|
||||||
screenshake = 0;
|
screenshake = 0;
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
obj.entities[i].invis = true;
|
obj.entities[i].invis = true;
|
||||||
|
}
|
||||||
|
|
||||||
//we're done here!
|
//we're done here!
|
||||||
music.playef(10);
|
music.playef(10);
|
||||||
|
@ -3433,8 +3478,11 @@ void Game::updatestate()
|
||||||
//state = 3040; //Lab
|
//state = 3040; //Lab
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
obj.entities[i].invis = true;
|
obj.entities[i].invis = true;
|
||||||
|
}
|
||||||
|
|
||||||
i = obj.getteleporter();
|
i = obj.getteleporter();
|
||||||
if(i>-1)
|
if(i>-1)
|
||||||
|
@ -3472,6 +3520,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -3487,37 +3537,56 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4013:
|
case 4013:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4014:
|
case 4014:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4015:
|
case 4015:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 8;
|
obj.entities[i].xp += 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4016:
|
case 4016:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 6;
|
obj.entities[i].xp += 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4017:
|
case 4017:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 3;
|
obj.entities[i].xp += 3;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4018:
|
case 4018:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 1;
|
obj.entities[i].xp += 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4019:
|
case 4019:
|
||||||
if (intimetrial || nodeathmode || inintermission)
|
if (intimetrial || nodeathmode || inintermission)
|
||||||
|
@ -3564,6 +3633,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -3579,37 +3650,56 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4023:
|
case 4023:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 12;
|
obj.entities[i].xp += 12;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4024:
|
case 4024:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 12;
|
obj.entities[i].xp += 12;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4025:
|
case 4025:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4026:
|
case 4026:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 8;
|
obj.entities[i].xp += 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4027:
|
case 4027:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 5;
|
obj.entities[i].xp += 5;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4028:
|
case 4028:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 2;
|
obj.entities[i].xp += 2;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4029:
|
case 4029:
|
||||||
hascontrol = true;
|
hascontrol = true;
|
||||||
|
@ -3640,6 +3730,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -3655,37 +3747,56 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = -6;
|
obj.entities[i].ax = -6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = -6;
|
obj.entities[i].vx = -6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4033:
|
case 4033:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 12;
|
obj.entities[i].xp -= 12;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4034:
|
case 4034:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 12;
|
obj.entities[i].xp -= 12;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4035:
|
case 4035:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 10;
|
obj.entities[i].xp -= 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4036:
|
case 4036:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 8;
|
obj.entities[i].xp -= 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4037:
|
case 4037:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 5;
|
obj.entities[i].xp -= 5;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4038:
|
case 4038:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 2;
|
obj.entities[i].xp -= 2;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4039:
|
case 4039:
|
||||||
hascontrol = true;
|
hascontrol = true;
|
||||||
|
@ -3716,6 +3827,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -3731,42 +3844,61 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4043:
|
case 4043:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 12;
|
obj.entities[i].xp += 12;
|
||||||
obj.entities[i].yp -= 15;
|
obj.entities[i].yp -= 15;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4044:
|
case 4044:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 12;
|
obj.entities[i].xp += 12;
|
||||||
obj.entities[i].yp -= 10;
|
obj.entities[i].yp -= 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4045:
|
case 4045:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 12;
|
obj.entities[i].xp += 12;
|
||||||
obj.entities[i].yp -= 10;
|
obj.entities[i].yp -= 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4046:
|
case 4046:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 8;
|
obj.entities[i].xp += 8;
|
||||||
obj.entities[i].yp -= 8;
|
obj.entities[i].yp -= 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4047:
|
case 4047:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 6;
|
obj.entities[i].xp += 6;
|
||||||
obj.entities[i].yp -= 8;
|
obj.entities[i].yp -= 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4048:
|
case 4048:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 3;
|
obj.entities[i].xp += 3;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4049:
|
case 4049:
|
||||||
hascontrol = true;
|
hascontrol = true;
|
||||||
|
@ -3797,6 +3929,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -3812,42 +3946,61 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4053:
|
case 4053:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 4;
|
obj.entities[i].xp += 4;
|
||||||
obj.entities[i].yp -= 15;
|
obj.entities[i].yp -= 15;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4054:
|
case 4054:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 4;
|
obj.entities[i].xp += 4;
|
||||||
obj.entities[i].yp -= 10;
|
obj.entities[i].yp -= 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4055:
|
case 4055:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 4;
|
obj.entities[i].xp += 4;
|
||||||
obj.entities[i].yp -= 10;
|
obj.entities[i].yp -= 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4056:
|
case 4056:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 4;
|
obj.entities[i].xp += 4;
|
||||||
obj.entities[i].yp -= 8;
|
obj.entities[i].yp -= 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4057:
|
case 4057:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 2;
|
obj.entities[i].xp += 2;
|
||||||
obj.entities[i].yp -= 8;
|
obj.entities[i].yp -= 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4058:
|
case 4058:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 1;
|
obj.entities[i].xp += 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4059:
|
case 4059:
|
||||||
hascontrol = true;
|
hascontrol = true;
|
||||||
|
@ -3878,6 +4031,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -3893,39 +4048,58 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = -6;
|
obj.entities[i].ax = -6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = -6;
|
obj.entities[i].vx = -6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4063:
|
case 4063:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 28;
|
obj.entities[i].xp -= 28;
|
||||||
obj.entities[i].yp -= 8;
|
obj.entities[i].yp -= 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4064:
|
case 4064:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 28;
|
obj.entities[i].xp -= 28;
|
||||||
obj.entities[i].yp -= 8;
|
obj.entities[i].yp -= 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4065:
|
case 4065:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 25;
|
obj.entities[i].xp -= 25;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4066:
|
case 4066:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 25;
|
obj.entities[i].xp -= 25;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4067:
|
case 4067:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 20;
|
obj.entities[i].xp -= 20;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4068:
|
case 4068:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp -= 16;
|
obj.entities[i].xp -= 16;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4069:
|
case 4069:
|
||||||
hascontrol = true;
|
hascontrol = true;
|
||||||
|
@ -3957,6 +4131,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -3972,37 +4148,56 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4073:
|
case 4073:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4074:
|
case 4074:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4075:
|
case 4075:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 8;
|
obj.entities[i].xp += 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4076:
|
case 4076:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 6;
|
obj.entities[i].xp += 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4077:
|
case 4077:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 3;
|
obj.entities[i].xp += 3;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4078:
|
case 4078:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 1;
|
obj.entities[i].xp += 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4079:
|
case 4079:
|
||||||
state = 0;
|
state = 0;
|
||||||
|
@ -4033,6 +4228,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -4048,37 +4245,56 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4083:
|
case 4083:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4084:
|
case 4084:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4085:
|
case 4085:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 8;
|
obj.entities[i].xp += 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4086:
|
case 4086:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 6;
|
obj.entities[i].xp += 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4087:
|
case 4087:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 3;
|
obj.entities[i].xp += 3;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4088:
|
case 4088:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 1;
|
obj.entities[i].xp += 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4089:
|
case 4089:
|
||||||
startscript = true;
|
startscript = true;
|
||||||
|
@ -4109,6 +4325,8 @@ void Game::updatestate()
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
j = obj.getteleporter();
|
j = obj.getteleporter();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (j != -1)
|
if (j != -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].xp = obj.entities[j].xp+44;
|
obj.entities[i].xp = obj.entities[j].xp+44;
|
||||||
|
@ -4124,37 +4342,56 @@ void Game::updatestate()
|
||||||
obj.entities[i].ax = 6;
|
obj.entities[i].ax = 6;
|
||||||
obj.entities[i].vy = -6;
|
obj.entities[i].vy = -6;
|
||||||
obj.entities[i].vx = 6;
|
obj.entities[i].vx = 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4093:
|
case 4093:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4094:
|
case 4094:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 10;
|
obj.entities[i].xp += 10;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4095:
|
case 4095:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 8;
|
obj.entities[i].xp += 8;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4096:
|
case 4096:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 6;
|
obj.entities[i].xp += 6;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4097:
|
case 4097:
|
||||||
state++;
|
state++;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 3;
|
obj.entities[i].xp += 3;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4098:
|
case 4098:
|
||||||
state++;
|
state++;
|
||||||
statedelay = 15;
|
statedelay = 15;
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp += 1;
|
obj.entities[i].xp += 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 4099:
|
case 4099:
|
||||||
if (nocutscenes)
|
if (nocutscenes)
|
||||||
|
@ -4820,9 +5057,12 @@ void Game::deathsequence()
|
||||||
{
|
{
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
}
|
}
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 1;
|
obj.entities[i].colour = 1;
|
||||||
|
|
||||||
obj.entities[i].invis = false;
|
obj.entities[i].invis = false;
|
||||||
|
}
|
||||||
if (deathseq == 30)
|
if (deathseq == 30)
|
||||||
{
|
{
|
||||||
if (nodeathmode)
|
if (nodeathmode)
|
||||||
|
@ -4832,7 +5072,10 @@ void Game::deathsequence()
|
||||||
}
|
}
|
||||||
deathcounts++;
|
deathcounts++;
|
||||||
music.playef(2);
|
music.playef(2);
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].invis = true;
|
obj.entities[i].invis = true;
|
||||||
|
}
|
||||||
if (map.finalmode)
|
if (map.finalmode)
|
||||||
{
|
{
|
||||||
if (roomx - 41 >= 0 && roomx - 41 < 20 && roomy - 48 >= 0 && roomy - 48 < 20)
|
if (roomx - 41 >= 0 && roomx - 41 < 20 && roomy - 48 >= 0 && roomy - 48 < 20)
|
||||||
|
@ -4850,15 +5093,18 @@ void Game::deathsequence()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (deathseq == 25) obj.entities[i].invis = true;
|
if (deathseq == 25) obj.entities[i].invis = true;
|
||||||
if (deathseq == 20) obj.entities[i].invis = true;
|
if (deathseq == 20) obj.entities[i].invis = true;
|
||||||
if (deathseq == 16) obj.entities[i].invis = true;
|
if (deathseq == 16) obj.entities[i].invis = true;
|
||||||
if (deathseq == 14) obj.entities[i].invis = true;
|
if (deathseq == 14) obj.entities[i].invis = true;
|
||||||
if (deathseq == 12) obj.entities[i].invis = true;
|
if (deathseq == 12) obj.entities[i].invis = true;
|
||||||
if (deathseq < 10) obj.entities[i].invis = true;
|
if (deathseq < 10) obj.entities[i].invis = true;
|
||||||
|
}
|
||||||
if (!nodeathmode)
|
if (!nodeathmode)
|
||||||
{
|
{
|
||||||
if (deathseq <= 1) obj.entities[i].invis = false;
|
if (i > -1 && deathseq <= 1) obj.entities[i].invis = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1605,7 +1605,10 @@ void gameinput()
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
obj.entities[player].colour = 102;
|
obj.entities[player].colour = 102;
|
||||||
|
}
|
||||||
|
|
||||||
int teleporter = obj.getteleporter();
|
int teleporter = obj.getteleporter();
|
||||||
if (teleporter > -1)
|
if (teleporter > -1)
|
||||||
|
@ -1639,7 +1642,10 @@ void gameinput()
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
obj.entities[player].colour = 102;
|
obj.entities[player].colour = 102;
|
||||||
|
}
|
||||||
int companion = obj.getcompanion();
|
int companion = obj.getcompanion();
|
||||||
if(companion>-1) obj.entities[companion].colour = 102;
|
if(companion>-1) obj.entities[companion].colour = 102;
|
||||||
|
|
||||||
|
@ -1948,7 +1954,10 @@ void mapinput()
|
||||||
game.hascontrol = false;
|
game.hascontrol = false;
|
||||||
|
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 102;
|
obj.entities[i].colour = 102;
|
||||||
|
}
|
||||||
|
|
||||||
//which teleporter script do we use? it depends on the companion!
|
//which teleporter script do we use? it depends on the companion!
|
||||||
game.state = 4000;
|
game.state = 4000;
|
||||||
|
@ -2116,7 +2125,10 @@ void teleporterinput()
|
||||||
game.hascontrol = false;
|
game.hascontrol = false;
|
||||||
|
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 102;
|
obj.entities[i].colour = 102;
|
||||||
|
}
|
||||||
|
|
||||||
i = obj.getteleporter();
|
i = obj.getteleporter();
|
||||||
if (i > -1)
|
if (i > -1)
|
||||||
|
|
|
@ -142,7 +142,10 @@ void gamelogic()
|
||||||
obj.upsetmode = true;
|
obj.upsetmode = true;
|
||||||
//change player to sad
|
//change player to sad
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].tile = 144;
|
obj.entities[i].tile = 144;
|
||||||
|
}
|
||||||
music.playef(2);
|
music.playef(2);
|
||||||
}
|
}
|
||||||
if (obj.upset > 301) obj.upset = 301;
|
if (obj.upset > 301) obj.upset = 301;
|
||||||
|
@ -156,9 +159,12 @@ void gamelogic()
|
||||||
obj.upsetmode = false;
|
obj.upsetmode = false;
|
||||||
//change player to happy
|
//change player to happy
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].tile = 0;
|
obj.entities[i].tile = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
obj.upset = 0;
|
obj.upset = 0;
|
||||||
|
@ -199,7 +205,10 @@ void gamelogic()
|
||||||
else if (map.cameramode == 4)
|
else if (map.cameramode == 4)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
map.cameraseek = map.ypos - (obj.entities[i].yp - 120);
|
map.cameraseek = map.ypos - (obj.entities[i].yp - 120);
|
||||||
|
}
|
||||||
|
|
||||||
map.cameraseek = map.cameraseek / 10;
|
map.cameraseek = map.cameraseek / 10;
|
||||||
map.cameraseekframe = 10;
|
map.cameraseekframe = 10;
|
||||||
|
@ -217,14 +226,14 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
map.ypos -= map.cameraseek;
|
map.ypos -= map.cameraseek;
|
||||||
if (map.cameraseek > 0)
|
if (map.cameraseek > 0 && i > -1)
|
||||||
{
|
{
|
||||||
if (map.ypos < obj.entities[i].yp - 120)
|
if (map.ypos < obj.entities[i].yp - 120)
|
||||||
{
|
{
|
||||||
map.ypos = obj.entities[i].yp - 120;
|
map.ypos = obj.entities[i].yp - 120;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (i > -1)
|
||||||
{
|
{
|
||||||
if (map.ypos > obj.entities[i].yp - 120)
|
if (map.ypos > obj.entities[i].yp - 120)
|
||||||
{
|
{
|
||||||
|
@ -237,7 +246,10 @@ void gamelogic()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
map.ypos = obj.entities[i].yp - 120;
|
map.ypos = obj.entities[i].yp - 120;
|
||||||
|
}
|
||||||
map.bypos = map.ypos / 2;
|
map.bypos = map.ypos / 2;
|
||||||
map.cameramode = 0;
|
map.cameramode = 0;
|
||||||
map.colsuperstate = 0;
|
map.colsuperstate = 0;
|
||||||
|
@ -481,7 +493,7 @@ void gamelogic()
|
||||||
if (game.roomx == 41 + game.scmprogress) //he's in the same room
|
if (game.roomx == 41 + game.scmprogress) //he's in the same room
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
if (obj.entities[i].ax > 0 && obj.entities[i].xp > 280)
|
if (i > -1 && obj.entities[i].ax > 0 && obj.entities[i].xp > 280)
|
||||||
{
|
{
|
||||||
obj.entities[i].ax = 0;
|
obj.entities[i].ax = 0;
|
||||||
obj.entities[i].dir = 0;
|
obj.entities[i].dir = 0;
|
||||||
|
@ -759,7 +771,7 @@ void gamelogic()
|
||||||
//is the player standing on a moving platform?
|
//is the player standing on a moving platform?
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
float j = obj.entitycollideplatformfloor(i);
|
float j = obj.entitycollideplatformfloor(i);
|
||||||
if (j > -1000)
|
if (i > -1 && j > -1000)
|
||||||
{
|
{
|
||||||
obj.entities[i].newxp = obj.entities[i].xp + j;
|
obj.entities[i].newxp = obj.entities[i].xp + j;
|
||||||
obj.entitymapcollision(i);
|
obj.entitymapcollision(i);
|
||||||
|
@ -767,7 +779,7 @@ void gamelogic()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
j = obj.entitycollideplatformroof(i);
|
j = obj.entitycollideplatformroof(i);
|
||||||
if (j > -1000)
|
if (i > -1 && j > -1000)
|
||||||
{
|
{
|
||||||
obj.entities[i].newxp = obj.entities[i].xp + j;
|
obj.entities[i].newxp = obj.entities[i].xp + j;
|
||||||
obj.entitymapcollision(i);
|
obj.entitymapcollision(i);
|
||||||
|
@ -792,7 +804,7 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
//special for tower: is the player touching any spike blocks?
|
//special for tower: is the player touching any spike blocks?
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
if(obj.checktowerspikes(player) && graphics.fademode==0)
|
if(player > -1 && obj.checktowerspikes(player) && graphics.fademode==0)
|
||||||
{
|
{
|
||||||
game.deathseq = 30;
|
game.deathseq = 30;
|
||||||
}
|
}
|
||||||
|
@ -801,7 +813,7 @@ void gamelogic()
|
||||||
if(map.towermode && game.lifeseq==0)
|
if(map.towermode && game.lifeseq==0)
|
||||||
{
|
{
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
if(!map.invincibility)
|
if(!map.invincibility && player > -1)
|
||||||
{
|
{
|
||||||
if (obj.entities[player].yp-map.ypos <= 0)
|
if (obj.entities[player].yp-map.ypos <= 0)
|
||||||
{
|
{
|
||||||
|
@ -812,7 +824,7 @@ void gamelogic()
|
||||||
game.deathseq = 30;
|
game.deathseq = 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (player > -1)
|
||||||
{
|
{
|
||||||
if (obj.entities[player].yp-map.ypos <= 0)
|
if (obj.entities[player].yp-map.ypos <= 0)
|
||||||
{
|
{
|
||||||
|
@ -828,7 +840,7 @@ void gamelogic()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.entities[player].yp - map.ypos <= 40)
|
if (player > -1 && obj.entities[player].yp - map.ypos <= 40)
|
||||||
{
|
{
|
||||||
map.spikeleveltop++;
|
map.spikeleveltop++;
|
||||||
if (map.spikeleveltop >= 8) map.spikeleveltop = 8;
|
if (map.spikeleveltop >= 8) map.spikeleveltop = 8;
|
||||||
|
@ -838,7 +850,7 @@ void gamelogic()
|
||||||
if (map.spikeleveltop > 0) map.spikeleveltop--;
|
if (map.spikeleveltop > 0) map.spikeleveltop--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.entities[player].yp - map.ypos >= 164)
|
if (player > -1 && obj.entities[player].yp - map.ypos >= 164)
|
||||||
{
|
{
|
||||||
map.spikelevelbottom++;
|
map.spikelevelbottom++;
|
||||||
if (map.spikelevelbottom >= 8) map.spikelevelbottom = 8;
|
if (map.spikelevelbottom >= 8) map.spikelevelbottom = 8;
|
||||||
|
@ -860,7 +872,7 @@ void gamelogic()
|
||||||
obj.customwarpmodevon = false;
|
obj.customwarpmodevon = false;
|
||||||
|
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
if ((game.door_down > -2 && obj.entities[i].yp >= 226-16) || (game.door_up > -2 && obj.entities[i].yp < -2+16) || (game.door_left > -2 && obj.entities[i].xp < -14+16) || (game.door_right > -2 && obj.entities[i].xp >= 308-16)){
|
if (i > -1 && ((game.door_down > -2 && obj.entities[i].yp >= 226-16) || (game.door_up > -2 && obj.entities[i].yp < -2+16) || (game.door_left > -2 && obj.entities[i].xp < -14+16) || (game.door_right > -2 && obj.entities[i].xp >= 308-16))){
|
||||||
//Player is leaving room
|
//Player is leaving room
|
||||||
obj.customwarplinecheck(i);
|
obj.customwarplinecheck(i);
|
||||||
}
|
}
|
||||||
|
@ -955,12 +967,12 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
//Normal! Just change room
|
//Normal! Just change room
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
if (game.door_down > -2 && obj.entities[player].yp >= 238)
|
if (player > -1 && game.door_down > -2 && obj.entities[player].yp >= 238)
|
||||||
{
|
{
|
||||||
obj.entities[player].yp -= 240;
|
obj.entities[player].yp -= 240;
|
||||||
map.gotoroom(game.roomx, game.roomy + 1);
|
map.gotoroom(game.roomx, game.roomy + 1);
|
||||||
}
|
}
|
||||||
if (game.door_up > -2 && obj.entities[player].yp < -2)
|
if (player > -1 && game.door_up > -2 && obj.entities[player].yp < -2)
|
||||||
{
|
{
|
||||||
obj.entities[player].yp += 240;
|
obj.entities[player].yp += 240;
|
||||||
map.gotoroom(game.roomx, game.roomy - 1);
|
map.gotoroom(game.roomx, game.roomy - 1);
|
||||||
|
@ -971,12 +983,12 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
//Normal! Just change room
|
//Normal! Just change room
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
if (game.door_left > -2 && obj.entities[player].xp < -14)
|
if (player > -1 && game.door_left > -2 && obj.entities[player].xp < -14)
|
||||||
{
|
{
|
||||||
obj.entities[player].xp += 320;
|
obj.entities[player].xp += 320;
|
||||||
map.gotoroom(game.roomx - 1, game.roomy);
|
map.gotoroom(game.roomx - 1, game.roomy);
|
||||||
}
|
}
|
||||||
if (game.door_right > -2 && obj.entities[player].xp >= 308)
|
if (player > -1 && game.door_right > -2 && obj.entities[player].xp >= 308)
|
||||||
{
|
{
|
||||||
obj.entities[player].xp -= 320;
|
obj.entities[player].xp -= 320;
|
||||||
map.gotoroom(game.roomx + 1, game.roomy);
|
map.gotoroom(game.roomx + 1, game.roomy);
|
||||||
|
@ -990,12 +1002,12 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
//This is minitower 1!
|
//This is minitower 1!
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
if (game.door_left > -2 && obj.entities[player].xp < -14)
|
if (player > -1 && game.door_left > -2 && obj.entities[player].xp < -14)
|
||||||
{
|
{
|
||||||
obj.entities[player].xp += 320;
|
obj.entities[player].xp += 320;
|
||||||
map.gotoroom(48, 52);
|
map.gotoroom(48, 52);
|
||||||
}
|
}
|
||||||
if (game.door_right > -2 && obj.entities[player].xp >= 308)
|
if (player > -1 && game.door_right > -2 && obj.entities[player].xp >= 308)
|
||||||
{
|
{
|
||||||
obj.entities[player].xp -= 320;
|
obj.entities[player].xp -= 320;
|
||||||
obj.entities[player].yp -= (71*8);
|
obj.entities[player].yp -= (71*8);
|
||||||
|
@ -1006,7 +1018,7 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
//This is minitower 2!
|
//This is minitower 2!
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
if (game.door_left > -2 && obj.entities[player].xp < -14)
|
if (player > -1 && game.door_left > -2 && obj.entities[player].xp < -14)
|
||||||
{
|
{
|
||||||
if (obj.entities[player].yp > 300)
|
if (obj.entities[player].yp > 300)
|
||||||
{
|
{
|
||||||
|
@ -1020,7 +1032,7 @@ void gamelogic()
|
||||||
map.gotoroom(50, 53);
|
map.gotoroom(50, 53);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (game.door_right > -2 && obj.entities[player].xp >= 308)
|
if (player > -1 && game.door_right > -2 && obj.entities[player].xp >= 308)
|
||||||
{
|
{
|
||||||
obj.entities[player].xp -= 320;
|
obj.entities[player].xp -= 320;
|
||||||
map.gotoroom(52, 53);
|
map.gotoroom(52, 53);
|
||||||
|
@ -1051,13 +1063,13 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
//Do not wrap! Instead, go to the correct room
|
//Do not wrap! Instead, go to the correct room
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
if (game.door_left > -2 && obj.entities[player].xp < -14)
|
if (player > -1 && game.door_left > -2 && obj.entities[player].xp < -14)
|
||||||
{
|
{
|
||||||
obj.entities[player].xp += 320;
|
obj.entities[player].xp += 320;
|
||||||
obj.entities[player].yp -= (671 * 8);
|
obj.entities[player].yp -= (671 * 8);
|
||||||
map.gotoroom(108, 109);
|
map.gotoroom(108, 109);
|
||||||
}
|
}
|
||||||
if (game.door_right > -2 && obj.entities[player].xp >= 308)
|
if (player > -1 && game.door_right > -2 && obj.entities[player].xp >= 308)
|
||||||
{
|
{
|
||||||
obj.entities[player].xp -= 320;
|
obj.entities[player].xp -= 320;
|
||||||
map.gotoroom(110, 104);
|
map.gotoroom(110, 104);
|
||||||
|
@ -1090,42 +1102,60 @@ void gamelogic()
|
||||||
if (game.roomx == 117 && game.roomy == 102)
|
if (game.roomx == 117 && game.roomy == 102)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].yp = 225;
|
obj.entities[i].yp = 225;
|
||||||
|
}
|
||||||
map.gotoroom(119, 100);
|
map.gotoroom(119, 100);
|
||||||
game.teleport = false;
|
game.teleport = false;
|
||||||
}
|
}
|
||||||
else if (game.roomx == 119 && game.roomy == 100)
|
else if (game.roomx == 119 && game.roomy == 100)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].yp = 225;
|
obj.entities[i].yp = 225;
|
||||||
|
}
|
||||||
map.gotoroom(119, 103);
|
map.gotoroom(119, 103);
|
||||||
game.teleport = false;
|
game.teleport = false;
|
||||||
}
|
}
|
||||||
else if (game.roomx == 119 && game.roomy == 103)
|
else if (game.roomx == 119 && game.roomy == 103)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp = 0;
|
obj.entities[i].xp = 0;
|
||||||
|
}
|
||||||
map.gotoroom(116, 103);
|
map.gotoroom(116, 103);
|
||||||
game.teleport = false;
|
game.teleport = false;
|
||||||
}
|
}
|
||||||
else if (game.roomx == 116 && game.roomy == 103)
|
else if (game.roomx == 116 && game.roomy == 103)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].yp = 225;
|
obj.entities[i].yp = 225;
|
||||||
|
}
|
||||||
map.gotoroom(116, 100);
|
map.gotoroom(116, 100);
|
||||||
game.teleport = false;
|
game.teleport = false;
|
||||||
}
|
}
|
||||||
else if (game.roomx == 116 && game.roomy == 100)
|
else if (game.roomx == 116 && game.roomy == 100)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp = 0;
|
obj.entities[i].xp = 0;
|
||||||
|
}
|
||||||
map.gotoroom(114, 102);
|
map.gotoroom(114, 102);
|
||||||
game.teleport = false;
|
game.teleport = false;
|
||||||
}
|
}
|
||||||
else if (game.roomx == 114 && game.roomy == 102)
|
else if (game.roomx == 114 && game.roomy == 102)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].yp = 225;
|
obj.entities[i].yp = 225;
|
||||||
|
}
|
||||||
map.gotoroom(113, 100);
|
map.gotoroom(113, 100);
|
||||||
game.teleport = false;
|
game.teleport = false;
|
||||||
}
|
}
|
||||||
|
@ -1187,9 +1217,9 @@ void gamelogic()
|
||||||
{
|
{
|
||||||
//We've changed room? Let's bring our companion along!
|
//We've changed room? Let's bring our companion along!
|
||||||
game.roomchange = false;
|
game.roomchange = false;
|
||||||
if (game.companion > 0)
|
|
||||||
{
|
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (game.companion > 0 && i > -1)
|
||||||
|
{
|
||||||
//ok, we'll presume our companion has been destroyed in the room change. So:
|
//ok, we'll presume our companion has been destroyed in the room change. So:
|
||||||
switch(game.companion)
|
switch(game.companion)
|
||||||
{
|
{
|
||||||
|
@ -1355,7 +1385,10 @@ void gamelogic()
|
||||||
if (game.activetele)
|
if (game.activetele)
|
||||||
{
|
{
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.settemprect(i);
|
obj.settemprect(i);
|
||||||
|
}
|
||||||
if (help.intersects(game.teleblock, obj.temprect))
|
if (help.intersects(game.teleblock, obj.temprect))
|
||||||
{
|
{
|
||||||
game.readytotele += 25;
|
game.readytotele += 25;
|
||||||
|
|
|
@ -825,8 +825,11 @@ void mapclass::warpto(int rx, int ry , int t, int tx, int ty)
|
||||||
{
|
{
|
||||||
gotoroom(rx, ry);
|
gotoroom(rx, ry);
|
||||||
game.teleport = false;
|
game.teleport = false;
|
||||||
|
if (t >= 0 && t < (int) obj.entities.size())
|
||||||
|
{
|
||||||
obj.entities[t].xp = tx * 8;
|
obj.entities[t].xp = tx * 8;
|
||||||
obj.entities[t].yp = (ty * 8) - obj.entities[t].h;
|
obj.entities[t].yp = (ty * 8) - obj.entities[t].h;
|
||||||
|
}
|
||||||
game.gravitycontrol = 0;
|
game.gravitycontrol = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,7 +1194,10 @@ void mapclass::loadlevel(int rx, int ry)
|
||||||
{
|
{
|
||||||
//entered from ground floor
|
//entered from ground floor
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
obj.entities[player].yp += (671 * 8);
|
obj.entities[player].yp += (671 * 8);
|
||||||
|
}
|
||||||
|
|
||||||
ypos = (700-29) * 8;
|
ypos = (700-29) * 8;
|
||||||
bypos = ypos / 2;
|
bypos = ypos / 2;
|
||||||
|
@ -1392,7 +1398,10 @@ void mapclass::loadlevel(int rx, int ry)
|
||||||
tower.loadminitower1();
|
tower.loadminitower1();
|
||||||
|
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].yp += (71 * 8);
|
obj.entities[i].yp += (71 * 8);
|
||||||
|
}
|
||||||
game.roomy--;
|
game.roomy--;
|
||||||
finaly--;
|
finaly--;
|
||||||
|
|
||||||
|
@ -1433,7 +1442,10 @@ void mapclass::loadlevel(int rx, int ry)
|
||||||
obj.createentity(72, 156, 11, 200); // (horizontal gravity line)
|
obj.createentity(72, 156, 11, 200); // (horizontal gravity line)
|
||||||
|
|
||||||
int i = obj.getplayer();
|
int i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].yp += (71 * 8);
|
obj.entities[i].yp += (71 * 8);
|
||||||
|
}
|
||||||
game.roomy--;
|
game.roomy--;
|
||||||
finaly--;
|
finaly--;
|
||||||
|
|
||||||
|
@ -1907,11 +1919,11 @@ void mapclass::loadlevel(int rx, int ry)
|
||||||
{
|
{
|
||||||
//face the player
|
//face the player
|
||||||
j = obj.getplayer();
|
j = obj.getplayer();
|
||||||
if (obj.entities[j].xp > obj.entities[i].xp + 5)
|
if (j > -1 && obj.entities[j].xp > obj.entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
obj.entities[i].dir = 1;
|
obj.entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (obj.entities[j].xp < obj.entities[i].xp - 5)
|
else if (j > -1 && obj.entities[j].xp < obj.entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
obj.entities[i].dir = 0;
|
obj.entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1394,10 +1394,13 @@ void gamerender()
|
||||||
GhostInfo ghost;
|
GhostInfo ghost;
|
||||||
ghost.rx = game.roomx-100;
|
ghost.rx = game.roomx-100;
|
||||||
ghost.ry = game.roomy-100;
|
ghost.ry = game.roomy-100;
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
ghost.x = obj.entities[i].xp;
|
ghost.x = obj.entities[i].xp;
|
||||||
ghost.y = obj.entities[i].yp;
|
ghost.y = obj.entities[i].yp;
|
||||||
ghost.col = obj.entities[i].colour;
|
ghost.col = obj.entities[i].colour;
|
||||||
ghost.frame = obj.entities[i].drawframe;
|
ghost.frame = obj.entities[i].drawframe;
|
||||||
|
}
|
||||||
ed.ghosts.push_back(ghost);
|
ed.ghosts.push_back(ghost);
|
||||||
}
|
}
|
||||||
if (ed.ghosts.size() > 100)
|
if (ed.ghosts.size() > 100)
|
||||||
|
|
|
@ -84,8 +84,11 @@ void scriptclass::run()
|
||||||
{
|
{
|
||||||
//USAGE: moveplayer(x offset, y offset)
|
//USAGE: moveplayer(x offset, y offset)
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
obj.entities[player].xp += ss_toi(words[1]);
|
obj.entities[player].xp += ss_toi(words[1]);
|
||||||
obj.entities[player].yp += ss_toi(words[2]);
|
obj.entities[player].yp += ss_toi(words[2]);
|
||||||
|
}
|
||||||
scriptdelay = 1;
|
scriptdelay = 1;
|
||||||
}
|
}
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
|
@ -230,7 +233,8 @@ void scriptclass::run()
|
||||||
}
|
}
|
||||||
if (words[0] == "tofloor")
|
if (words[0] == "tofloor")
|
||||||
{
|
{
|
||||||
if(obj.entities[obj.getplayer()].onroof>0)
|
int player = obj.getplayer();
|
||||||
|
if(player > -1 && obj.entities[player].onroof>0)
|
||||||
{
|
{
|
||||||
game.press_action = true;
|
game.press_action = true;
|
||||||
scriptdelay = 1;
|
scriptdelay = 1;
|
||||||
|
@ -270,8 +274,11 @@ void scriptclass::run()
|
||||||
{
|
{
|
||||||
//USAGE: gotoposition(x position, y position, gravity position)
|
//USAGE: gotoposition(x position, y position, gravity position)
|
||||||
int player = obj.getplayer();
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
obj.entities[player].xp = ss_toi(words[1]);
|
obj.entities[player].xp = ss_toi(words[1]);
|
||||||
obj.entities[player].yp = ss_toi(words[2]);
|
obj.entities[player].yp = ss_toi(words[2]);
|
||||||
|
}
|
||||||
game.gravitycontrol = ss_toi(words[3]);
|
game.gravitycontrol = ss_toi(words[3]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -391,8 +398,11 @@ void scriptclass::run()
|
||||||
if (words[1] == "player")
|
if (words[1] == "player")
|
||||||
{
|
{
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
j = obj.entities[i].dir;
|
j = obj.entities[i].dir;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[1] == "cyan")
|
else if (words[1] == "cyan")
|
||||||
{
|
{
|
||||||
i = obj.getcrewman(0);
|
i = obj.getcrewman(0);
|
||||||
|
@ -444,7 +454,7 @@ void scriptclass::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
//next is whether to position above or below
|
//next is whether to position above or below
|
||||||
if (words[2] == "above")
|
if (i > -1 && words[2] == "above")
|
||||||
{
|
{
|
||||||
if (j == 1) //left
|
if (j == 1) //left
|
||||||
{
|
{
|
||||||
|
@ -457,7 +467,7 @@ void scriptclass::run()
|
||||||
texty = obj.entities[i].yp - 18 - (txt.size() * 8);
|
texty = obj.entities[i].yp - 18 - (txt.size() * 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (i > -1)
|
||||||
{
|
{
|
||||||
if (j == 1) //left
|
if (j == 1) //left
|
||||||
{
|
{
|
||||||
|
@ -660,6 +670,8 @@ void scriptclass::run()
|
||||||
{
|
{
|
||||||
//Create the super VVVVVV combo!
|
//Create the super VVVVVV combo!
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp = 30;
|
obj.entities[i].xp = 30;
|
||||||
obj.entities[i].yp = 46;
|
obj.entities[i].yp = 46;
|
||||||
obj.entities[i].size = 13;
|
obj.entities[i].size = 13;
|
||||||
|
@ -668,10 +680,13 @@ void scriptclass::run()
|
||||||
obj.entities[i].cy = 12+80;// 2;
|
obj.entities[i].cy = 12+80;// 2;
|
||||||
obj.entities[i].h = 126-80;// 21;
|
obj.entities[i].h = 126-80;// 21;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "undovvvvvvman")
|
else if (words[0] == "undovvvvvvman")
|
||||||
{
|
{
|
||||||
//Create the super VVVVVV combo!
|
//Create the super VVVVVV combo!
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp = 100;
|
obj.entities[i].xp = 100;
|
||||||
obj.entities[i].size = 0;
|
obj.entities[i].size = 0;
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
|
@ -679,6 +694,7 @@ void scriptclass::run()
|
||||||
obj.entities[i].cy = 2;
|
obj.entities[i].cy = 2;
|
||||||
obj.entities[i].h = 21;
|
obj.entities[i].h = 21;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "createentity")
|
else if (words[0] == "createentity")
|
||||||
{
|
{
|
||||||
obj.createentity(ss_toi(words[1]), ss_toi(words[2]), ss_toi(words[3]), ss_toi(words[4]), ss_toi(words[5]));
|
obj.createentity(ss_toi(words[1]), ss_toi(words[2]), ss_toi(words[3]), ss_toi(words[4]), ss_toi(words[5]));
|
||||||
|
@ -796,11 +812,11 @@ void scriptclass::run()
|
||||||
i=obj.getcrewman(1);
|
i=obj.getcrewman(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ss_toi(words[2]) == 0)
|
if (i > -1 && ss_toi(words[2]) == 0)
|
||||||
{
|
{
|
||||||
obj.entities[i].tile = 0;
|
obj.entities[i].tile = 0;
|
||||||
}
|
}
|
||||||
else
|
else if (i > -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].tile = 144;
|
obj.entities[i].tile = 144;
|
||||||
}
|
}
|
||||||
|
@ -893,8 +909,11 @@ void scriptclass::run()
|
||||||
i=obj.getcrewman(1);
|
i=obj.getcrewman(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].tile = ss_toi(words[2]);
|
obj.entities[i].tile = ss_toi(words[2]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "flipgravity")
|
else if (words[0] == "flipgravity")
|
||||||
{
|
{
|
||||||
//not something I'll use a lot, I think. Doesn't need to be very robust!
|
//not something I'll use a lot, I think. Doesn't need to be very robust!
|
||||||
|
@ -973,8 +992,11 @@ void scriptclass::run()
|
||||||
i=obj.getcrewman(1);
|
i=obj.getcrewman(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].tile +=12;
|
obj.entities[i].tile +=12;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "changedir")
|
else if (words[0] == "changedir")
|
||||||
{
|
{
|
||||||
if (words[1] == "player")
|
if (words[1] == "player")
|
||||||
|
@ -1006,11 +1028,11 @@ void scriptclass::run()
|
||||||
i=obj.getcrewman(1);
|
i=obj.getcrewman(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ss_toi(words[2]) == 0)
|
if (i > -1 && ss_toi(words[2]) == 0)
|
||||||
{
|
{
|
||||||
obj.entities[i].dir = 0;
|
obj.entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
else
|
else if (i > -1)
|
||||||
{
|
{
|
||||||
obj.entities[i].dir = 1;
|
obj.entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
|
@ -1075,6 +1097,8 @@ void scriptclass::run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].state = ss_toi(words[2]);
|
obj.entities[i].state = ss_toi(words[2]);
|
||||||
if (obj.entities[i].state == 16)
|
if (obj.entities[i].state == 16)
|
||||||
{
|
{
|
||||||
|
@ -1085,6 +1109,7 @@ void scriptclass::run()
|
||||||
obj.entities[i].dir=ss_toi(words[3]);
|
obj.entities[i].dir=ss_toi(words[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "alarmon")
|
else if (words[0] == "alarmon")
|
||||||
{
|
{
|
||||||
game.alarmon = true;
|
game.alarmon = true;
|
||||||
|
@ -1134,6 +1159,8 @@ void scriptclass::run()
|
||||||
i=obj.getcrewman(1);
|
i=obj.getcrewman(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (words[2] == "cyan")
|
if (words[2] == "cyan")
|
||||||
{
|
{
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
|
@ -1163,6 +1190,7 @@ void scriptclass::run()
|
||||||
obj.entities[i].colour = 102;
|
obj.entities[i].colour = 102;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "squeak")
|
else if (words[0] == "squeak")
|
||||||
{
|
{
|
||||||
if (words[1] == "player")
|
if (words[1] == "player")
|
||||||
|
@ -1214,13 +1242,19 @@ void scriptclass::run()
|
||||||
{
|
{
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
game.savepoint = 0;
|
game.savepoint = 0;
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
game.savex = obj.entities[i].xp ;
|
game.savex = obj.entities[i].xp ;
|
||||||
game.savey = obj.entities[i].yp;
|
game.savey = obj.entities[i].yp;
|
||||||
|
}
|
||||||
game.savegc = game.gravitycontrol;
|
game.savegc = game.gravitycontrol;
|
||||||
game.saverx = game.roomx;
|
game.saverx = game.roomx;
|
||||||
game.savery = game.roomy;
|
game.savery = game.roomy;
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
game.savedir = obj.entities[i].dir;
|
game.savedir = obj.entities[i].dir;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "gamestate")
|
else if (words[0] == "gamestate")
|
||||||
{
|
{
|
||||||
game.state = ss_toi(words[1]);
|
game.state = ss_toi(words[1]);
|
||||||
|
@ -1368,11 +1402,19 @@ void scriptclass::run()
|
||||||
}
|
}
|
||||||
else if (words[0] == "hideplayer")
|
else if (words[0] == "hideplayer")
|
||||||
{
|
{
|
||||||
obj.entities[obj.getplayer()].invis = true;
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
|
obj.entities[player].invis = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (words[0] == "showplayer")
|
else if (words[0] == "showplayer")
|
||||||
{
|
{
|
||||||
obj.entities[obj.getplayer()].invis = false;
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
|
obj.entities[player].invis = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (words[0] == "teleportscript")
|
else if (words[0] == "teleportscript")
|
||||||
{
|
{
|
||||||
|
@ -1433,7 +1475,10 @@ void scriptclass::run()
|
||||||
|
|
||||||
obj.resetallflags();
|
obj.resetallflags();
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].tile = 0;
|
obj.entities[i].tile = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 100; i++)
|
for (i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
|
@ -1606,11 +1651,11 @@ void scriptclass::run()
|
||||||
j=obj.getcrewman(1);
|
j=obj.getcrewman(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.entities[j].xp > obj.entities[i].xp + 5)
|
if (i > -1 && j > -1 && obj.entities[j].xp > obj.entities[i].xp + 5)
|
||||||
{
|
{
|
||||||
obj.entities[i].dir = 1;
|
obj.entities[i].dir = 1;
|
||||||
}
|
}
|
||||||
else if (obj.entities[j].xp < obj.entities[i].xp - 5)
|
else if (i > -1 && j > -1 && obj.entities[j].xp < obj.entities[i].xp - 5)
|
||||||
{
|
{
|
||||||
obj.entities[i].dir = 0;
|
obj.entities[i].dir = 0;
|
||||||
}
|
}
|
||||||
|
@ -1796,12 +1841,17 @@ void scriptclass::run()
|
||||||
else if (words[0] == "restoreplayercolour")
|
else if (words[0] == "restoreplayercolour")
|
||||||
{
|
{
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "changeplayercolour")
|
else if (words[0] == "changeplayercolour")
|
||||||
{
|
{
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
if (words[1] == "cyan")
|
if (words[1] == "cyan")
|
||||||
{
|
{
|
||||||
obj.entities[i].colour = 0;
|
obj.entities[i].colour = 0;
|
||||||
|
@ -1831,6 +1881,7 @@ void scriptclass::run()
|
||||||
obj.entities[i].colour = 102;
|
obj.entities[i].colour = 102;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (words[0] == "altstates")
|
else if (words[0] == "altstates")
|
||||||
{
|
{
|
||||||
obj.altstates = ss_toi(words[1]);
|
obj.altstates = ss_toi(words[1]);
|
||||||
|
@ -2585,7 +2636,10 @@ void scriptclass::startgamemode( int t )
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
|
|
||||||
i = obj.getplayer();
|
i = obj.getplayer();
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
map.ypos = obj.entities[i].yp - 120;
|
map.ypos = obj.entities[i].yp - 120;
|
||||||
|
}
|
||||||
map.bypos = map.ypos / 2;
|
map.bypos = map.ypos / 2;
|
||||||
map.cameramode = 0;
|
map.cameramode = 0;
|
||||||
map.colsuperstate = 0;
|
map.colsuperstate = 0;
|
||||||
|
@ -3278,9 +3332,12 @@ void scriptclass::teleport()
|
||||||
game.companion = 0;
|
game.companion = 0;
|
||||||
|
|
||||||
i = obj.getplayer(); //less likely to have a serious collision error if the player is centered
|
i = obj.getplayer(); //less likely to have a serious collision error if the player is centered
|
||||||
|
if (i > -1)
|
||||||
|
{
|
||||||
obj.entities[i].xp = 150;
|
obj.entities[i].xp = 150;
|
||||||
obj.entities[i].yp = 110;
|
obj.entities[i].yp = 110;
|
||||||
if(game.teleport_to_x==17 && game.teleport_to_y==17) obj.entities[i].xp = 88; //prevent falling!
|
if(game.teleport_to_x==17 && game.teleport_to_y==17) obj.entities[i].xp = 88; //prevent falling!
|
||||||
|
}
|
||||||
|
|
||||||
if (game.teleportscript == "levelonecomplete")
|
if (game.teleportscript == "levelonecomplete")
|
||||||
{
|
{
|
||||||
|
@ -3312,7 +3369,11 @@ void scriptclass::teleport()
|
||||||
|
|
||||||
game.saverx = game.roomx;
|
game.saverx = game.roomx;
|
||||||
game.savery = game.roomy;
|
game.savery = game.roomy;
|
||||||
game.savedir = obj.entities[obj.getplayer()].dir;
|
int player = obj.getplayer();
|
||||||
|
if (player > -1)
|
||||||
|
{
|
||||||
|
game.savedir = obj.entities[player].dir;
|
||||||
|
}
|
||||||
|
|
||||||
if(game.teleport_to_x==0 && game.teleport_to_y==0)
|
if(game.teleport_to_x==0 && game.teleport_to_y==0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue