void AM_initVariables(void) { int pnum; thinker_t *think; //static event_t st_notify = { ev_keyup, AM_MSGENTERED }; automapactive = true; fb = I_VideoBuffer; f_oldloc.x = INT_MAX; amclock = 0; lightlev = 0; m_paninc.x = m_paninc.y = 0; ftom_zoommul = FRACUNIT; mtof_zoommul = FRACUNIT; m_w = FTOM(f_w); m_h = FTOM(f_h); // find player to center on initially if (!playeringame[pnum = consoleplayer]) for (pnum = 0; pnum < maxplayers; pnum++) if (playeringame[pnum]) break; plr = &players[pnum]; oldplr.x = plr->mo->x; oldplr.y = plr->mo->y; m_x = plr->mo->x - m_w / 2; m_y = plr->mo->y - m_h / 2; AM_changeWindowLoc(); // for saving & restoring old_m_x = m_x; old_m_y = m_y; old_m_w = m_w; old_m_h = m_h; // load in the location of keys, if in baby mode // memset(KeyPoints, 0, sizeof(vertex_t)*3); if (gameskill == sk_baby) { for (think = thinkercap.next; think != &thinkercap; think = think->next) { if (think->function != P_MobjThinker) { //not a mobj continue; } } } // inform the status bar of the change //c ST_Responder(&st_notify); }
void AM_activateNewScale(void) { m_x += m_w / 2; m_y += m_h / 2; m_w = FTOM(f_w); m_h = FTOM(f_h); m_x -= m_w / 2; m_y -= m_h / 2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; }
// // AM_doFollowPlayer() // // Turn on follow mode - the map scrolls opposite to player motion // // Passed nothing, returns nothing // void AM_doFollowPlayer(void) { if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y) { m_x = FTOM(MTOF(plr->mo->x)) - m_w/2; m_y = FTOM(MTOF(plr->mo->y)) - m_h/2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; f_oldloc.x = plr->mo->x; f_oldloc.y = plr->mo->y; } }
// // AM_initVariables() // // Initialize the variables for the automap // // Affects the automap global variables // Status bar is notified that the automap has been entered // Passed nothing, returns nothing // void AM_initVariables(void) { int pnum; static event_t st_notify = { ev_keyup, AM_MSGENTERED }; automapactive = true; fb = screens[0]; f_oldloc.x = MAXINT; amclock = 0; lightlev = 0; m_paninc.x = m_paninc.y = 0; ftom_zoommul = FRACUNIT; mtof_zoommul = FRACUNIT; m_w = FTOM(f_w); m_h = FTOM(f_h); // find player to center on initially if (!playeringame[pnum = consoleplayer]) for (pnum=0;pnum<MAXPLAYERS;pnum++) if (playeringame[pnum]) break; plr = &players[pnum]; m_x = plr->mo->x - m_w/2; m_y = plr->mo->y - m_h/2; AM_changeWindowLoc(); // for saving & restoring old_m_x = m_x; old_m_y = m_y; old_m_w = m_w; old_m_h = m_h; // inform the status bar of the change ST_Responder(&st_notify); }
void AM_doFollowPlayer(void) { if (f_oldloc.x != plr->mo->x || f_oldloc.y != plr->mo->y) { // m_x = FTOM(MTOF(plr->mo->x - m_w/2)); // m_y = FTOM(MTOF(plr->mo->y - m_h/2)); // m_x = plr->mo->x - m_w/2; // m_y = plr->mo->y - m_h/2; m_x = FTOM(MTOF(plr->mo->x)) - m_w / 2; m_y = FTOM(MTOF(plr->mo->y)) - m_h / 2; m_x2 = m_x + m_w; m_y2 = m_y + m_h; // do the parallax parchment scrolling. /* dmapx = (MTOF(plr->mo->x)-MTOF(f_oldloc.x)); //fixed point dmapy = (MTOF(f_oldloc.y)-MTOF(plr->mo->y)); if(f_oldloc.x == INT_MAX) //to eliminate an error when the user first dmapx=0; //goes into the automap. mapxstart += dmapx; mapystart += dmapy; while(mapxstart >= finit_width) mapxstart -= finit_width; while(mapxstart < 0) mapxstart += finit_width; while(mapystart >= finit_height) mapystart -= finit_height; while(mapystart < 0) mapystart += finit_height; */ f_oldloc.x = plr->mo->x; f_oldloc.y = plr->mo->y; } }
boolean AM_Responder(event_t * ev) { int rc; int key; static int bigstate = 0; static int joywait = 0; key = ev->data1; rc = false; if (ev->type == ev_joystick && joybautomap >= 0 && (ev->data1 & (1 << joybautomap)) != 0 && joywait < I_GetTime()) { joywait = I_GetTime() + 5; if (!automapactive) { AM_Start (); viewactive = false; } else { bigstate = 0; viewactive = true; AM_Stop (); } } if (!automapactive) { if (ev->type == ev_keydown && key == key_map_toggle && gamestate == GS_LEVEL) { AM_Start(); viewactive = false; // viewactive = true; rc = true; } } else if (ev->type == ev_keydown) { rc = true; if (key == key_map_east) // pan right { if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; } else if (key == key_map_west) // pan left { if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_north) // pan up { if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; } else if (key == key_map_south) // pan down { if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_zoomout) // zoom out { mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; } else if (key == key_map_zoomin) // zoom in { mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; } else if (key == key_map_toggle) // toggle map (tab) { bigstate = 0; viewactive = true; AM_Stop(); } else if (key == key_map_maxzoom) { bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); } else if (key == key_map_follow) { followplayer = !followplayer; f_oldloc.x = INT_MAX; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); } /* else if (key == key_map_grid) { grid = !grid; plr->message = grid ? AMSTR_GRIDON : AMSTR_GRIDOFF; } else if (key == key_map_mark) { M_snprintf(buffer, sizeof(buffer), "%s %d", AMSTR_MARKEDSPOT, markpointnum); plr->message = buffer; AM_addMark(); } else if (key == key_map_clearmark) { AM_clearMarks(); plr->message = AMSTR_MARKSCLEARED; } */ else { rc = false; } if (cheat_amap[cheatcount] == ev->data1 && !netgame) cheatcount++; else cheatcount = 0; if (cheatcount == 6) { cheatcount = 0; rc = false; cheating = (cheating + 1) % 3; } } else if (ev->type == ev_keyup) { rc = false; if (key == key_map_east) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_west) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_north) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_south) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_zoomout || key == key_map_zoomin) { mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; } } return rc; }
boolean AM_Responder (event_t *ev) { int rc; static int cheatstate=0; static int bigstate=0; rc = false; if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY && gamestate == GS_LEVEL) { AM_Start (); SB_state = -1; viewactive = false; rc = true; } } else if (ev->type == ev_keydown) { rc = true; switch(ev->data1) { case AM_PANRIGHTKEY: // pan right if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; break; case AM_PANLEFTKEY: // pan left if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; break; case AM_PANUPKEY: // pan up if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; break; case AM_PANDOWNKEY: // pan down if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; break; case AM_ZOOMOUTKEY: // zoom out mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; break; case AM_ZOOMINKEY: // zoom in mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; break; case AM_ENDKEY: bigstate = 0; viewactive = true; AM_Stop (); SB_state = -1; break; case AM_GOBIGKEY: bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); break; case AM_FOLLOWKEY: followplayer = !followplayer; f_oldloc.x = MAXINT; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); break; default: cheatstate=0; rc = false; } if(cheat_kills[ShowKillsCount] == ev->data1 && netgame && deathmatch) { ShowKillsCount++; if(ShowKillsCount == 5) { ShowKillsCount = 0; rc = false; ShowKills ^= 1; } } else { ShowKillsCount = 0; } } else if (ev->type == ev_keyup) { rc = false; switch (ev->data1) { case AM_PANRIGHTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANLEFTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANUPKEY: if (!followplayer) m_paninc.y = 0; break; case AM_PANDOWNKEY: if (!followplayer) m_paninc.y = 0; break; case AM_ZOOMOUTKEY: case AM_ZOOMINKEY: mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; break; } } return rc; }
boolean AM_Responder (event_t *ev) { int rc; static int cheatstate=0; static int bigstate=0; rc = false; if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == AM_STARTKEY && gamestate == GS_LEVEL) { AM_Start (); viewactive = false; // viewactive = true; rc = true; } } else if (ev->type == ev_keydown) { rc = true; switch(ev->data1) { case AM_PANRIGHTKEY: // pan right if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; break; case AM_PANLEFTKEY: // pan left if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; break; case AM_PANUPKEY: // pan up if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; break; case AM_PANDOWNKEY: // pan down if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; break; case AM_ZOOMOUTKEY: // zoom out mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; break; case AM_ZOOMINKEY: // zoom in mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; break; case AM_ENDKEY: bigstate = 0; viewactive = true; AM_Stop (); break; case AM_GOBIGKEY: bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); break; case AM_FOLLOWKEY: followplayer = !followplayer; f_oldloc.x = MAXINT; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); break; /* case AM_GRIDKEY: grid = !grid; plr->message = grid ? AMSTR_GRIDON : AMSTR_GRIDOFF; break; case AM_MARKKEY: sprintf(buffer, "%s %d", AMSTR_MARKEDSPOT, markpointnum); plr->message = buffer; AM_addMark(); break; case AM_CLEARMARKKEY: AM_clearMarks(); plr->message = AMSTR_MARKSCLEARED; break; */ default: cheatstate=0; rc = false; } if(cheat_amap[cheatcount]==ev->data1 && !netgame) cheatcount++; else cheatcount=0; if(cheatcount==6) { cheatcount=0; rc = false; cheating = (cheating+1) % 3; } } else if (ev->type == ev_keyup) { rc = false; switch (ev->data1) { case AM_PANRIGHTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANLEFTKEY: if (!followplayer) m_paninc.x = 0; break; case AM_PANUPKEY: if (!followplayer) m_paninc.y = 0; break; case AM_PANDOWNKEY: if (!followplayer) m_paninc.y = 0; break; case AM_ZOOMOUTKEY: case AM_ZOOMINKEY: mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; break; } } return rc; }
// // AM_Responder() // // Handle events (user inputs) in automap mode // // Passed an input event, returns true if its handled // boolean AM_Responder ( event_t* ev ) { int rc; static int cheatstate=0; static int bigstate=0; static char buffer[20]; int ch; // phares rc = false; if (!automapactive) { if (ev->type == ev_keydown && ev->data1 == key_map) // phares { AM_Start (); viewactive = false; rc = true; } } else if (ev->type == ev_keydown) { rc = true; ch = ev->data1; // phares if (ch == key_map_right) // | if (!followplayer) // V m_paninc.x = FTOM(F_PANINC); else rc = false; else if (ch == key_map_left) if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; else if (ch == key_map_up) if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; else if (ch == key_map_down) if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; else if (ch == key_map_zoomout) { mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; } else if (ch == key_map_zoomin) { mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; } else if (ch == key_map) { bigstate = 0; viewactive = true; AM_Stop (); } else if (ch == key_map_gobig) { bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); } else if (ch == key_map_follow) { followplayer = !followplayer; f_oldloc.x = MAXINT; // Ty 03/27/98 - externalized plr->message = followplayer ? s_AMSTR_FOLLOWON : s_AMSTR_FOLLOWOFF; } else if (ch == key_map_grid) { automap_grid = !automap_grid; // killough 2/28/98 // Ty 03/27/98 - *not* externalized plr->message = automap_grid ? s_AMSTR_GRIDON : s_AMSTR_GRIDOFF; } else if (ch == key_map_mark) { // Ty 03/27/98 - *not* externalized sprintf(buffer, "%s %d", s_AMSTR_MARKEDSPOT, markpointnum); plr->message = buffer; AM_addMark(); } else if (ch == key_map_clear) { AM_clearMarks(); // Ty 03/27/98 - *not* externalized plr->message = s_AMSTR_MARKSCLEARED; // ^ } // | else // phares { cheatstate=0; rc = false; } } else if (ev->type == ev_keyup) { rc = false; ch = ev->data1; if (ch == key_map_right) { if (!followplayer) m_paninc.x = 0; } else if (ch == key_map_left) { if (!followplayer) m_paninc.x = 0; } else if (ch == key_map_up) { if (!followplayer) m_paninc.y = 0; } else if (ch == key_map_down) { if (!followplayer) m_paninc.y = 0; } else if ((ch == key_map_zoomout) || (ch == key_map_zoomin)) { mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; } } return rc; }
boolean AM_Responder(event_t * ev) { int rc; int key; static int bigstate = 0; static int joywait = 0; key = ev->data1; if (ev->type == ev_joystick && joybautomap >= 0 && (ev->data1 & (1 << joybautomap)) != 0 && joywait < I_GetTime()) { joywait = I_GetTime() + 5; if (!automapactive) { AM_Start (); SB_state = -1; viewactive = false; } else { bigstate = 0; viewactive = true; AM_Stop (); SB_state = -1; } return true; } rc = false; if (!automapactive) { if (ev->type == ev_keydown && key == key_map_toggle && gamestate == GS_LEVEL) { AM_Start(); SB_state = -1; viewactive = false; rc = true; } } else if (ev->type == ev_keydown) { rc = true; if (key == key_map_east) // pan right { if (!followplayer) m_paninc.x = FTOM(F_PANINC); else rc = false; } else if (key == key_map_west) // pan left { if (!followplayer) m_paninc.x = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_north) // pan up { if (!followplayer) m_paninc.y = FTOM(F_PANINC); else rc = false; } else if (key == key_map_south) // pan down { if (!followplayer) m_paninc.y = -FTOM(F_PANINC); else rc = false; } else if (key == key_map_zoomout) // zoom out { mtof_zoommul = M_ZOOMOUT; ftom_zoommul = M_ZOOMIN; } else if (key == key_map_zoomin) // zoom in { mtof_zoommul = M_ZOOMIN; ftom_zoommul = M_ZOOMOUT; } else if (key == key_map_toggle) { bigstate = 0; viewactive = true; AM_Stop(); SB_state = -1; } else if (key == key_map_maxzoom) { bigstate = !bigstate; if (bigstate) { AM_saveScaleAndLoc(); AM_minOutWindowScale(); } else AM_restoreScaleAndLoc(); } else if (key == key_map_follow) { followplayer = !followplayer; f_oldloc.x = INT_MAX; P_SetMessage(plr, followplayer ? AMSTR_FOLLOWON : AMSTR_FOLLOWOFF, true); } else { rc = false; } if (cheat_kills[ShowKillsCount] == ev->data1 && netgame && deathmatch) { ShowKillsCount++; if (ShowKillsCount == 5) { ShowKillsCount = 0; rc = false; ShowKills ^= 1; } } else { ShowKillsCount = 0; } } else if (ev->type == ev_keyup) { rc = false; if (key == key_map_east) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_west) { if (!followplayer) m_paninc.x = 0; } else if (key == key_map_north) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_south) { if (!followplayer) m_paninc.y = 0; } else if (key == key_map_zoomin || key == key_map_zoomout) { mtof_zoommul = FRACUNIT; ftom_zoommul = FRACUNIT; } } return rc; }
void AM_initVariables(void) { int pnum; thinker_t *think; mobj_t *mo; //static event_t st_notify = { ev_keyup, AM_MSGENTERED }; automapactive = true; // fb = screen; f_oldloc.x = MAXINT; amclock = 0; lightlev = 0; m_paninc.x = m_paninc.y = 0; ftom_zoommul = FRACUNIT; mtof_zoommul = FRACUNIT; m_w = FTOM(f_w); m_h = FTOM(f_h); // find player to center on initially if(!players[pnum = consoleplayer].plr->ingame) for(pnum = 0; pnum < MAXPLAYERS; pnum++) if(players[pnum].plr->ingame) break; plr = &players[pnum]; oldplr.x = plr->plr->mo->x; oldplr.y = plr->plr->mo->y; m_x = plr->plr->mo->x - m_w / 2; m_y = plr->plr->mo->y - m_h / 2; AM_changeWindowLoc(); // for saving & restoring old_m_x = m_x; old_m_y = m_y; old_m_w = m_w; old_m_h = m_h; // load in the location of keys, if in baby mode memset(KeyPoints, 0, sizeof(vertex_t) * 3); if(gameskill == sk_baby) { for(think = thinkercap.next; think != &thinkercap; think = think->next) { if(think->function != P_MobjThinker) { //not a mobj continue; } mo = (mobj_t *) think; if(mo->type == MT_CKEY) { KeyPoints[0].x = mo->x; KeyPoints[0].y = mo->y; } else if(mo->type == MT_AKYY) { KeyPoints[1].x = mo->x; KeyPoints[1].y = mo->y; } else if(mo->type == MT_BKYY) { KeyPoints[2].x = mo->x; KeyPoints[2].y = mo->y; } } } // inform the status bar of the change //c ST_Responder(&st_notify); }