c++ – Legitimate field on sport scene for stalking

[ad_1]

I research code of previous sport for 90s years.

#outline WALL_L 1024
#outline STALK_DIST (WALL_L*3)
#outline WALL_SHIFT 10

static int StalkBox(ITEM_INFO *merchandise, ITEM_INFO *enemy, sint16 box_number)

This perform defines a sound field (box_number) for stalking. For instance tiger (merchandise) stalks most important sport character (enemy). The sport scene is split into packing containers. For exapmle Field.left = 50, Field.proper = 60, Field.high = 40, Field.backside = 50. To seek out out the world coordinates of this field, you want left,proper,high,backside multiply on 1024 (or << 10 shift). box_number is a randomly chosen field, and it’s good to discover out whether it is appropriate for stalk. enemy->pos.z_pos is X coordinate and enemy->pos.x_pos is Z coordinate.

This code makes use of fastened level math.

I dont perceive this code:

enemy_quad = (enemy->pos.y_rot >> 14) + 2;

Right here shift >> 14 appears means division on 90 diploma. However why want add +2?

and as I understood 2 is ahead quadrand towards most important character, however why I dont know? Who can clarify this code extra element?

[ad_2]

Categories:

Leave a Reply

Your email address will not be published. Required fields are marked *