ID:2304609
 
Applies to:Dream Seeker
Status: Open

Issue hasn't been assigned a status value.
Currently icons are limited to 1 dir, 4 dir, or 8 dirs. It would be nice if we had some more options.

2-dir would be basically "horizontal or vertical". Dirs 3 or 12.

6-dir would be any 2 cardinal dirs combined. So horizontal (12), vertical (3), and the 4 corners. (5,6,9,10)

15-dir would be a bit field not including 0 and 16-dir would be a bit field including 0.

The turn proc would need to be modified. So basically this:

int lookup_table[] = {
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
0,9,6,15,5,1,4,0,15,10,8,2,15,15,15,15,15,
0,8,4,12,1,9,5,13,2,10,6,14,3,11,7,15,
0,10,5,15,9,8,1,15,6,2,4,15,15,15,15,15,
0,2,1,3,8,10,9,11,4,6,5,7,12,14,13,15,
0,6,9,15,10,2,8,15,5,4,1,15,15,15,15,
0,4,8,12,2,6,10,14,1,5,9,13,3,7,11,15,
0,5,10,15,6,4,2,15,9,1,8,15,15,15,15,15};
int turn_dir(int dir, int angle) {
dir = dir & 15;
angle = ((angle % 360 + 360) % 360);
return lookup_table[16*((angle / 90) * 2 + ((angle % 90) == 0 ? 0 : 1)) + dir];
}


Now you have no excuse to not implement this
2-dir 3 and 12 is way less useful than 4 and 8.

6-dir also makes zero sense.

15/16-dir makes zero sense. Dir can only be one of 8 values.

While BYOND dirs are bitflags, the dir value has always been used strictly as a facing direction. It's not designed to handle combination values and there might even be some internal code preventing that (or at least causing some problems with it).

If anything there's a better rationale to expand icons to 6-dir (cardinals plus up and down), 10-dir (diagonals plus up/down), and 26-dir (all possible facing options), but since practically nobody uses up or down dirs and there's no real need to apply them to icons, that'd be wasted effort.
While UP (16) and DOWN (32) do exist in the global constants, they basically don't work with the step, walk, get_step, get_dir global procs, so in effect it'd be partially accurate to say they aren't really implemented in the language in the first place.
They actually do work with get_step() at least. Or did, last I checked. I believe they work with step() too.

I found out about the constants rather by accident when working on Scream of the Stickster, except I was using them backwards (higher Z being down). The code for projectiles actually uses these dirs, so you can shoot up or down. The way to do that is to climb a ladder and then immediately use the opposite direction and hold down the space bar to fire.
I wanted to bump this as I was looking through the forum to see if something like this would or could ever be implemented.

I'm not really sure what the higher 15/16 or directions are for but I can speak a bit on 2-dir.

2-Dir whether it be E/W or N/S would help with games that only want you using 2 directions. What if someone is making a side scroller or a racing game? Right now we have to put a lot of logic in movement to make sure that if facing north or south it retains the last E/W used when it could be handled by the icon itself no?