Asteroids in 3D
This commit is contained in:
parent
6d87b282c3
commit
55492e229b
|
@ -665,7 +665,7 @@ color_t kind_outline(eItem it) {
|
||||||
return OUTLINE_OTHER;
|
return OUTLINE_OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
transmatrix face_the_player(transmatrix V) {
|
transmatrix face_the_player(const transmatrix V) {
|
||||||
if(DIM == 2) return V;
|
if(DIM == 2) return V;
|
||||||
return rgpushxto0(tC0(V));
|
return rgpushxto0(tC0(V));
|
||||||
}
|
}
|
||||||
|
@ -5465,7 +5465,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||||
queuechr(V, 1, ch, darkenedby(asciicol, darken), 2);
|
queuechr(V, 1, ch, darkenedby(asciicol, darken), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vid.grid) {
|
if(vid.grid || (DIM == 3 && c->land == laAsteroids)) {
|
||||||
dynamicval<ld> lw(vid.linewidth, vid.linewidth);
|
dynamicval<ld> lw(vid.linewidth, vid.linewidth);
|
||||||
|
|
||||||
vid.linewidth *= scalefactor;
|
vid.linewidth *= scalefactor;
|
||||||
|
|
3
hyper.h
3
hyper.h
|
@ -2022,6 +2022,9 @@ extern bool ivoryz;
|
||||||
#define SHADOW_SL 0x18
|
#define SHADOW_SL 0x18
|
||||||
#define SHADOW_MON 0x30
|
#define SHADOW_MON 0x30
|
||||||
|
|
||||||
|
transmatrix face_the_player(const transmatrix V);
|
||||||
|
hyperpoint makeradar(transmatrix V);
|
||||||
|
|
||||||
bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, color_t col, double footphase);
|
bool drawMonsterType(eMonster m, cell *where, const transmatrix& V, color_t col, double footphase);
|
||||||
|
|
||||||
void drawPlayerEffects(const transmatrix& V, cell *c, bool onPlayer);
|
void drawPlayerEffects(const transmatrix& V, cell *c, bool onPlayer);
|
||||||
|
|
|
@ -2318,6 +2318,7 @@ void procedural_shapes() {
|
||||||
|
|
||||||
for(int i=0; i<8; i++) {
|
for(int i=0; i<8; i++) {
|
||||||
asteroid_size[i] = scalefactor * 0.1 * pow(2, (i-1) * 1. / DIM);
|
asteroid_size[i] = scalefactor * 0.1 * pow(2, (i-1) * 1. / DIM);
|
||||||
|
if(DIM == 3) asteroid_size[i] *= 4;
|
||||||
bshape(shAsteroid[i], PPR::PARTICLE);
|
bshape(shAsteroid[i], PPR::PARTICLE);
|
||||||
for(int t=0; t<12; t++)
|
for(int t=0; t<12; t++)
|
||||||
hpcpush(xspinpush0(M_PI * t / 6, asteroid_size[i] * (1 - randd() * .2)));
|
hpcpush(xspinpush0(M_PI * t / 6, asteroid_size[i] * (1 - randd() * .2)));
|
||||||
|
|
11
shmup.cpp
11
shmup.cpp
|
@ -1847,6 +1847,7 @@ void movePlayer(monster *m, int delta) {
|
||||||
if(igo) { go = false; break; }
|
if(igo) { go = false; break; }
|
||||||
ld r = hypot_d(DIM, avg_inertia);
|
ld r = hypot_d(DIM, avg_inertia);
|
||||||
nat = nat * rspintox(avg_inertia) * xpush(r * delta) * spintox(avg_inertia);
|
nat = nat * rspintox(avg_inertia) * xpush(r * delta) * spintox(avg_inertia);
|
||||||
|
if(DIM == 3) nat = nat * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]);
|
||||||
}
|
}
|
||||||
else if(DIM == 3) {
|
else if(DIM == 3) {
|
||||||
nat = nat1 * cpush(0, playerstrafe[cpid]) * cpush(2, playergo[cpid]) * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]);
|
nat = nat1 * cpush(0, playerstrafe[cpid]) * cpush(2, playergo[cpid]) * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]);
|
||||||
|
@ -3690,9 +3691,15 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case moAsteroid: {
|
case moAsteroid: {
|
||||||
transmatrix t = view * spin(curtime / 500.0);
|
if(DIM == 3) radarpoints.emplace_back(radarpoint{makeradar(view), '*', 0xFFFFFF, 0xC0C0C0FF});
|
||||||
queuepoly(mmscale(t, 1.15), shAsteroid[m->hitpoints & 7], (minf[m->type].color << 8) | 0xFF);
|
transmatrix t = view;
|
||||||
|
if(DIM == 3) t = face_the_player(t);
|
||||||
|
t = t * spin(curtime / 500.0);
|
||||||
ShadowV(t, shAsteroid[m->hitpoints & 7]);
|
ShadowV(t, shAsteroid[m->hitpoints & 7]);
|
||||||
|
if(DIM == 2) t = mmscale(t, 1.15);
|
||||||
|
color_t col = DIM == 3 ? 0xFFFFFF : minf[m->type].color;
|
||||||
|
col <<= 8;
|
||||||
|
queuepoly(t, shAsteroid[m->hitpoints & 7], col | 0xFF);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue