Add on programmed by Vatiken
This snippet allows objects, npcs, and players to be seen on the map.
1.open asciimap
2. near the defines add
Code:
#define SECT_PC (SECT_HERE + 1)
#define SECT_NPC (SECT_PC + 1)
#define SECT_OBJ (SECT_NPC + 1)
#define MAP_MODE_NONE 0
#define MAP_MODE_CHARS 1
#define MAP_MODE_OBJS 2
#define MAP_MODE_HIDDEN 3
#define MAP_MODE_ALL 4
3. find map_info and add
Code:
{ SECT_PC, "\tc[\tR*\tc]\tn" },
{ SECT_NPC, "\tc[\tM*\tc]\tn" },
{ SECT_OBJ, "\tc[\tY*\tc]\tn" }
4. find world_map_find and add:
Code:
{ SECT_PC, "\tc[\tR*\tc]\tn" },
{ SECT_NPC, "\tc[\tM*\tc]\tn" },
{ SECT_OBJ, "\tc[\tY*\tc]\tn" }
5. find void MapArea and under sh_int prospect_xpos, prospect_ypos; and
Code:
struct char_data *tch;
struct obj_data *obj;
int found = 0;
int mode = MAP_MODE_ALL;
find:
Code:
if(room == IN_ROOM(ch))
map[x][y] = SECT_HERE;
else
map[x][y] = SECT(room);
under it add:
Code:
/* Search Room For Characters*/
if (mode == MAP_MODE_ALL || mode == MAP_MODE_CHARS) {
for (tch = world[room].people; tch; tch = tch->next_in_room) {
/* If not displaying world map and "tch" is within field of vision, display. -JA */
/* Field of Vision: The player is located at 25, 25 and the map draws out tiles from there. */
/* The following line displays PC/NPCs within 3 tiles EAST/WEST of the PC, and 3 tiles NORTH/SOUTH */
/* It works out to approximately 1 room... this is designed to keep NPCs from cluttering the map in largely*/
/* populated areas. */
if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) {
if (!CAN_SEE(ch, tch)) /* Can't see? Ignore */
continue;
if (!IS_NPC(tch)) {
map[x][y] = SECT_PC; /* Assign MAP tile to SECT_PC */
break; /* If we find a PC, then we break the loop */
} else
map[x][y] = SECT_NPC; /* Assign MAP tile to SECT_NPC, and continue the loop */
found++; /* Mark found so that a PC/NPC will take priority over objects */
}
}
}
if (mode == MAP_MODE_ALL || mode == MAP_MODE_OBJS) {
/* If we already found a PC or NPC ignore loop, else continue to search for objects */
for (obj = world[room].contents; obj && !found; obj = obj->next_content) {
/* Once again, only search if not worldmap, and within field of view */
if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) {
map[x][y] = SECT_OBJ; /* Mark MAP as SECT_OBJ */
found++; /* Mark found and break loop... kinda redundant*/
break;
}
}
}
Now my question is how to increase the line of sight which is this line
Code:
if (!worldmap && x < 28 && x > 22 && y < 28 && y > 22) {