3d:: refactored the hide_player function

This commit is contained in:
Zeno Rogue 2019-03-09 15:31:02 +01:00
parent 9f9670fcdb
commit 55c31ec645
3 changed files with 15 additions and 9 deletions

View File

@ -14,6 +14,10 @@ bool mmspatial, mmhigh, mmmon, mmitem;
int detaillevel = 0;
bool hide_player() {
return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5;
}
hookset<bool(int sym, int uni)> *hooks_handleKey;
hookset<bool(cell *c, const transmatrix& V)> *hooks_drawcell;
purehookset hooks_frame, hooks_markers;
@ -2332,8 +2336,7 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col) {
drawPlayerEffects(Vs, c, true);
if(!mmmon) return true;
if(DIM == 3 && playermoved && vid.sspeed > -5 && vid.yshift == 0) {
/* FPP -- do not draw the player */
if(hide_player()) {
}
else if(isWorm(m)) {
@ -3888,7 +3891,7 @@ int get_darkval(int d) {
void drawBoat(cell *c, const transmatrix* Vboat, transmatrix& Vboat0, transmatrix& V) {
double footphase;
if(c == cwt.at && playermoved && vid.sspeed > -5 && vid.yshift == 0) return;
if(c == cwt.at && hide_player()) return;
bool magical = items[itOrbWater] && (isPlayerOn(c) || (isFriendly(c) && items[itOrbEmpathy]));
int outcol = magical ? watercolor(0) : 0xC06000FF;
int incol = magical ? 0x0060C0FF : 0x804000FF;

View File

@ -3226,6 +3226,7 @@ bool haveMobileCompass();
bool handleCompass();
inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && DIM == 3; }
bool hide_player();
int cellcolor(cell *c);
transmatrix screenpos(ld x, ld y);
extern ld backbrightness;

View File

@ -3463,13 +3463,15 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans
switch(m->type) {
case moPlayer:
playerfound = true;
if(playermoved && DIM == 3 && vid.yshift == 0 && vid.sspeed > -5) continue;
cpid = m->pid;
if(DIM == 3) view = view * spin(-M_PI/2);
drawPlayerEffects(view, c, true);
if(m->inBoat) m->footphase = 0;
if(mapeditor::drawplayer) drawMonsterType(moPlayer, c, view, 0xFFFFFFC0, m->footphase);
if(!hide_player()) {
if(DIM == 3) view = view * spin(-M_PI/2);
drawPlayerEffects(view, c, true);
if(m->inBoat) m->footphase = 0;
if(mapeditor::drawplayer) drawMonsterType(moPlayer, c, view, 0xFFFFFFC0, m->footphase);
}
if(keyresult[cpid]) {
hyperpoint h = keytarget(cpid);
queuechr(h, vid.fsize, '+', iinf[keyresult[cpid]].color);