1
0

smap.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef __SMAP_H
  2. #define __SMAP_H
  3. class SMap;
  4. class SRegion;
  5. #include <tataki/bitmap/bitmap.h>
  6. #include <api/script/script.h>
  7. #ifdef WASABI_WIDGETS_GUIOBJECT
  8. #include <api/script/objects/guiobj.h>
  9. #endif
  10. #include <api/script/objcontroller.h>
  11. #include <api/script/objects/rootobj.h>
  12. // {38603665-461B-42a7-AA75-D83F6667BF73}
  13. static const GUID mapGuid =
  14. { 0x38603665, 0x461b, 0x42a7, { 0xaa, 0x75, 0xd8, 0x3f, 0x66, 0x67, 0xbf, 0x73 } };
  15. #define SMAP_SCRIPTPARENT RootObjectInstance
  16. class MapScriptController : public ScriptObjectControllerI {
  17. public:
  18. virtual const wchar_t *getClassName();
  19. virtual const wchar_t *getAncestorClassName();
  20. virtual ScriptObjectController *getAncestorController();
  21. virtual int getNumFunctions();
  22. virtual const function_descriptor_struct *getExportedFunctions();
  23. virtual GUID getClassGuid();
  24. virtual ScriptObject *instantiate();
  25. virtual void destroy(ScriptObject *o);
  26. virtual void *encapsulate(ScriptObject *o);
  27. virtual void deencapsulate(void *o);
  28. private:
  29. static function_descriptor_struct exportedFunction[];
  30. };
  31. extern MapScriptController *mapController;
  32. class SMap : public SMAP_SCRIPTPARENT {
  33. public:
  34. SMap();
  35. virtual ~SMap();
  36. int getValue(int x, int y);
  37. int getARGBValue(int x, int y, int whichCol);
  38. int inRegion(int x, int y);
  39. int getWidth();
  40. int getHeight();
  41. void loadMap(const wchar_t *b);
  42. static void instantiate(SMap *s);
  43. virtual SkinBitmap *getBitmap() { return bmp; };
  44. SRegion *getSRegion();
  45. private:
  46. SkinBitmap *bmp;
  47. SRegion *reg;
  48. ScriptObject *region_so;
  49. public:
  50. static scriptVar script_vcpu_loadMap(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar bitmap);
  51. static scriptVar script_vcpu_getValue(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y);
  52. static scriptVar script_vcpu_getARGBValue(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y, scriptVar whichCol);
  53. static scriptVar script_vcpu_getWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  54. static scriptVar script_vcpu_getHeight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  55. static scriptVar script_vcpu_inRegion(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y);
  56. static scriptVar script_vcpu_getRegion(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  57. };
  58. #endif