Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gravity Token additions #899

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions desktop_version/src/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ static void draw_entities(void)
font::print(PR_FONT_8X8, x, y, "////", 255 - help.glow, 255 - help.glow, 255 - help.glow);
graphics.draw_rect(x, y, 32, 8, graphics.getRGB(255, 255, 255));
break;
case 5: // Gravity Tokens
graphics.draw_sprite(x, y, 68 + entity->p1, graphics.getcol(entity->p2));
graphics.draw_rect(x, y, 16, 16, graphics.getRGB(255, 164, 164));
break;
case 9: // Shiny Trinkets
graphics.draw_sprite(x, y, 22, 196, 196, 196);
graphics.draw_rect(x, y, 16, 16, graphics.getRGB(255, 164, 164));
Expand Down
28 changes: 22 additions & 6 deletions desktop_version/src/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1480,13 +1480,14 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
entity.rule = 3;
entity.type = 4;
entity.size = 0;
entity.tile = 11;
entity.tile = 68 + meta1;
entity.colour = meta2;
entity.w = 16;
entity.h = 16;
entity.behave = meta1;
entity.para = meta2;
entity.behave = p2;
entity.para = p3;
entity.onentity = 1;
entity.animate = 100;
entity.animate = (p1 >= 1) ? 1 : -1;
break;
case 6: //Decorative particles
entity.rule = 2;
Expand Down Expand Up @@ -2634,8 +2635,22 @@ bool entityclass::updateentities( int i )
{
game.gravitycontrol = (game.gravitycontrol + 1) % 2;
++game.totalflips;
return disableentity(i);

music.playef(8 + entities[i].behave);
entities[i].invis = true;
entities[i].state = 2;
// Removes collision
entities[i].onentity = 0;
}
else if (entities[i].state == 2)
{
// Wait until recharged!
}
else if (entities[i].state == 3)
{
// Respawn!
entities[i].invis = false;
entities[i].state = 0;
entities[i].onentity = 1;
}
break;
case 5: //Particle sprays
Expand Down Expand Up @@ -3475,6 +3490,7 @@ void entityclass::animateentities( int _i )
}
break;
case 1:
case 4:
case 23:
//Variable animation
switch(entities[_i].animate)
Expand Down
5 changes: 5 additions & 0 deletions desktop_version/src/Logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,11 @@ void gamelogic(void)
}
if (!entitygone) obj.entities[i].state = 4;
}
else if (obj.entities[i].type == 4 && obj.entities[i].state == 2)
{
// Gravity token: Give a signal to respawn
obj.entities[i].state = 3;
}
else if (obj.entities[i].type == 23 && game.swnmode && game.deathseq<15)
{
//if playing SWN, get the enemies offscreen.
Expand Down
3 changes: 3 additions & 0 deletions desktop_version/src/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,9 @@ void mapclass::loadlevel(int rx, int ry)
case 3: // Disappearing platforms
obj.createentity(ex, ey, 3);
break;
case 5: // Gravity tokens
obj.createentity(ex, ey, 5, ent.p1, ent.p2, ent.p3, ent.p4);
break;
case 9: // Trinkets
obj.createentity(ex, ey, 9, cl.findtrinket(edi));
break;
Expand Down