mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 09:30:35 +00:00
racing: in SpaceRocks
This commit is contained in:
parent
32626dc0c1
commit
6012cbc8e2
@ -3901,7 +3901,7 @@ int gridcolor(cell *c1, cell *c2) {
|
|||||||
if(r == 3) return Dark(0xC02020);
|
if(r == 3) return Dark(0xC02020);
|
||||||
if(r == 2) return Dark(0xF02020);
|
if(r == 2) return Dark(0xF02020);
|
||||||
}
|
}
|
||||||
if(chasmgraph(c1) != chasmgraph(c2))
|
if(chasmgraph(c1) != chasmgraph(c2) && c1->land != laAsteroids && c2->land != laAsteroids)
|
||||||
return Dark(0x808080);
|
return Dark(0x808080);
|
||||||
if(c1->land == laAlchemist && c2->land == laAlchemist && c1->wall != c2->wall && !c1->item && !c2->item)
|
if(c1->land == laAlchemist && c2->land == laAlchemist && c1->wall != c2->wall && !c1->item && !c2->item)
|
||||||
return Dark(0xC020C0);
|
return Dark(0xC020C0);
|
||||||
|
@ -673,6 +673,7 @@ bool set_view() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(standard_centering) return false;
|
if(standard_centering) return false;
|
||||||
|
if(player_relative && specialland == laAsteroids) return false;
|
||||||
|
|
||||||
transmatrix at = ypush(-vid.yshift) * ggmatrix(who->base) * who->at;
|
transmatrix at = ypush(-vid.yshift) * ggmatrix(who->base) * who->at;
|
||||||
|
|
||||||
@ -805,6 +806,7 @@ vector<eLand> race_lands = {
|
|||||||
laElementalWall,
|
laElementalWall,
|
||||||
laDryForest,
|
laDryForest,
|
||||||
laDeadCaves,
|
laDeadCaves,
|
||||||
|
laAsteroids
|
||||||
};
|
};
|
||||||
|
|
||||||
vector<string> playercmds_race = {
|
vector<string> playercmds_race = {
|
||||||
|
17
shmup.cpp
17
shmup.cpp
@ -1623,6 +1623,8 @@ void movePlayer(monster *m, int delta) {
|
|||||||
#endif
|
#endif
|
||||||
keyresult[cpid] = itNone;
|
keyresult[cpid] = itNone;
|
||||||
|
|
||||||
|
bool stdracing = racing::on && !inertia_based;
|
||||||
|
|
||||||
if(actionspressed[b+pcCenter]) {
|
if(actionspressed[b+pcCenter]) {
|
||||||
if(!racing::on) {
|
if(!racing::on) {
|
||||||
centerplayer = cpid; centerpc(100); playermoved = true;
|
centerplayer = cpid; centerpc(100); playermoved = true;
|
||||||
@ -1641,7 +1643,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
// if(mturn < -1) mturn = -1;
|
// if(mturn < -1) mturn = -1;
|
||||||
|
|
||||||
#if CAP_RACING
|
#if CAP_RACING
|
||||||
if(racing::on) {
|
if(stdracing) {
|
||||||
if(WDIM == 2) {
|
if(WDIM == 2) {
|
||||||
if(abs(mdy) > abs(mgo)) mgo = -mdy;
|
if(abs(mdy) > abs(mgo)) mgo = -mdy;
|
||||||
if(abs(mdx) > abs(mturn)) mturn = -mdx;
|
if(abs(mdx) > abs(mturn)) mturn = -mdx;
|
||||||
@ -1650,6 +1652,9 @@ void movePlayer(monster *m, int delta) {
|
|||||||
facemouse = shotkey = dropgreen = false;
|
facemouse = shotkey = dropgreen = false;
|
||||||
if(ticks < racing::race_start_tick || !racing::race_start_tick) (WDIM == 2 ? mgo : mdy) = 0;
|
if(ticks < racing::race_start_tick || !racing::race_start_tick) (WDIM == 2 ? mgo : mdy) = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if(racing::on && (ticks < racing::race_start_tick || !racing::race_start_tick)) mgo = mdx = mdy = 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
playerturn[cpid] = mturn * delta / 150.0;
|
playerturn[cpid] = mturn * delta / 150.0;
|
||||||
@ -1681,7 +1686,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
#if CAP_SDL
|
#if CAP_SDL
|
||||||
Uint8 *keystate = SDL_GetKeyState(NULL);
|
Uint8 *keystate = SDL_GetKeyState(NULL);
|
||||||
bool forcetarget = (keystate[SDLK_RSHIFT] | keystate[SDLK_LSHIFT]);
|
bool forcetarget = (keystate[SDLK_RSHIFT] | keystate[SDLK_LSHIFT]);
|
||||||
if(((mousepressed && !forcetarget) || facemouse) && delta > 0 && !mouseout() && !racing::on && GDIM == 2) {
|
if(((mousepressed && !forcetarget) || facemouse) && delta > 0 && !mouseout() && !stdracing && GDIM == 2) {
|
||||||
// playermoved = true;
|
// playermoved = true;
|
||||||
hyperpoint h = inverse(m->pat) * mouseh;
|
hyperpoint h = inverse(m->pat) * mouseh;
|
||||||
playerturn[cpid] = -atan2(h[1], h[0]);
|
playerturn[cpid] = -atan2(h[1], h[0]);
|
||||||
@ -1693,7 +1698,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
bool blown = m->blowoff > curtime;
|
bool blown = m->blowoff > curtime;
|
||||||
|
|
||||||
if(WDIM == 2 && GDIM == 3 && !lctrlclick && cpid == 0) {
|
if(WDIM == 2 && GDIM == 3 && !lctrlclick && cpid == 0) {
|
||||||
if(!racing::on) playerturn[cpid] -= mouseaim_x;
|
if(!stdracing) playerturn[cpid] -= mouseaim_x;
|
||||||
playerturny[cpid] -= mouseaim_y;
|
playerturny[cpid] -= mouseaim_y;
|
||||||
mouseaim_x = 0;
|
mouseaim_x = 0;
|
||||||
mouseaim_y = 0;
|
mouseaim_y = 0;
|
||||||
@ -1719,7 +1724,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
if(WDIM == 2) {
|
if(WDIM == 2) {
|
||||||
if(mgo > 1) mgo = 1;
|
if(mgo > 1) mgo = 1;
|
||||||
if(mgo < -1) mgo = -1;
|
if(mgo < -1) mgo = -1;
|
||||||
if(racing::on) {
|
if(stdracing) {
|
||||||
// braking is more efficient
|
// braking is more efficient
|
||||||
if(m->vel * mgo < 0) mgo *= 3;
|
if(m->vel * mgo < 0) mgo *= 3;
|
||||||
m->vel += mgo * delta / 600;
|
m->vel += mgo * delta / 600;
|
||||||
@ -1737,7 +1742,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
if(mdx > 1) mdx = 1;
|
if(mdx > 1) mdx = 1;
|
||||||
|
|
||||||
if(mdx < -1) mdx = -1;
|
if(mdx < -1) mdx = -1;
|
||||||
if(racing::on) {
|
if(stdracing) {
|
||||||
if(m->vel * -mdy < 0) mdy *= 3;
|
if(m->vel * -mdy < 0) mdy *= 3;
|
||||||
m->vel += -mdy * delta / 600;
|
m->vel += -mdy * delta / 600;
|
||||||
playergo[cpid] = m->vel * SCALE * delta / 600;
|
playergo[cpid] = m->vel * SCALE * delta / 600;
|
||||||
@ -2114,7 +2119,7 @@ void movePlayer(monster *m, int delta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CAP_RACING
|
#if CAP_RACING
|
||||||
if(!go && racing::on) m->vel = 0;
|
if(!go && stdracing) m->vel = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(shotkey && canmove && curtime >= m->nextshot) {
|
if(shotkey && canmove && curtime >= m->nextshot) {
|
||||||
|
Loading…
Reference in New Issue
Block a user