チェンジセット 638:f0e586985b62
- コミット日時:
- 2007/09/17 23:26:27 (1 年前)
- ファイル:
-
- GameObj.vcproj (更新) (4 diffs)
- data/polyinfo.ptxt (更新) (1 diff)
- data/resource.txt (更新) (1 diff)
- ico/TaskIco.cpp (更新) (10 diffs)
- scr/Makefile (更新) (2 diffs)
- scr/cscript/cscript.sch (更新) (1 diff)
- scr/cscript/ico.sch (追加)
- scr/ico/ico_app.scs (追加)
- scr/scrsys.mak (更新) (2 diffs)
- scr/sys/scr_ico_app.cc (追加)
- scr/sys/scr_ico_app.h (追加)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
GameObj.vcproj
r630 r638 1039 1039 </File> 1040 1040 <File 1041 RelativePath=".\tool\src\icodata\polyinfo.h" 1042 > 1043 </File> 1044 <File 1041 1045 RelativePath=".\Project.h" 1042 1046 > … … 1115 1119 > 1116 1120 <File 1117 RelativePath=".\tool\src\icodata\polyinfo.h"1118 >1119 </File>1120 <File1121 1121 RelativePath=".\scr\sys\vm_sys_vm.h" 1122 1122 > … … 1143 1143 > 1144 1144 <File 1145 RelativePath=".\scr\sys\scr_ico_app.h" 1146 > 1147 </File> 1148 <File 1145 1149 RelativePath=".\ico\TaskIco.h" 1146 1150 > … … 1150 1154 Name="Source Files" 1151 1155 > 1156 <File 1157 RelativePath=".\scr\sys\scr_ico_app.cc" 1158 > 1159 </File> 1152 1160 <File 1153 1161 RelativePath=".\ico\TaskIco.cpp" data/polyinfo.ptxt
r626 r638 1 scr/ico/ico_app.scb 1 2 res/ico/a03 2 3 res/ico/a04 data/resource.txt
r626 r638 11 11 scr/test/for.scb 12 12 # ico 13 scr/ico/ico_app.scb 13 14 res/ico/a03 14 15 res/ico/a04 ico/TaskIco.cpp
r635 r638 33 33 #include "PackfileManager.h" 34 34 #include "PackfileHandle.h" 35 #pragma warning(push) 36 // 4200:サイズ0の配列 37 // 4819:現在のコードページで表示できない文字を含んでいる 38 #pragma warning(disable : 4200 4819) 39 #include "CScriptVM/vm_loader.h" 40 #include "CScriptVM/vm.h" 41 #pragma warning(pop) 42 #include "scr/sys/scr_ico_app.h" 35 43 #include "../tool/src/icodata/polyinfo.h" 36 44 #include "data/polyinfo.packh" 37 45 38 // TODO デバイス消失時に頂点バッファを作り直す39 40 46 ANON_NAMESPACE_BEGIN 41 47 42 48 class TaskIco; 43 49 50 /*! 51 TaskIco 階層型状態遷移用シグナル 52 */ 44 53 class Event 45 54 : public HsmEventBase<TaskIco, Event> … … 65 74 66 75 76 /*! 77 ICO for Win32 メインタスク 78 */ 67 79 class TaskIco 68 80 : public ITask 69 81 , public ID3DRes 82 , public CScript::ISyscallIcoApp 70 83 , public D3DResBase<TaskIco> 71 84 , public HsmBase<TaskIco, Event> 72 85 { 73 86 public: 87 typedef CScript::vm_float_t vm_float_t; 88 74 89 TaskIco(); 75 90 virtual ~TaskIco(); … … 84 99 virtual void onResetDevice(); 85 100 101 // ISyscallIcoApp 102 virtual void scr_icoSetColor(vm_float_t r, vm_float_t g, vm_float_t b); 103 virtual void scr_icoSetRotSpeed(vm_float_t avec); 104 86 105 private: 106 // 頂点バッファ 87 107 struct CUSTOMVERTEX 88 108 { … … 94 114 PackfileHandle<MEM_SEG_ICO> m_pack; 95 115 int m_load_count; 116 D3DCOLORVALUE m_color; 117 FLOAT m_angle_vel; 96 118 PolyVertList const* m_pPoly; 97 119 CComPtr<IDirect3DVertexBuffer9> m_spVtxBuf; 98 120 FLOAT m_fAngle; 99 121 122 void _initConfig(); 100 123 bool _initModel(); 101 124 void _releaseModel(); … … 117 140 : HsmBase<TaskIco, Event>(&TaskIco::_stateLoad) 118 141 , m_load_count(0) 142 , m_angle_vel(0.0f) 119 143 , m_pPoly(NULL) 120 144 , m_fAngle(0.0f) 121 145 { 122 146 initHsm(); 147 m_color.r = m_color.g = m_color.b = m_color.a = 1.0f; 123 148 } 124 149 125 150 TaskIco::~TaskIco() 126 151 {} 152 153 void TaskIco::scr_icoSetColor(vm_float_t r, vm_float_t g, vm_float_t b) 154 { 155 dbAbortRange(r, 0.0f, 1.0f, _T("color out of range [0.0f, 1.0f]")); 156 dbAbortRange(g, 0.0f, 1.0f, _T("color out of range [0.0f, 1.0f]")); 157 dbAbortRange(b, 0.0f, 1.0f, _T("color out of range [0.0f, 1.0f]")); 158 159 m_color.r = r; 160 m_color.g = g; 161 m_color.b = b; 162 m_color.a = 1.0f; 163 } 164 165 void TaskIco::scr_icoSetRotSpeed(vm_float_t avel) 166 { 167 m_angle_vel = avel; 168 } 127 169 128 170 void TaskIco::exec(ICtxTask& /*ctx*/, TASK_PRIO_TYPE /*prio*/) … … 148 190 } 149 191 192 void TaskIco::_initConfig() 193 { 194 void const* scb = NULL; 195 m_pack.getRes(&scb, SCR_ICO_ICO_APP_SCB); 196 197 CScript::VirtualMachine vm; 198 vm.setScrArgH(0, this); 199 vm.setByteCode(scb, m_pack.getResSize(SCR_ICO_ICO_APP_SCB)); 200 vm.run(); 201 dbAbort(vm.getState() == CScript::VirtualMachine::STATE_HALT, _T("script runtime error : %d"), vm.getState()); 202 } 203 150 204 bool TaskIco::_initModel() 151 205 { 152 206 PolyVertList const* pPoly = NULL; 153 m_pack.getResIdx(&pPoly, 1);207 m_pack.getResIdx(&pPoly, 2); 154 208 155 209 CComPtr<IDirect3DVertexBuffer9> spVtxBuf; … … 181 235 m_pPoly = NULL; 182 236 m_spVtxBuf.Release(); 183 184 237 } 185 238 … … 231 284 D3DMATERIAL9 mtrl; 232 285 ::ZeroMemory(&mtrl, sizeof(mtrl)); 233 mtrl.Diffuse.r = mtrl.Ambient.r = 1.0f; 234 mtrl.Diffuse.g = mtrl.Ambient.g = 1.0f; 235 mtrl.Diffuse.b = mtrl.Ambient.b = 0.0f; 236 mtrl.Diffuse.a = mtrl.Ambient.a = 1.0f; 286 mtrl.Diffuse = mtrl.Ambient = m_color; 237 287 g_d3ddev.SetMaterial(&mtrl); 238 288 … … 282 332 case Event::NSIG_ENTER: 283 333 case Event::NSIG_RESET_DEVICE: 334 _initConfig(); 284 335 _initModel(); 285 336 return 0; … … 293 344 HSM_TRAN(&TaskIco::_stateTerm); 294 345 295 m_fAngle += D3DX_PI/ EXEC_PER_SEC;346 m_fAngle += m_angle_vel / EXEC_PER_SEC; 296 347 if ((padGetRep() & (PAD_SE | PAD_ST)) == (PAD_SE | PAD_ST)) 297 348 HSM_TRAN(&TaskIco::_stateTerm); scr/Makefile
r601 r638 1 1 # Makefile 2 2 3 .PHONY: all sys sysclean test testclean 3 .PHONY: all sys sysclean test testclean ico icoclean 4 4 5 5 TOP=.. 6 6 include $(TOP)/scr/scrcfg.mak 7 7 8 all: sys test 8 define scr-make-target 9 $(MAKE) -C $@ -f ../scrmak.mak TOP=../.. all 10 endef 11 12 define scr-clean-target 13 $(MAKE) -C $@ -f ../scrmak.mak TOP=../.. clean 14 endef 15 16 all: sys test ico 17 18 clean: sysclean testclean icoclean 9 19 10 20 sys: … … 15 25 16 26 test: 17 $( MAKE) -C test -f ../scrmak.mak TOP=../.. all27 $(scr-make-target) 18 28 19 29 testclean: 20 $(MAKE) -C test -f ../scrmak.mak TOP=../.. clean 30 $(scr-clean-target) 31 32 ico: 33 $(scr-make-target) 34 35 icoclean: 36 $(scr-clean-target) 37 scr/cscript/cscript.sch
r601 r638 63 63 #define CSCR_VM_SYSNO_SYSFUNC_TEST_BEGIN CSCR_VM_SYSNO_SYSFUNC_USER_BEGIN 64 64 #define CSCR_VM_SYSNO_SYSFUNC_TEST_COUNT (32) 65 #define CSCR_VM_SYSNO_SYSFUNC_TEST_END (CSCR_VM_SYSNO_SYSFUNC_USER_BEGIN + CSCR_VM_SYSNO_SYSFUNC_USER_COUNT - 1) 65 #define CSCR_VM_SYSNO_SYSFUNC_TEST_END (CSCR_VM_SYSNO_SYSFUNC_USER_BEGIN + CSCR_VM_SYSNO_SYSFUNC_TEST_COUNT - 1) 66 67 #define CSCR_VM_SYSNO_SYSFUNC_ICO_BEGIN (CSCR_VM_SYSNO_SYSFUNC_TEST_END + 1) 68 #define CSCR_VM_SYSNO_SYSFUNC_ICO_COUNT (32) 69 #define CSCR_VM_SYSNO_SYSFUNC_ICO_END (CSCR_VM_SYSNO_SYSFUNC_ICO_BEGIN + CSCR_VM_SYSNO_SYSFUNC_ICO_COUNT - 1) 66 70 67 71 #endif // CSCRIPT_CSCRIPT_SCH__INCLUDED scr/scrsys.mak
r601 r638 6 6 include $(TOP)/scr/scrcfg.mak 7 7 8 all: vm_sys_vm.h vm_sys_d.cc scr_stdfunc.cc 9 pwd 8 define scr_sys_target 9 $(CPP) $(CPPFLAGS) $< | $(SYSDECL) > $@ 10 endef 11 12 all: vm_sys_vm.h vm_sys_d.cc scr_stdfunc.cc scr_ico_app.cc scr_ico_app.h 10 13 11 14 vm_sys_vm.h: vm_sys_d.cc … … 15 18 16 19 scr_stdfunc.cc: $(SCRDIR)/cscript/stdfunc.sch 17 $(CPP) $(CPPFLAGS) $< | $(SYSDECL) > $@ 20 $(scr_sys_target) 21 22 scr_ico_app.h: scr_ico_app.cc 23 24 scr_ico_app.cc: $(SCRDIR)/cscript/ico.sch 25 $(scr_sys_target) 18 26 19 27 clean: 20 $(RM) vm_sys_vm.h vm_sys_d.cc scr_stdfunc.cc 28 $(RM) vm_sys_vm.h vm_sys_d.cc scr_stdfunc.cc scr_ico_app.cc scr_ico_app.h 21 29 22 30
