1
0

sregion.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef __SREGION_H
  2. #define __SREGION_H
  3. class SRegion;
  4. #ifndef _NOSTUDIO
  5. #include <tataki/region/region.h>
  6. #include <api/script/objects/smap.h>
  7. #endif
  8. #include <api/script/script.h>
  9. #include <api/script/scriptobj.h>
  10. // {3A370C02-3CBF-439f-84F1-86885BCF1E36}
  11. static const GUID regionGuid =
  12. { 0x3a370c02, 0x3cbf, 0x439f, { 0x84, 0xf1, 0x86, 0x88, 0x5b, 0xcf, 0x1e, 0x36 } };
  13. #define SREGION_SCRIPTPARENT RootObjectInstance
  14. class RegionScriptController : public ScriptObjectControllerI {
  15. public:
  16. virtual const wchar_t *getClassName();
  17. virtual const wchar_t *getAncestorClassName();
  18. virtual ScriptObjectController *getAncestorController();
  19. virtual int getNumFunctions();
  20. virtual const function_descriptor_struct *getExportedFunctions();
  21. virtual GUID getClassGuid();
  22. virtual ScriptObject *instantiate();
  23. virtual void destroy(ScriptObject *o);
  24. virtual void *encapsulate(ScriptObject *o);
  25. virtual void deencapsulate(void *o);
  26. private:
  27. static function_descriptor_struct exportedFunction[];
  28. };
  29. extern RegionScriptController *regionController;
  30. #ifndef _NOSTUDIO
  31. class SRegion : public SREGION_SCRIPTPARENT {
  32. public:
  33. SRegion();
  34. virtual ~SRegion();
  35. int inRegion(int x, int y);
  36. void loadFromMap(SMap *map, int byte, int inv);
  37. void loadFromBitmap(const wchar_t *p);
  38. int getBoundX();
  39. int getBoundY();
  40. int getBoundW();
  41. int getBoundH();
  42. api_region *getRegion();
  43. void addRegion(SRegion *s);
  44. void subRegion(SRegion *s);
  45. void offset(int x, int y);
  46. void stretch(double s);
  47. void copy(SRegion *s);
  48. private:
  49. RegionI *reg;
  50. #else
  51. class SRegion : SREGION_SCRIPTPARENT {
  52. #endif
  53. // FG>
  54. // -- SCRIPT -----------------------------------------------------
  55. public:
  56. static scriptVar script_vcpu_loadFromMap(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar map, scriptVar byte, scriptVar inv);
  57. static scriptVar script_vcpu_loadFromBitmap(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar map);
  58. static scriptVar script_vcpu_inRegion(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y);
  59. static scriptVar script_vcpu_add(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar r);
  60. static scriptVar script_vcpu_sub(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar r);
  61. static scriptVar script_vcpu_offset(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y);
  62. static scriptVar script_vcpu_stretch(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar s);
  63. static scriptVar script_vcpu_copy(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar r);
  64. static scriptVar script_vcpu_getBoundX(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  65. static scriptVar script_vcpu_getBoundY(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  66. static scriptVar script_vcpu_getBoundW(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  67. static scriptVar script_vcpu_getBoundH(SCRIPT_FUNCTION_PARAMS, ScriptObject *o);
  68. };
  69. #endif