|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- #ifndef __GOATOH__
- #define __GOATOH__
-
- #module \
- Goatoh
-
- #enum LEG_LF = 0
- #enum LEG_RF
- #enum LEG_LH
- #enum LEG_RH
-
- #enum LEG_DIRECTION_FRONT = 1
- #enum LEG_DIRECTION_HIND
-
- #defcfunc local \
- New \
- double p_initPosX,\
- double p_initPosY,\
- int p_initDirection
- posX.insNum = p_initPosX
- posY.insNum = p_initPosY
-
- If Length2 (legArgs) = 0 {
- DDim legArgs, 4, 1
- }
-
- If Length2 (legDirections) = 0 {
- Dim legDirections, 4, 1
- }
-
- legArgs.LEG_LF.insNum = 0.
- legArgs.LEG_RF.insNum = 0.
- legArgs.LEG_LH.insNum = 0.
- legArgs.LEG_RH.insNum = 0.
-
- legDirections.LEG_LF.insNum = LEG_DIRECTION_FRONT
- legDirections.LEG_RF.insNum = LEG_DIRECTION_HIND
- legDirections.LEG_LH.insNum = LEG_DIRECTION_HIND
- legDirections.LEG_RH.insNum = LEG_DIRECTION_FRONT
-
- scale.insNum = 2.
-
- ; 角度
- arg.insNum = 0.
-
- ; 首の角度
- neckArg.insNum = 0.
-
- walkVel.insNum = 3.
- walkAcl.insNum = 0.
-
- runVel.insNum = 5.
- runVel.insNum = 0.
-
- direction.insNum = p_initDirection
-
- walking.insNum = True
- running.insNum = False
- eating.insNum = False
- openingEyes.insNum = False
- openingMouth.insNum = False
-
- frame.insNum = 0
-
- insNum++
-
- Return insNum - 1
-
- #deffunc local \
- Walk \
- int p_insId
- If direction.p_insId = DIRECTION_LEFT {
- posX.p_insId -= walkVel.p_insId * Cos (arg.p_insId)
- posY.p_insId -= walkVel.p_insId * Sin (arg.p_insId)
- }
- Else {
- posX.p_insId += walkVel.p_insId * Cos (arg.p_insId)
- posY.p_insId += walkVel.p_insId * Sin (arg.p_insId)
- }
-
- Repeat 4
- If legDirections.cnt.p_insId = LEG_DIRECTION_FRONT {
- legArgs.cnt.p_insId += Deg2Rad (1)
- }
- Else {
- legArgs.cnt.p_insId -= Deg2Rad (1)
- }
-
- If legArgs.cnt.p_insId > Deg2Rad (15) {
- legDirections.cnt.p_insId = LEG_DIRECTION_HIND
- }
- Else: If legArgs.cnt.p_insId < Deg2Rad (-15) {
- legDirections.cnt.p_insId = LEG_DIRECTION_FRONT
- }
- Loop
-
- Return
-
- #deffunc local \
- DoRun \
- int p_insId
- Return
-
- #deffunc local \
- Eat \
- int p_insId
- Return
-
- #deffunc local \
- Draw
- Repeat insNum
- Pos posX.cnt - scale.cnt * 50, posY.cnt + scale.cnt * 26
- CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_RF.cnt
-
- Pos posX.cnt + scale.cnt * 30, posY.cnt + scale.cnt * 26
- CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_RH.cnt
-
- Pos posX.cnt + scale.cnt * 64, posY.cnt - scale.cnt * 12
- CelPut BUFFER_GOATOH_TAIL, 0, scale.cnt, scale.cnt
-
- Pos posX.cnt, posY.cnt
- CelPut BUFFER_GOATOH_TARSO, 0, scale.cnt, scale.cnt
-
- Pos posX.cnt - scale.cnt * 30, posY.cnt + scale.cnt * 30
- CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_LF.cnt
-
- Pos posX.cnt + scale.cnt * 50, posY.cnt + scale.cnt * 30
- CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_LH.cnt
-
- Pos posX.cnt - scale.cnt * 64, posY.cnt - scale.cnt * 20
- CelPut BUFFER_GOATOH_HEAD, 0, scale.cnt, scale.cnt, neckArg.cnt
-
- Pos posX.cnt - scale.cnt * 64, posY.cnt - scale.cnt * 20
- If openingEyes {
- If openingMouth {
- CelPut BUFFER_GOATOH_FACE_OO, 0, scale.cnt, scale.cnt, neckArg.cnt
- }
- Else {
- CelPut BUFFER_GOATOH_FACE_OC, 0, scale.cnt, scale.cnt, neckArg.cnt
- }
- }
- Else {
- If openingMouth {
- CelPut BUFFER_GOATOH_FACE_CO, 0, scale.cnt, scale.cnt, neckArg.cnt
- }
- Else {
- CelPut BUFFER_GOATOH_FACE_CC, 0, scale.cnt, scale.cnt, neckArg.cnt
- }
- }
- Loop
-
- Interval@Goatoh
-
- Return
-
- #deffunc local \
- Interval
- Repeat insNum
- If walking.cnt {
- Walk@Goatoh cnt
-
- If frame.cnt \ 150 == 30 {
- MMPlay SOUND_MUMUMUMU
-
- openingMouth = True
- }
- }
- Else: If running.cnt {
- DoRun@Goatoh cnt
- }
-
- If eating.cnt {
- Eat@Goatoh cnt
- }
-
- frame.cnt++
- Loop
-
- Return
-
- #global
-
- #endif ; not __GOATOH__
-
|