#library "show_coordinates"
#include "zcommon.acs"
#define PLAYER_START_TID 1000
bool COORD_ACTIVE = false;
int x,y; //map coordinates
int sector; //current sector player is in
int line = 0; //line that player is looking at
script 900 ENTER
{
SetFont("SMALLFONT");
While (COORD_ACTIVE)
{
x = GetActorX(0); y = GetActorY (0);
sector = GetPlayerSectorNumber();
//print map coordinates
HudMessage(s:"x:",f:x, s:" ", s:"y:", f:y;
HUDMSG_PLAIN, 1, CR_GREEN,
0.0, 0.0, 5.0 );
//print current sector
if( sector == -1 ) //if player outside of map (clipping)
HudMessage(s:"Sector: Out of Map";
HUDMSG_PLAIN, 2, CR_GREEN,
0.0, 0.1, 5.0 );
else HudMessage(s:"Sector:",d:sector;
HUDMSG_PLAIN, 2, CR_GREEN,
0.0, 0.1, 5.0 );
//print line you are staring at
HudMessage(s:"Line:",d:line;
HUDMSG_PLAIN, 3, CR_GREEN,
0.0, 0.2, 5.0 );
Delay (1);
}
//clear screen of all stats
HudMessage(s:""; HUDMSG_PLAIN, 1, CR_GREEN, 0.0, 0.0, 5.0 );
HudMessage(s:""; HUDMSG_PLAIN, 2, CR_GREEN, 0.0, 0.0, 5.0 );
HudMessage(s:""; HUDMSG_PLAIN, 3, CR_GREEN, 0.0, 0.0, 5.0 );
suspend;
restart;
}
script 901 (void)
{
if( !COORD_ACTIVE )
{
COORD_ACTIVE = true;
ACS_Execute(900,0,0,0,0);
}
else COORD_ACTIVE = false;
}
script 5 ENTER
{
Thing_ChangeTID(0, 1000 + PlayerNumber());
}
//modified from Cjk10000
#define MAX_SECTOR_NUM 1000 //The maximum number of sector ids to check. Bigger numbers may cause runaway terminations in some conditions.
function int GetActorSectorNumber(int tid)
{
for (int s = 0; s <= MAX_SECTOR_NUM; s++)
if (ThingCountSector(T_NONE,PLAYER_START_TID, s) > 0) return s;
return -1; //Returns -1 if no sector tid found.
}
function int GetPlayerSectorNumber(void)
{
for (int s = 0; s <= MAX_SECTOR_NUM; s++)
if (ThingCountSector(T_NONE, PLAYER_START_TID, s) > 0) return s;
return -1; //Returns -1 if no sector tid found.
}Users browsing this forum: No registered users and 4 guests