1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

racing: in SpaceRocks

This commit is contained in:
Zeno Rogue 2019-05-22 01:13:54 +02:00
parent 32626dc0c1
commit 6012cbc8e2
3 changed files with 14 additions and 7 deletions

View File

@ -3901,7 +3901,7 @@ int gridcolor(cell *c1, cell *c2) {
if(r == 3) return Dark(0xC02020);
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);
if(c1->land == laAlchemist && c2->land == laAlchemist && c1->wall != c2->wall && !c1->item && !c2->item)
return Dark(0xC020C0);

View File

@ -673,6 +673,7 @@ bool set_view() {
}
if(standard_centering) return false;
if(player_relative && specialland == laAsteroids) return false;
transmatrix at = ypush(-vid.yshift) * ggmatrix(who->base) * who->at;
@ -805,6 +806,7 @@ vector<eLand> race_lands = {
laElementalWall,
laDryForest,
laDeadCaves,
laAsteroids
};
vector<string> playercmds_race = {

View File

@ -1623,6 +1623,8 @@ void movePlayer(monster *m, int delta) {
#endif
keyresult[cpid] = itNone;
bool stdracing = racing::on && !inertia_based;
if(actionspressed[b+pcCenter]) {
if(!racing::on) {
centerplayer = cpid; centerpc(100); playermoved = true;
@ -1641,7 +1643,7 @@ void movePlayer(monster *m, int delta) {
// if(mturn < -1) mturn = -1;
#if CAP_RACING
if(racing::on) {
if(stdracing) {
if(WDIM == 2) {
if(abs(mdy) > abs(mgo)) mgo = -mdy;
if(abs(mdx) > abs(mturn)) mturn = -mdx;
@ -1650,6 +1652,9 @@ void movePlayer(monster *m, int delta) {
facemouse = shotkey = dropgreen = false;
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
playerturn[cpid] = mturn * delta / 150.0;
@ -1681,7 +1686,7 @@ void movePlayer(monster *m, int delta) {
#if CAP_SDL
Uint8 *keystate = SDL_GetKeyState(NULL);
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;
hyperpoint h = inverse(m->pat) * mouseh;
playerturn[cpid] = -atan2(h[1], h[0]);
@ -1693,7 +1698,7 @@ void movePlayer(monster *m, int delta) {
bool blown = m->blowoff > curtime;
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;
mouseaim_x = 0;
mouseaim_y = 0;
@ -1719,7 +1724,7 @@ void movePlayer(monster *m, int delta) {
if(WDIM == 2) {
if(mgo > 1) mgo = 1;
if(mgo < -1) mgo = -1;
if(racing::on) {
if(stdracing) {
// braking is more efficient
if(m->vel * mgo < 0) mgo *= 3;
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(racing::on) {
if(stdracing) {
if(m->vel * -mdy < 0) mdy *= 3;
m->vel += -mdy * delta / 600;
playergo[cpid] = m->vel * SCALE * delta / 600;
@ -2114,7 +2119,7 @@ void movePlayer(monster *m, int delta) {
}
#if CAP_RACING
if(!go && racing::on) m->vel = 0;
if(!go && stdracing) m->vel = 0;
#endif
if(shotkey && canmove && curtime >= m->nextshot) {