DragonsLover
April 26th, 2011, 16:44
Danrhan, a good old programmer friend on DK.net, has found something to be checked.
There's probably a mistake on the "range" of the Action Points which is an unsigned short.
In a standard AP file, the range is a value between 0 and 10. This value is multiplied by 32 in the game for the size of the tiles in the game. This gives a radius from 16 to 320.
In the level editor, we can adjust the range of the Action Point pixel by pixel, but if the two bytes are considered as a word, the range may become huge!
For example : if the range equals 5, this gives a radius of 160 pixels. No problem if the second byte is 0.
However, if the range equals 4.5... the second byte is not 0 and then, the radius is way larger. This may causes the action point to be triggered even if our creatures don't reach it.
Mefisto, could you confirm this?
Here's what Danrhan thinks it should be:
Area = (Range*32) - Minus;
Actually in KeeperFX:
struct InitActionPoint { // sizeof = 8
struct Coord2d mappos;
unsigned short range;
unsigned short num;
};Modified KeeperFX:
struct InitActionPoint { // sizeof = 8
struct Coord2d mappos;
byte range;
byte minus;
unsigned short num;
};
There's probably a mistake on the "range" of the Action Points which is an unsigned short.
In a standard AP file, the range is a value between 0 and 10. This value is multiplied by 32 in the game for the size of the tiles in the game. This gives a radius from 16 to 320.
In the level editor, we can adjust the range of the Action Point pixel by pixel, but if the two bytes are considered as a word, the range may become huge!
For example : if the range equals 5, this gives a radius of 160 pixels. No problem if the second byte is 0.
However, if the range equals 4.5... the second byte is not 0 and then, the radius is way larger. This may causes the action point to be triggered even if our creatures don't reach it.
Mefisto, could you confirm this?
Here's what Danrhan thinks it should be:
Area = (Range*32) - Minus;
Actually in KeeperFX:
struct InitActionPoint { // sizeof = 8
struct Coord2d mappos;
unsigned short range;
unsigned short num;
};Modified KeeperFX:
struct InitActionPoint { // sizeof = 8
struct Coord2d mappos;
byte range;
byte minus;
unsigned short num;
};