Author Topic: Field movement.  (Read 1939 times)

Akari

  • *
  • Posts: 766
    • View Profile
Field movement.
« on: 2007-02-08 09:27:00 »
Earlier info about movement not exactly true.

Quote
typedef {
  char name_of-location[8];
  U32 movement;
  range picture;
  U32 blank;
  range range1;
  U32 blank1[6];
} sec8header`

movement - what direction will character go if you push up, down,left,m right. 128 (0x80) is key-direction (up-up, right-right, down-down, left-left), for 64 (up-right,right-down,down-left,left-up), 32 (up-leftup,right-leftdown,down-rightdown,left-topright)....i dont know how these directions are called.

The real thing is by default movement vector always add Y value when pressed UP. Movement are the angle that shows how much we must rotate movement vector when we try to move. In my case

Code: [Select]
case KEY_UP:    next_step.z =  step; break;
case KEY_DOWN:  next_step.z = -step; break;
case KEY_LEFT:  next_step.x = -step; break;
case KEY_RIGHT: next_step.x =  step; break;

.........

Matrix m;
MatrixRotationY(m, 180.0f * ((float)m_MovementRotation - 32768.0f) / 32768.0f);
Vector4Transform(next_step, next_step, m);