mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Remove global args from scriptclass
This commit removes all global args from the parameters of each function on the scriptclass object, and updates all places they are called accordingly. It also changes all instances of 'dwgfx' to 'graphics' in Script.cpp. Interestingly enough, it looks like editor.h depended on Script.h's class define of the musicclass. I've temporarily placed the class define in editor.h, but by the end of this patchset it'll be gone.
This commit is contained in:
parent
2826bd828c
commit
ea3c778b84
7 changed files with 172 additions and 180 deletions
|
@ -1795,7 +1795,7 @@ SDL_assert(0 && "Remove open level dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dwgfx.fademode == 1)
|
if (dwgfx.fademode == 1)
|
||||||
script.startgamemode(game.mainmenu, key, dwgfx, game, map, obj, help, music);
|
script.startgamemode(game.mainmenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
|
@ -1956,7 +1956,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
{
|
{
|
||||||
//restart the time trial
|
//restart the time trial
|
||||||
game.quickrestartkludge = false;
|
game.quickrestartkludge = false;
|
||||||
script.startgamemode(game.timetriallevel + 3, key, dwgfx, game, map, obj, help, music);
|
script.startgamemode(game.timetriallevel + 3);
|
||||||
game.deathseq = -1;
|
game.deathseq = -1;
|
||||||
game.completestop = false;
|
game.completestop = false;
|
||||||
}
|
}
|
||||||
|
@ -2121,7 +2121,7 @@ void gameinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
else if (game.intimetrial && dwgfx.fademode==0)
|
else if (game.intimetrial && dwgfx.fademode==0)
|
||||||
{
|
{
|
||||||
//Quick restart of time trial
|
//Quick restart of time trial
|
||||||
script.hardreset(key, dwgfx, game, map, obj, help, music);
|
script.hardreset();
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
||||||
dwgfx.fademode = 2;
|
dwgfx.fademode = 2;
|
||||||
game.completestop = true;
|
game.completestop = true;
|
||||||
|
@ -2435,7 +2435,7 @@ void mapinput(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
//This fixes an apparent frame flicker.
|
//This fixes an apparent frame flicker.
|
||||||
FillRect(dwgfx.tempBuffer, 0x000000);
|
FillRect(dwgfx.tempBuffer, 0x000000);
|
||||||
if (game.intimetrial || game.insecretlab || game.nodeathmode) game.menukludge = true;
|
if (game.intimetrial || game.insecretlab || game.nodeathmode) game.menukludge = true;
|
||||||
script.hardreset(key, dwgfx, game, map, obj, help, music);
|
script.hardreset();
|
||||||
if(dwgfx.setflipmode) dwgfx.flipmode = true;
|
if(dwgfx.setflipmode) dwgfx.flipmode = true;
|
||||||
dwgfx.fademode = 2;
|
dwgfx.fademode = 2;
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
|
@ -278,7 +278,7 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
|
||||||
game.gethardestroom();
|
game.gethardestroom();
|
||||||
//start depressing sequence here...
|
//start depressing sequence here...
|
||||||
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2;
|
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2;
|
||||||
if (dwgfx.fademode == 1) script.resetgametomenu(dwgfx, game, map, obj, help, music);
|
if (dwgfx.fademode == 1) script.resetgametomenu();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -523,7 +523,7 @@ void towerlogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& musi
|
||||||
//Looping around, room change conditions!
|
//Looping around, room change conditions!
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.teleport_to_new_area) script.teleport(dwgfx, game, map, obj, help, music);
|
if (game.teleport_to_new_area) script.teleport();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help)
|
void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music, mapclass& map, UtilityClass& help)
|
||||||
|
@ -657,7 +657,7 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
|
||||||
game.gethardestroom();
|
game.gethardestroom();
|
||||||
//start depressing sequence here...
|
//start depressing sequence here...
|
||||||
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2;
|
if (game.gameoverdelay <= -10 && dwgfx.fademode==0) dwgfx.fademode = 2;
|
||||||
if (dwgfx.fademode == 1) script.resetgametomenu(dwgfx, game, map, obj, help, music);
|
if (dwgfx.fademode == 1) script.resetgametomenu();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1544,5 +1544,5 @@ void gamelogic(Graphics& dwgfx, Game& game, entityclass& obj, musicclass& music
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.teleport_to_new_area)
|
if (game.teleport_to_new_area)
|
||||||
script.teleport(dwgfx, game, map, obj, help, music);
|
script.teleport();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ void scriptclass::tokenize( std::string t )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, UtilityClass& help, musicclass& music )
|
void scriptclass::run()
|
||||||
{
|
{
|
||||||
while(running && scriptdelay<=0 && !game.pausescript)
|
while(running && scriptdelay<=0 && !game.pausescript)
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
int curlevel=temprx+(ed.maxwidth*(tempry));
|
int curlevel=temprx+(ed.maxwidth*(tempry));
|
||||||
ed.level[curlevel].warpdir=ss_toi(words[3]);
|
ed.level[curlevel].warpdir=ss_toi(words[3]);
|
||||||
//If screen warping, then override all that:
|
//If screen warping, then override all that:
|
||||||
dwgfx.backgrounddrawn = false;
|
graphics.backgrounddrawn = false;
|
||||||
|
|
||||||
//Do we update our own room?
|
//Do we update our own room?
|
||||||
if(game.roomx-100==temprx && game.roomy-100==tempry){
|
if(game.roomx-100==temprx && game.roomy-100==tempry){
|
||||||
|
@ -109,7 +109,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
if(ed.level[curlevel].tileset==2){
|
if(ed.level[curlevel].tileset==2){
|
||||||
//Lab
|
//Lab
|
||||||
map.background = 2;
|
map.background = 2;
|
||||||
dwgfx.rcol = ed.level[curlevel].tilecol;
|
graphics.rcol = ed.level[curlevel].tilecol;
|
||||||
}else if(ed.level[curlevel].tileset==3){
|
}else if(ed.level[curlevel].tileset==3){
|
||||||
//Warp Zone
|
//Warp Zone
|
||||||
map.background = 6;
|
map.background = 6;
|
||||||
|
@ -117,15 +117,15 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}else if(ed.level[curlevel].warpdir==1){
|
}else if(ed.level[curlevel].warpdir==1){
|
||||||
map.warpx=true;
|
map.warpx=true;
|
||||||
map.background=3;
|
map.background=3;
|
||||||
dwgfx.rcol = ed.getwarpbackground(temprx,tempry);
|
graphics.rcol = ed.getwarpbackground(temprx,tempry);
|
||||||
}else if(ed.level[curlevel].warpdir==2){
|
}else if(ed.level[curlevel].warpdir==2){
|
||||||
map.warpy=true;
|
map.warpy=true;
|
||||||
map.background=4;
|
map.background=4;
|
||||||
dwgfx.rcol = ed.getwarpbackground(temprx,tempry);
|
graphics.rcol = ed.getwarpbackground(temprx,tempry);
|
||||||
}else if(ed.level[curlevel].warpdir==3){
|
}else if(ed.level[curlevel].warpdir==3){
|
||||||
map.warpx=true; map.warpy=true;
|
map.warpx=true; map.warpy=true;
|
||||||
map.background = 5;
|
map.background = 5;
|
||||||
dwgfx.rcol = ed.getwarpbackground(temprx,tempry);
|
graphics.rcol = ed.getwarpbackground(temprx,tempry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,17 +284,17 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
if (words[0] == "cutscene")
|
if (words[0] == "cutscene")
|
||||||
{
|
{
|
||||||
dwgfx.showcutscenebars = true;
|
graphics.showcutscenebars = true;
|
||||||
}
|
}
|
||||||
if (words[0] == "endcutscene")
|
if (words[0] == "endcutscene")
|
||||||
{
|
{
|
||||||
dwgfx.showcutscenebars = false;
|
graphics.showcutscenebars = false;
|
||||||
}
|
}
|
||||||
if (words[0] == "untilbars")
|
if (words[0] == "untilbars")
|
||||||
{
|
{
|
||||||
if (dwgfx.showcutscenebars)
|
if (graphics.showcutscenebars)
|
||||||
{
|
{
|
||||||
if (dwgfx.cutscenebarspos < 360)
|
if (graphics.cutscenebarspos < 360)
|
||||||
{
|
{
|
||||||
scriptdelay = 1;
|
scriptdelay = 1;
|
||||||
position--;
|
position--;
|
||||||
|
@ -302,7 +302,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (dwgfx.cutscenebarspos > 0)
|
if (graphics.cutscenebarspos > 0)
|
||||||
{
|
{
|
||||||
scriptdelay = 1;
|
scriptdelay = 1;
|
||||||
position--;
|
position--;
|
||||||
|
@ -573,17 +573,17 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
else if (words[0] == "flipme")
|
else if (words[0] == "flipme")
|
||||||
{
|
{
|
||||||
if(dwgfx.flipmode) texty += 2*(120 - texty) - 8*(txtnumlines+2);
|
if(graphics.flipmode) texty += 2*(120 - texty) - 8*(txtnumlines+2);
|
||||||
}
|
}
|
||||||
else if (words[0] == "speak_active")
|
else if (words[0] == "speak_active")
|
||||||
{
|
{
|
||||||
//Ok, actually display the textbox we've initilised now!
|
//Ok, actually display the textbox we've initilised now!
|
||||||
dwgfx.createtextbox(txt[0], textx, texty, r, g, b);
|
graphics.createtextbox(txt[0], textx, texty, r, g, b);
|
||||||
if (txtnumlines > 1)
|
if (txtnumlines > 1)
|
||||||
{
|
{
|
||||||
for (i = 1; i < txtnumlines; i++)
|
for (i = 1; i < txtnumlines; i++)
|
||||||
{
|
{
|
||||||
dwgfx.addline(txt[i]);
|
graphics.addline(txt[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,23 +592,23 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
{
|
{
|
||||||
//position to the left of the player
|
//position to the left of the player
|
||||||
textx += 10000;
|
textx += 10000;
|
||||||
textx -= dwgfx.textboxwidth();
|
textx -= graphics.textboxwidth();
|
||||||
textx += 16;
|
textx += 16;
|
||||||
dwgfx.textboxmoveto(textx);
|
graphics.textboxmoveto(textx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textx == -500 || textx == -1)
|
if (textx == -500 || textx == -1)
|
||||||
{
|
{
|
||||||
dwgfx.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texty == -500)
|
if (texty == -500)
|
||||||
{
|
{
|
||||||
dwgfx.textboxcentery();
|
graphics.textboxcentery();
|
||||||
}
|
}
|
||||||
|
|
||||||
dwgfx.textboxadjust();
|
graphics.textboxadjust();
|
||||||
dwgfx.textboxactive();
|
graphics.textboxactive();
|
||||||
|
|
||||||
if (!game.backgroundtext)
|
if (!game.backgroundtext)
|
||||||
{
|
{
|
||||||
|
@ -623,12 +623,12 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
else if (words[0] == "speak")
|
else if (words[0] == "speak")
|
||||||
{
|
{
|
||||||
//Exactly as above, except don't make the textbox active (so we can use multiple textboxes)
|
//Exactly as above, except don't make the textbox active (so we can use multiple textboxes)
|
||||||
dwgfx.createtextbox(txt[0], textx, texty, r, g, b);
|
graphics.createtextbox(txt[0], textx, texty, r, g, b);
|
||||||
if (txtnumlines > 1)
|
if (txtnumlines > 1)
|
||||||
{
|
{
|
||||||
for (i = 1; i < txtnumlines; i++)
|
for (i = 1; i < txtnumlines; i++)
|
||||||
{
|
{
|
||||||
dwgfx.addline(txt[i]);
|
graphics.addline(txt[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,23 +637,23 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
{
|
{
|
||||||
//position to the left of the player
|
//position to the left of the player
|
||||||
textx += 10000;
|
textx += 10000;
|
||||||
textx -= dwgfx.textboxwidth();
|
textx -= graphics.textboxwidth();
|
||||||
textx += 16;
|
textx += 16;
|
||||||
dwgfx.textboxmoveto(textx);
|
graphics.textboxmoveto(textx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textx == -500 || textx == -1)
|
if (textx == -500 || textx == -1)
|
||||||
{
|
{
|
||||||
dwgfx.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (texty == -500)
|
if (texty == -500)
|
||||||
{
|
{
|
||||||
dwgfx.textboxcentery();
|
graphics.textboxcentery();
|
||||||
}
|
}
|
||||||
|
|
||||||
dwgfx.textboxadjust();
|
graphics.textboxadjust();
|
||||||
//dwgfx.textboxactive();
|
//graphics.textboxactive();
|
||||||
|
|
||||||
if (!game.backgroundtext)
|
if (!game.backgroundtext)
|
||||||
{
|
{
|
||||||
|
@ -667,13 +667,13 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
else if (words[0] == "endtext")
|
else if (words[0] == "endtext")
|
||||||
{
|
{
|
||||||
dwgfx.textboxremove();
|
graphics.textboxremove();
|
||||||
game.hascontrol = true;
|
game.hascontrol = true;
|
||||||
game.advancetext = false;
|
game.advancetext = false;
|
||||||
}
|
}
|
||||||
else if (words[0] == "endtextfast")
|
else if (words[0] == "endtextfast")
|
||||||
{
|
{
|
||||||
dwgfx.textboxremovefast();
|
graphics.textboxremovefast();
|
||||||
game.hascontrol = true;
|
game.hascontrol = true;
|
||||||
game.advancetext = false;
|
game.advancetext = false;
|
||||||
}
|
}
|
||||||
|
@ -1261,7 +1261,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
else if (words[0] == "textboxactive")
|
else if (words[0] == "textboxactive")
|
||||||
{
|
{
|
||||||
dwgfx.textboxactive();
|
graphics.textboxactive();
|
||||||
}
|
}
|
||||||
else if (words[0] == "gamemode")
|
else if (words[0] == "gamemode")
|
||||||
{
|
{
|
||||||
|
@ -1269,17 +1269,17 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
{
|
{
|
||||||
//TODO this draw the teleporter screen. This is a problem. :(
|
//TODO this draw the teleporter screen. This is a problem. :(
|
||||||
game.gamestate = 5;
|
game.gamestate = 5;
|
||||||
dwgfx.menuoffset = 240; //actually this should count the roomname
|
graphics.menuoffset = 240; //actually this should count the roomname
|
||||||
if (map.extrarow) dwgfx.menuoffset -= 10;
|
if (map.extrarow) graphics.menuoffset -= 10;
|
||||||
//dwgfx.menubuffer.copyPixels(dwgfx.screenbuffer, dwgfx.screenbuffer.rect, dwgfx.tl, null, null, false);
|
//graphics.menubuffer.copyPixels(graphics.screenbuffer, graphics.screenbuffer.rect, graphics.tl, null, null, false);
|
||||||
|
|
||||||
dwgfx.resumegamemode = false;
|
graphics.resumegamemode = false;
|
||||||
|
|
||||||
game.useteleporter = false; //good heavens don't actually use it
|
game.useteleporter = false; //good heavens don't actually use it
|
||||||
}
|
}
|
||||||
else if (words[1] == "game")
|
else if (words[1] == "game")
|
||||||
{
|
{
|
||||||
dwgfx.resumegamemode = true;
|
graphics.resumegamemode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (words[0] == "ifexplored")
|
else if (words[0] == "ifexplored")
|
||||||
|
@ -1430,20 +1430,20 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
else if (words[0] == "befadein")
|
else if (words[0] == "befadein")
|
||||||
{
|
{
|
||||||
dwgfx.fadeamount = 0;
|
graphics.fadeamount = 0;
|
||||||
dwgfx.fademode= 0;
|
graphics.fademode= 0;
|
||||||
}
|
}
|
||||||
else if (words[0] == "fadein")
|
else if (words[0] == "fadein")
|
||||||
{
|
{
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
}
|
}
|
||||||
else if (words[0] == "fadeout")
|
else if (words[0] == "fadeout")
|
||||||
{
|
{
|
||||||
dwgfx.fademode = 2;
|
graphics.fademode = 2;
|
||||||
}
|
}
|
||||||
else if (words[0] == "untilfade")
|
else if (words[0] == "untilfade")
|
||||||
{
|
{
|
||||||
if (dwgfx.fademode>1)
|
if (graphics.fademode>1)
|
||||||
{
|
{
|
||||||
scriptdelay = 1;
|
scriptdelay = 1;
|
||||||
position--;
|
position--;
|
||||||
|
@ -1508,7 +1508,7 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
else if (words[0] == "rollcredits")
|
else if (words[0] == "rollcredits")
|
||||||
{
|
{
|
||||||
game.gamestate = 6;
|
game.gamestate = 6;
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
game.creditposition = 0;
|
game.creditposition = 0;
|
||||||
}
|
}
|
||||||
else if (words[0] == "finalmode")
|
else if (words[0] == "finalmode")
|
||||||
|
@ -1885,12 +1885,12 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
game.trinkets++;
|
game.trinkets++;
|
||||||
obj.collect[ss_toi(words[1])] = 1;
|
obj.collect[ss_toi(words[1])] = 1;
|
||||||
|
|
||||||
dwgfx.textboxremovefast();
|
graphics.textboxremovefast();
|
||||||
|
|
||||||
dwgfx.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174);
|
graphics.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174);
|
||||||
dwgfx.addline("");
|
graphics.addline("");
|
||||||
dwgfx.addline("You have found a shiny trinket!");
|
graphics.addline("You have found a shiny trinket!");
|
||||||
dwgfx.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
|
|
||||||
std::string usethisnum;
|
std::string usethisnum;
|
||||||
if (map.custommode)
|
if (map.custommode)
|
||||||
|
@ -1901,8 +1901,8 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
{
|
{
|
||||||
usethisnum = "Twenty";
|
usethisnum = "Twenty";
|
||||||
}
|
}
|
||||||
dwgfx.createtextbox(" " + help.number(game.trinkets) + " out of " + usethisnum + " ", 50, 135, 174, 174, 174);
|
graphics.createtextbox(" " + help.number(game.trinkets) + " out of " + usethisnum + " ", 50, 135, 174, 174, 174);
|
||||||
dwgfx.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
|
|
||||||
if (!game.backgroundtext)
|
if (!game.backgroundtext)
|
||||||
{
|
{
|
||||||
|
@ -1918,13 +1918,13 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
{
|
{
|
||||||
music.playef(3,10);
|
music.playef(3,10);
|
||||||
|
|
||||||
dwgfx.textboxremovefast();
|
graphics.textboxremovefast();
|
||||||
|
|
||||||
dwgfx.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174);
|
graphics.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174);
|
||||||
dwgfx.addline("");
|
graphics.addline("");
|
||||||
dwgfx.addline("You have found the secret lab!");
|
graphics.addline("You have found the secret lab!");
|
||||||
dwgfx.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
dwgfx.textboxcentery();
|
graphics.textboxcentery();
|
||||||
|
|
||||||
if (!game.backgroundtext)
|
if (!game.backgroundtext)
|
||||||
{
|
{
|
||||||
|
@ -1938,15 +1938,15 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
else if (words[0] == "foundlab2")
|
else if (words[0] == "foundlab2")
|
||||||
{
|
{
|
||||||
dwgfx.textboxremovefast();
|
graphics.textboxremovefast();
|
||||||
|
|
||||||
dwgfx.createtextbox("The secret lab is separate from", 50, 85, 174, 174, 174);
|
graphics.createtextbox("The secret lab is separate from", 50, 85, 174, 174, 174);
|
||||||
dwgfx.addline("the rest of the game. You can");
|
graphics.addline("the rest of the game. You can");
|
||||||
dwgfx.addline("now come back here at any time");
|
graphics.addline("now come back here at any time");
|
||||||
dwgfx.addline("by selecting the new SECRET LAB");
|
graphics.addline("by selecting the new SECRET LAB");
|
||||||
dwgfx.addline("option in the play menu.");
|
graphics.addline("option in the play menu.");
|
||||||
dwgfx.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
dwgfx.textboxcentery();
|
graphics.textboxcentery();
|
||||||
|
|
||||||
if (!game.backgroundtext)
|
if (!game.backgroundtext)
|
||||||
{
|
{
|
||||||
|
@ -2532,29 +2532,29 @@ void scriptclass::run( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptclass::resetgametomenu( Graphics& dwgfx, Game& game,mapclass& map, entityclass& obj, UtilityClass& help, musicclass& music )
|
void scriptclass::resetgametomenu()
|
||||||
{
|
{
|
||||||
game.gamestate = TITLEMODE;
|
game.gamestate = TITLEMODE;
|
||||||
dwgfx.flipmode = false;
|
graphics.flipmode = false;
|
||||||
obj.nentity = 0;
|
obj.nentity = 0;
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
game.createmenu("gameover");
|
game.createmenu("gameover");
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, UtilityClass& help, musicclass& music )
|
void scriptclass::startgamemode( int t )
|
||||||
{
|
{
|
||||||
switch(t)
|
switch(t)
|
||||||
{
|
{
|
||||||
case 0: //Normal new game
|
case 0: //Normal new game
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.start();
|
game.start();
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
dwgfx.showcutscenebars = true;
|
graphics.showcutscenebars = true;
|
||||||
dwgfx.cutscenebarspos = 320;
|
graphics.cutscenebarspos = 320;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -2570,14 +2570,14 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.start();
|
game.start();
|
||||||
game.loadtele();
|
game.loadtele();
|
||||||
game.gravitycontrol = game.savegc;
|
game.gravitycontrol = game.savegc;
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -2588,18 +2588,18 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 2: //Load Quicksave
|
case 2: //Load Quicksave
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.start();
|
game.start();
|
||||||
game.loadquick();
|
game.loadquick();
|
||||||
game.gravitycontrol = game.savegc;
|
game.gravitycontrol = game.savegc;
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -2621,11 +2621,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.cameramode = 0;
|
map.cameramode = 0;
|
||||||
map.colsuperstate = 0;
|
map.colsuperstate = 0;
|
||||||
}
|
}
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//Start Time Trial 1
|
//Start Time Trial 1
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nocutscenes = true;
|
game.nocutscenes = true;
|
||||||
game.intimetrial = true;
|
game.intimetrial = true;
|
||||||
game.timetrialcountdown = 150;
|
game.timetrialcountdown = 150;
|
||||||
|
@ -2639,7 +2639,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.starttrial(game.timetriallevel);
|
game.starttrial(game.timetriallevel);
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;//set flipmode
|
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2649,11 +2649,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//Start Time Trial 2
|
//Start Time Trial 2
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nocutscenes = true;
|
game.nocutscenes = true;
|
||||||
game.intimetrial = true;
|
game.intimetrial = true;
|
||||||
game.timetrialcountdown = 150;
|
game.timetrialcountdown = 150;
|
||||||
|
@ -2667,7 +2667,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.starttrial(game.timetriallevel);
|
game.starttrial(game.timetriallevel);
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;//set flipmode
|
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2677,11 +2677,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//Start Time Trial 3 tow
|
//Start Time Trial 3 tow
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nocutscenes = true;
|
game.nocutscenes = true;
|
||||||
game.intimetrial = true;
|
game.intimetrial = true;
|
||||||
game.timetrialcountdown = 150;
|
game.timetrialcountdown = 150;
|
||||||
|
@ -2695,7 +2695,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.starttrial(game.timetriallevel);
|
game.starttrial(game.timetriallevel);
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;//set flipmode
|
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2705,11 +2705,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//Start Time Trial 4 station
|
//Start Time Trial 4 station
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nocutscenes = true;
|
game.nocutscenes = true;
|
||||||
game.intimetrial = true;
|
game.intimetrial = true;
|
||||||
game.timetrialcountdown = 150;
|
game.timetrialcountdown = 150;
|
||||||
|
@ -2723,7 +2723,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.starttrial(game.timetriallevel);
|
game.starttrial(game.timetriallevel);
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;//set flipmode
|
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2733,11 +2733,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
//Start Time Trial 5 warp
|
//Start Time Trial 5 warp
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nocutscenes = true;
|
game.nocutscenes = true;
|
||||||
game.intimetrial = true;
|
game.intimetrial = true;
|
||||||
game.timetrialcountdown = 150;
|
game.timetrialcountdown = 150;
|
||||||
|
@ -2751,7 +2751,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.starttrial(game.timetriallevel);
|
game.starttrial(game.timetriallevel);
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;//set flipmode
|
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2761,11 +2761,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
//Start Time Trial 6// final level!
|
//Start Time Trial 6// final level!
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nocutscenes = true;
|
game.nocutscenes = true;
|
||||||
game.intimetrial = true;
|
game.intimetrial = true;
|
||||||
game.timetrialcountdown = 150;
|
game.timetrialcountdown = 150;
|
||||||
|
@ -2785,7 +2785,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.starttrial(game.timetriallevel);
|
game.starttrial(game.timetriallevel);
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;//set flipmode
|
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2795,21 +2795,21 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nodeathmode = true;
|
game.nodeathmode = true;
|
||||||
game.start();
|
game.start();
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
dwgfx.showcutscenebars = true;
|
graphics.showcutscenebars = true;
|
||||||
dwgfx.cutscenebarspos = 320;
|
graphics.cutscenebarspos = 320;
|
||||||
//game.starttest();
|
//game.starttest();
|
||||||
//music.play(4);
|
//music.play(4);
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -2826,19 +2826,19 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.nodeathmode = true;
|
game.nodeathmode = true;
|
||||||
game.nocutscenes = true;
|
game.nocutscenes = true;
|
||||||
|
|
||||||
game.start();
|
game.start();
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
dwgfx.showcutscenebars = true;
|
graphics.showcutscenebars = true;
|
||||||
dwgfx.cutscenebarspos = 320;
|
graphics.cutscenebarspos = 320;
|
||||||
//game.starttest();
|
//game.starttest();
|
||||||
//music.play(4);
|
//music.play(4);
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -2855,7 +2855,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
|
|
||||||
game.startspecial(0);
|
game.startspecial(0);
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
@ -2874,7 +2874,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.showteleporters = true;
|
map.showteleporters = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -2886,11 +2886,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
music.play(11);
|
music.play(11);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 2;
|
game.lastsaved = 2;
|
||||||
|
@ -2910,7 +2910,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2925,7 +2925,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 3;
|
game.lastsaved = 3;
|
||||||
|
@ -2945,7 +2945,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2960,7 +2960,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 4;
|
game.lastsaved = 4;
|
||||||
|
@ -2980,7 +2980,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -2995,7 +2995,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 5;
|
game.lastsaved = 5;
|
||||||
|
@ -3015,7 +3015,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -3030,7 +3030,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 2;
|
game.lastsaved = 2;
|
||||||
|
@ -3047,7 +3047,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -3062,7 +3062,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 3;
|
game.lastsaved = 3;
|
||||||
|
@ -3079,7 +3079,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -3094,7 +3094,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 4;
|
game.lastsaved = 4;
|
||||||
|
@ -3111,7 +3111,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -3126,7 +3126,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.lastsaved = 5;
|
game.lastsaved = 5;
|
||||||
|
@ -3143,7 +3143,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -3159,14 +3159,14 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
case 20:
|
case 20:
|
||||||
//Level editor
|
//Level editor
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
ed.reset();
|
ed.reset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
|
||||||
game.gamestate = EDITORMODE;
|
game.gamestate = EDITORMODE;
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;//set flipmode
|
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||||
|
@ -3176,12 +3176,12 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.resetplayer();
|
map.resetplayer();
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
break;
|
break;
|
||||||
case 21: //play custom level (in editor)
|
case 21: //play custom level (in editor)
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
//If warpdir() is used during playtesting, we need to set it back after!
|
//If warpdir() is used during playtesting, we need to set it back after!
|
||||||
for (int j = 0; j < ed.maxheight; j++)
|
for (int j = 0; j < ed.maxheight; j++)
|
||||||
{
|
{
|
||||||
|
@ -3198,11 +3198,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.customx = 100;
|
map.customx = 100;
|
||||||
map.customy = 100;
|
map.customy = 100;
|
||||||
|
|
||||||
//dwgfx.showcutscenebars = true;
|
//graphics.showcutscenebars = true;
|
||||||
//dwgfx.cutscenebarspos = 320;
|
//graphics.cutscenebarspos = 320;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -3228,7 +3228,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
|
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
game.customstart();
|
game.customstart();
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
||||||
|
@ -3237,11 +3237,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
map.customx = 100;
|
map.customx = 100;
|
||||||
map.customy = 100;
|
map.customy = 100;
|
||||||
|
|
||||||
//dwgfx.showcutscenebars = true;
|
//graphics.showcutscenebars = true;
|
||||||
//dwgfx.cutscenebarspos = 320;
|
//graphics.cutscenebarspos = 320;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -3253,14 +3253,14 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
}
|
}
|
||||||
map.gotoroom(game.saverx, game.savery);
|
map.gotoroom(game.saverx, game.savery);
|
||||||
|
|
||||||
ed.generatecustomminimap(dwgfx, map);
|
ed.generatecustomminimap(graphics, map);
|
||||||
map.customshowmm=true;
|
map.customshowmm=true;
|
||||||
if(ed.levmusic>0){
|
if(ed.levmusic>0){
|
||||||
music.play(ed.levmusic);
|
music.play(ed.levmusic);
|
||||||
}else{
|
}else{
|
||||||
music.currentsong=-1;
|
music.currentsong=-1;
|
||||||
}
|
}
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
//load("intro");
|
//load("intro");
|
||||||
break;
|
break;
|
||||||
case 23: //Continue in custom level
|
case 23: //Continue in custom level
|
||||||
|
@ -3271,7 +3271,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
|
|
||||||
game.gamestate = GAMEMODE;
|
game.gamestate = GAMEMODE;
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
hardreset(key, dwgfx, game, map, obj, help, music);
|
hardreset();
|
||||||
map.custommodeforreal = true;
|
map.custommodeforreal = true;
|
||||||
map.custommode = true;
|
map.custommode = true;
|
||||||
map.customx = 100;
|
map.customx = 100;
|
||||||
|
@ -3283,11 +3283,11 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
game.gravitycontrol = game.savegc;
|
game.gravitycontrol = game.savegc;
|
||||||
|
|
||||||
|
|
||||||
//dwgfx.showcutscenebars = true;
|
//graphics.showcutscenebars = true;
|
||||||
//dwgfx.cutscenebarspos = 320;
|
//graphics.cutscenebarspos = 320;
|
||||||
|
|
||||||
//set flipmode
|
//set flipmode
|
||||||
if (dwgfx.setflipmode) dwgfx.flipmode = true;
|
if (graphics.setflipmode) graphics.flipmode = true;
|
||||||
|
|
||||||
if(obj.nentity==0)
|
if(obj.nentity==0)
|
||||||
{
|
{
|
||||||
|
@ -3305,8 +3305,8 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
music.currentsong=-1;
|
music.currentsong=-1;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
ed.generatecustomminimap(dwgfx, map);
|
ed.generatecustomminimap(graphics, map);
|
||||||
dwgfx.fademode = 4;
|
graphics.fademode = 4;
|
||||||
//load("intro");
|
//load("intro");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -3319,7 +3319,7 @@ void scriptclass::startgamemode( int t, KeyPoll& key, Graphics& dwgfx, Game& gam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptclass::teleport( Graphics& dwgfx, Game& game, mapclass& map, entityclass& obj, UtilityClass& help, musicclass& music )
|
void scriptclass::teleport()
|
||||||
{
|
{
|
||||||
//er, ok! Teleport to a new area, so!
|
//er, ok! Teleport to a new area, so!
|
||||||
//A general rule of thumb: if you teleport with a companion, get rid of them!
|
//A general rule of thumb: if you teleport with a companion, get rid of them!
|
||||||
|
@ -3402,7 +3402,7 @@ void scriptclass::teleport( Graphics& dwgfx, Game& game, mapclass& map, entitycl
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//change music based on location
|
//change music based on location
|
||||||
if (dwgfx.setflipmode && game.teleport_to_x == 11 && game.teleport_to_y == 4)
|
if (graphics.setflipmode && game.teleport_to_x == 11 && game.teleport_to_y == 4)
|
||||||
{
|
{
|
||||||
music.niceplay(9);
|
music.niceplay(9);
|
||||||
}
|
}
|
||||||
|
@ -3412,22 +3412,22 @@ void scriptclass::teleport( Graphics& dwgfx, Game& game, mapclass& map, entitycl
|
||||||
}
|
}
|
||||||
if (!game.intimetrial && !game.nodeathmode && !game.inintermission)
|
if (!game.intimetrial && !game.nodeathmode && !game.inintermission)
|
||||||
{
|
{
|
||||||
if (dwgfx.flipmode)
|
if (graphics.flipmode)
|
||||||
{
|
{
|
||||||
dwgfx.createtextbox(" Game Saved ", -1, 202, 174, 174, 174);
|
graphics.createtextbox(" Game Saved ", -1, 202, 174, 174, 174);
|
||||||
dwgfx.textboxtimer(25);
|
graphics.textboxtimer(25);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dwgfx.createtextbox(" Game Saved ", -1, 12, 174, 174, 174);
|
graphics.createtextbox(" Game Saved ", -1, 12, 174, 174, 174);
|
||||||
dwgfx.textboxtimer(25);
|
graphics.textboxtimer(25);
|
||||||
}
|
}
|
||||||
game.savetele();
|
game.savetele();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptclass::hardreset( KeyPoll& key, Graphics& dwgfx, Game& game,mapclass& map, entityclass& obj, UtilityClass& help, musicclass& music )
|
void scriptclass::hardreset()
|
||||||
{
|
{
|
||||||
//Game:
|
//Game:
|
||||||
game.hascontrol = true;
|
game.hascontrol = true;
|
||||||
|
@ -3524,11 +3524,11 @@ void scriptclass::hardreset( KeyPoll& key, Graphics& dwgfx, Game& game,mapclass&
|
||||||
game.pausescript = false;
|
game.pausescript = false;
|
||||||
|
|
||||||
//dwgraphicsclass
|
//dwgraphicsclass
|
||||||
dwgfx.backgrounddrawn = false;
|
graphics.backgrounddrawn = false;
|
||||||
dwgfx.textboxremovefast();
|
graphics.textboxremovefast();
|
||||||
dwgfx.flipmode = false; //This will be reset if needs be elsewhere
|
graphics.flipmode = false; //This will be reset if needs be elsewhere
|
||||||
dwgfx.showcutscenebars = false;
|
graphics.showcutscenebars = false;
|
||||||
dwgfx.cutscenebarspos = 0;
|
graphics.cutscenebarspos = 0;
|
||||||
|
|
||||||
//mapclass
|
//mapclass
|
||||||
map.warpx = false;
|
map.warpx = false;
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
|
|
||||||
|
|
||||||
class KeyPoll; class Graphics; class Game; class mapclass; class entityclass; class UtilityClass;class musicclass;
|
|
||||||
|
|
||||||
|
|
||||||
class scriptclass
|
class scriptclass
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -30,20 +27,15 @@ public:
|
||||||
|
|
||||||
void tokenize(std::string t);
|
void tokenize(std::string t);
|
||||||
|
|
||||||
void run(KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
void run();
|
||||||
entityclass& obj, UtilityClass& help, musicclass& music);
|
|
||||||
|
|
||||||
void resetgametomenu(Graphics& dwgfx, Game& game,mapclass& map,
|
void resetgametomenu();
|
||||||
entityclass& obj, UtilityClass& help, musicclass& music);
|
|
||||||
|
|
||||||
void startgamemode(int t, KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map,
|
void startgamemode(int t);
|
||||||
entityclass& obj, UtilityClass& help, musicclass& music);
|
|
||||||
|
|
||||||
void teleport(Graphics& dwgfx, Game& game, mapclass& map,
|
void teleport();
|
||||||
entityclass& obj, UtilityClass& help, musicclass& music);
|
|
||||||
|
|
||||||
void hardreset(KeyPoll& key, Graphics& dwgfx, Game& game,mapclass& map,
|
void hardreset();
|
||||||
entityclass& obj, UtilityClass& help, musicclass& music);
|
|
||||||
|
|
||||||
//Script contents
|
//Script contents
|
||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
|
|
|
@ -4491,7 +4491,7 @@ void editorinput( KeyPoll& key, Graphics& dwgfx, Game& game, mapclass& map, enti
|
||||||
music.stopmusic();
|
music.stopmusic();
|
||||||
dwgfx.backgrounddrawn=false;
|
dwgfx.backgrounddrawn=false;
|
||||||
ed.returneditoralpha = 1000; // Let's start it higher than 255 since it gets clamped
|
ed.returneditoralpha = 1000; // Let's start it higher than 255 since it gets clamped
|
||||||
script.startgamemode(21, key, dwgfx, game, map, obj, help, music);
|
script.startgamemode(21);
|
||||||
}
|
}
|
||||||
//Return to game
|
//Return to game
|
||||||
//game.gamestate=GAMEMODE;
|
//game.gamestate=GAMEMODE;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
|
|
||||||
class KeyPoll; class Graphics; class Game; class mapclass; class entityclass; class UtilityClass;
|
class KeyPoll; class Graphics; class Game; class mapclass; class entityclass; class UtilityClass; class musicclass;
|
||||||
|
|
||||||
|
|
||||||
class edentities{
|
class edentities{
|
||||||
|
|
|
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
|
||||||
/*
|
/*
|
||||||
//game.gamestate=GAMEMODE;
|
//game.gamestate=GAMEMODE;
|
||||||
//game.start(obj,music);
|
//game.start(obj,music);
|
||||||
//script.startgamemode(8, key, graphics, game, map, obj, help, music);
|
//script.startgamemode(8);
|
||||||
// map.finalmode = true; //Enable final level mode
|
// map.finalmode = true; //Enable final level mode
|
||||||
//map.finalx = 41; map.finaly = 52; //Midpoint
|
//map.finalx = 41; map.finaly = 52; //Midpoint
|
||||||
//map.finalstretch = true;
|
//map.finalstretch = true;
|
||||||
|
@ -405,7 +405,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (script.running)
|
if (script.running)
|
||||||
{
|
{
|
||||||
script.run(key, graphics, game, map, obj, help, music);
|
script.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
gameinput(key, graphics, game, map, obj, help, music);
|
gameinput(key, graphics, game, map, obj, help, music);
|
||||||
|
@ -444,7 +444,7 @@ int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (script.running)
|
if (script.running)
|
||||||
{
|
{
|
||||||
script.run(key, graphics, game, map, obj, help, music);
|
script.run();
|
||||||
}
|
}
|
||||||
gameinput(key, graphics, game, map, obj, help, music);
|
gameinput(key, graphics, game, map, obj, help, music);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue