Advertisement
Kitomas

tile.hpp as of 2024-04-12

Apr 12th, 2024
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.15 KB | None | 0 0
  1. #ifndef _TILE_HPP
  2. #define _TILE_HPP
  3.  
  4. #include <globals.hpp>
  5.  
  6.  
  7.  
  8.  
  9.  
  10. struct Tile {
  11.   kit::u16        id : 7;
  12.  
  13.   kit::u16   tileset : 1; //whether to use tileset a or b
  14.  
  15.   kit::u16 collide_a : 1; //'collide with top-left 12x12 section of tile?'
  16.   kit::u16 collide_b : 1; //'collide with top-right 12x12 section of tile?'
  17.   kit::u16 collide_c : 1; //'collide with bottom-left 12x12 section of tile?'
  18.   kit::u16 collide_d : 1; //'collide with bottom-right 12x12 section of tile?'
  19.  
  20.   kit::u16      pass : 1; //allow passing through tile
  21.   kit::u16  platform : 1; //allow falling through top side of tile conditionally
  22.  
  23.   kit::u16   _unused : 2;
  24. };
  25.  
  26.  
  27.  
  28.  
  29.  
  30. struct Object;
  31.  
  32. typedef void (*Object_TickCallback)(Object* obj_a);
  33.  
  34. struct Object {
  35.   kit::u32 type;
  36.   kit::u32    _;
  37.   Object_TickCallback funcUpdate;
  38. };
  39.  
  40.  
  41.  
  42.  
  43.  
  44. //uncompressed scene data
  45. struct Scene { //64B
  46.   //pat is memory::alloc'd, bmp is not
  47.   kit::Bitmap* bmp_bg = nullptr; //bitmap for background layer
  48.   Tile*        pat_mg = nullptr; //pattern for midground (collision) layer
  49.   Tile*        pat_fg = nullptr; //pattern for foreground layer (skipped if nullptr)
  50.   //(length of pat_<mg/fg> is [TILESIZ_X*TILESIZ_Y])
  51.  
  52.   //these two are memory::alloc'd too
  53.   Object*  objs          = nullptr; //pointer to associated object array,
  54.   Object*  objs_original = nullptr;  //and whatever its original state was
  55.   kit::u16 objs_len      = 0;
  56.  
  57.   kit::u16 edge_n; //scene id for north edge
  58.   kit::u16 edge_s; //scene id for south edge
  59.   kit::u16 edge_w; //scene id for west edge
  60.   kit::u16 edge_e; //scene id for east edge
  61.  
  62.   kit::u16     music; //music id;  0 for no change, -1 (65535) to stop
  63.   kit::u16 ambient_a; //ambient track id a;  0 for no change, -1 to stop
  64.   kit::u16 ambient_b; //ambient track id b;  0 for no change, -1 to stop
  65.  
  66.   kit::u16  tileset_a; //1st associated tileset
  67.   kit::u16  tileset_b; //2nd associated tileset
  68.   bool visited_before; //used to reset object and npc properties between deaths
  69.   bool     stretch_bg; //'stretch the bg over the entire screen?' (repeats otherwise)
  70.  
  71.   kit::u8 _padding8[2];
  72.  
  73.  
  74.   void drawBg();
  75. };
  76.  
  77.  
  78.  
  79.  
  80.  
  81. #endif /* _TILE_HPP */
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement