Don't like ads? PRO users don't see any ads ;-)
Guest

ASM header

By: Dekowta on Jul 29th, 2012  |  syntax: C  |  size: 2.81 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // file:        Black Paw Collision
  3. //
  4. // summary:     some basic collision checking mechanics
  5. //                      they are written in asm to provide a fast frame
  6. //                      work for collision detection
  7. ////////////////////////////////////////////////////////////////////////////////////////////////////
  8.  
  9. #ifndef BP_COLLISION_H
  10. #define BP_COLLISION_H
  11.  
  12. #include "BP_ToolSet.h"
  13.  
  14. ////////////////////////////////////////////////////////////////////////////////////////////////////
  15. // <summary>    Collision Type structures. </summary>
  16. //
  17. // <remarks>    Chris, 07/06/2012. </remarks>
  18. ////////////////////////////////////////////////////////////////////////////////////////////////////
  19.  
  20. //Cube/Rectangle collision type
  21. typedef struct Ccube
  22. {
  23.         unsigned short x;
  24.         unsigned short y;
  25.         unsigned short width;
  26.         unsigned short height;
  27. }Ccube;
  28.  
  29. //Circle collision type
  30. typedef struct Ccircle
  31. {
  32.         unsigned short x;
  33.         unsigned short y;
  34.         unsigned short Radius;
  35. }ALIGN(4) Ccircle;
  36.  
  37.  
  38.  
  39. //This is most likely the wrong method to do this but I need a
  40. //data store for the map collision function and with only 8
  41. //registers it starts to get a little cramped
  42. //this struct just stores the x and y of where the collison was triggered
  43. typedef struct  Cpos
  44. {
  45.         unsigned short bottom;
  46.         unsigned short BoolBottom; //not sure what data size a bool is and also to lazy to manage the change in data size
  47.         unsigned short Top;
  48.         unsigned short BoolTop;
  49.         unsigned short Left;
  50.         unsigned short BoolLeft;
  51.         unsigned short Right;
  52.         unsigned short BoolRight;
  53. }Cpos;
  54.  
  55. Cpos CollisionPos;
  56.  
  57. ////////////////////////////////////////////////////////////////////////////////////////////////////
  58. // <summary>    Collision Detection between two Ccube objects
  59. //                              Uses AABB collision formula and written in ARM Thumb. </summary>
  60. //
  61. // <remarks>    Chris, 07/06/2012. </remarks>
  62. ////////////////////////////////////////////////////////////////////////////////////////////////////
  63.  
  64. bool BP_CIntersectBox(Ccube* a, Ccube* b);
  65.  
  66. ////////////////////////////////////////////////////////////////////////////////////////////////////
  67. // <summary>    Collision Detection between two Ccircle type
  68. //                              objects. </summary>
  69. //
  70. // <remarks>    Chris, 07/06/2012. </remarks>
  71. ////////////////////////////////////////////////////////////////////////////////////////////////////
  72.  
  73. bool BP_CIntersectCircle(Ccircle* a, Ccircle* b);
  74.  
  75. ////////////////////////////////////////////////////////////////////////////////////////////////////
  76. // <summary>    Collision Detection between The map and a Ccube object. </summary>
  77. //
  78. // <remarks>    Chris, 08/06/2012. </remarks>
  79. ////////////////////////////////////////////////////////////////////////////////////////////////////
  80.  
  81. bool BP_CMapBox(MapAtt* MapData, Ccube* Obj);
  82.  
  83. #endif