| @@ -1,6 +1,7 @@ | |||
| #include "hsp3dish.as" | |||
| #include "config.hsp" | |||
| ; 画面サイズ | |||
| #const global DISPLAY_WIDTH 1080 | |||
| #const global DISPLAY_HEIGHT 1920 | |||
| @@ -17,6 +18,8 @@ | |||
| #enum global BUFFER_NIZIKA ; ニジカ | |||
| #enum global BUFFER_BG ; https://www.pakutaso.com/20190249044post-18819.html | |||
| #enum global BUFFER_CHAR ; 文字セット | |||
| #enum global BUFFER_NAME_DIALOGUE ; 名前入力欄 | |||
| #enum global BUFFER_BUTTON_OK ; OK ボタン | |||
| ; サウンド | |||
| #enum global SOUND_MUMUMUMU = 0 ; ムムムム | |||
| @@ -30,21 +33,23 @@ | |||
| #const global FPS 30 | |||
| #const global LOOP_INTERVAL 1000 / FPS | |||
| #include "./modules/goatoh.mod.hsp" | |||
| #include "./modules/chat.mod.hsp" | |||
| #include "./modules/char.mod.hsp" | |||
| #include "./modules/keyboard.mod.hsp" | |||
| #include "./modules/setting.mod.hsp" | |||
| #include "./modules/name_dialogue.mod.hsp" | |||
| #ifdef _DEBUG | |||
| Screen 0, 540, 960 | |||
| ; デバッグ時は assets ディレクトリを参照する. | |||
| ChDir "assets" | |||
| ChDir "/users/matud/projects/goatoh_training_android/assets" | |||
| #endif ; _DEBUG | |||
| Font MSGOTHIC, 96 | |||
| Randomize | |||
| ViewCalc VPTYPE_2D, Double (gInfo_winX) / DISPLAY_WIDTH, Double (gInfo_winY) / DISPLAY_HEIGHT | |||
| @@ -71,11 +76,19 @@ | |||
| CelLoad "goatoh-tarso.png", BUFFER_GOATOH_TARSO | |||
| CelDiv BUFFER_GOATOH_TARSO, 0, 0, 97, 49 | |||
| ; 文字 | |||
| CelLoad "font.png", BUFFER_CHAR | |||
| CelDiv BUFFER_CHAR, 32, 35, 0, 0 | |||
| ; 名前入力ダイアログ | |||
| CelLoad "name-dialogue.png", BUFFER_NAME_DIALOGUE | |||
| ; OK ボタン | |||
| CelLoad "button-ok.png", BUFFER_BUTTON_OK | |||
| CelDiv BUFFER_BUTTON_OK, Null, Null, SIZE_X@MyButton / 2, SIZE_Y@MyButton / 2 | |||
| ; ゴートうインスタンス生成 | |||
| Goatoh = New@Goatoh (960, 800, DIRECTION_LEFT) | |||
| Goatoh = New@Goatoh (Rnd (1080), Rnd (1920), Rnd (2) + 1) | |||
| ; 設定読込み | |||
| Load@Setting | |||
| @@ -90,23 +103,17 @@ | |||
| GMode GMODE_RGB0 ; アルファあり | |||
| Show@Keyboard | |||
| Pos 100, 100 | |||
| Text = New@Char ("") | |||
| size@Char.Text = 240 | |||
| Show@NameDialogue | |||
| Repeat | |||
| ReDraw False | |||
| Pos 0, 0 | |||
| CelPut BUFFER_BG, 0, Double (DISPLAY_HEIGHT) / 533, Double (DISPLAY_HEIGHT) / 533 | |||
| Draw@Goatoh Goatoh | |||
| Draw@Char | |||
| Draw@Goatoh | |||
| Draw@Keyboard | |||
| Print GetChar@Keyboard () != False | |||
| text@Char.Text = text@Keyboard | |||
| Draw@NameDialogue | |||
| Draw@Char | |||
| ReDraw True | |||
| Await LOOP_INTERVAL | |||
| @@ -1,3 +1,6 @@ | |||
| #ifndef __CHAR__ | |||
| #define __CHAR__ | |||
| #module \ | |||
| Char | |||
| @@ -6,6 +9,8 @@ Char | |||
| #defcfunc local \ | |||
| New \ | |||
| int p_posX,\ | |||
| int p_posY,\ | |||
| str p_text | |||
| If insNum <= 0 { | |||
| SDim charDict, 384 | |||
| @@ -16,8 +21,8 @@ New \ | |||
| text.insNum = p_text | |||
| posX.insNum = gInfo_cX | |||
| posY.insNum = gInfo_cY | |||
| posX.insNum = p_posX | |||
| posY.insNum = p_posY | |||
| size.insNum = CHAR_WIDTH | |||
| exists.insNum = True | |||
| @@ -29,7 +34,7 @@ New \ | |||
| #deffunc local \ | |||
| Destroy \ | |||
| int p_insId | |||
| exists.insNum = False | |||
| exists.p_insId = False | |||
| Return | |||
| @@ -100,3 +105,5 @@ MyStrMid \ | |||
| #global | |||
| #endif ; not __CHAR__ | |||
| @@ -1,3 +1,6 @@ | |||
| #ifndef __CHAT__ | |||
| #define __CHAT__ | |||
| #module \ | |||
| Chat | |||
| @@ -23,3 +26,5 @@ Send \ | |||
| #global | |||
| #endif ; not __CHAT__ | |||
| @@ -0,0 +1,41 @@ | |||
| #ifndef __DIALOGUE__ | |||
| #define __DIALOGUE__ | |||
| #module \ | |||
| Dialogue | |||
| #const DIALOGUE_WIDTH 840 | |||
| #const DIALOGUE_HEIGHT 600 | |||
| #const DIALOGUE_TOP 360 | |||
| #const DIALOGUE_BOTTOM (DIALOGUE_TOP + DIALOGUE_HEIGHT) | |||
| #const DIALOGUE_LEFT ((DISPLAY_WIDTH - DIALOGUE_WIDTH) / 2) | |||
| #const DIALOGUE_RIGHT ((DISPLAY_WIDTH + DIALOGUE_WIDTH) / 2) | |||
| #deffunc local \ | |||
| Show | |||
| showing = True | |||
| Return | |||
| #deffunc local \ | |||
| Hide | |||
| showing = False | |||
| Return | |||
| #deffunc local \ | |||
| Draw | |||
| If showing = False { | |||
| Return | |||
| } | |||
| Pos DIALOGUE_LEFT, DIALOGUE_TOP | |||
| CelPut bufferId | |||
| Return | |||
| #global | |||
| #endif ; not __DIALOGUE__ | |||
| @@ -104,72 +104,74 @@ Eat \ | |||
| Return | |||
| #deffunc local \ | |||
| Draw \ | |||
| int p_insId | |||
| Pos posX.p_insId - scale.p_insId * 50, posY.p_insId + scale.p_insId * 26 | |||
| CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_RF.p_insId | |||
| 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.p_insId + scale.p_insId * 30, posY.p_insId + scale.p_insId * 26 | |||
| CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_RH.p_insId | |||
| 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.p_insId + scale.p_insId * 64, posY.p_insId - scale.p_insId * 12 | |||
| CelPut BUFFER_GOATOH_TAIL, 0, scale.p_insId, scale.p_insId | |||
| Pos posX.cnt + scale.cnt * 64, posY.cnt - scale.cnt * 12 | |||
| CelPut BUFFER_GOATOH_TAIL, 0, scale.cnt, scale.cnt | |||
| Pos posX.p_insId, posY.p_insId | |||
| CelPut BUFFER_GOATOH_TARSO, 0, scale.p_insId, scale.p_insId | |||
| Pos posX.cnt, posY.cnt | |||
| CelPut BUFFER_GOATOH_TARSO, 0, scale.cnt, scale.cnt | |||
| Pos posX.p_insId - scale.p_insId * 30, posY.p_insId + scale.p_insId * 30 | |||
| CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_LF.p_insId | |||
| 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.p_insId + scale.p_insId * 50, posY.p_insId + scale.p_insId * 30 | |||
| CelPut BUFFER_GOATOH_LEG, 0, scale.p_insId, scale.p_insId, legArgs.LEG_LH.p_insId | |||
| 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.p_insId - scale.p_insId * 64, posY.p_insId - scale.p_insId * 20 | |||
| CelPut BUFFER_GOATOH_HEAD, 0, scale.p_insId, scale.p_insId, neckArg.p_insId | |||
| Pos posX.cnt - scale.cnt * 64, posY.cnt - scale.cnt * 20 | |||
| CelPut BUFFER_GOATOH_HEAD, 0, scale.cnt, scale.cnt, neckArg.cnt | |||
| Pos posX.p_insId - scale.p_insId * 64, posY.p_insId - scale.p_insId * 20 | |||
| If openingEyes { | |||
| If openingMouth { | |||
| CelPut BUFFER_GOATOH_FACE_OO, 0, scale.p_insId, scale.p_insId, neckArg.p_insId | |||
| } | |||
| Else { | |||
| CelPut BUFFER_GOATOH_FACE_OC, 0, scale.p_insId, scale.p_insId, neckArg.p_insId | |||
| } | |||
| } | |||
| Else { | |||
| If openingMouth { | |||
| CelPut BUFFER_GOATOH_FACE_CO, 0, scale.p_insId, scale.p_insId, neckArg.p_insId | |||
| 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 { | |||
| CelPut BUFFER_GOATOH_FACE_CC, 0, scale.p_insId, scale.p_insId, neckArg.p_insId | |||
| 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 p_insId | |||
| Interval@Goatoh | |||
| Return | |||
| #deffunc local \ | |||
| Interval \ | |||
| int p_insId | |||
| If walking.p_insId { | |||
| Walk@Goatoh p_insId | |||
| Interval | |||
| Repeat insNum | |||
| If walking.cnt { | |||
| Walk@Goatoh cnt | |||
| If frame.p_insId \ 150 == 30 { | |||
| MMPlay SOUND_MUMUMUMU | |||
| If frame.cnt \ 150 == 30 { | |||
| MMPlay SOUND_MUMUMUMU | |||
| openingMouth = True | |||
| openingMouth = True | |||
| } | |||
| } | |||
| Else: If running.cnt { | |||
| DoRun@Goatoh cnt | |||
| } | |||
| } | |||
| Else: If running.p_insId { | |||
| DoRun@Goatoh p_insId | |||
| } | |||
| If eating.p_insId { | |||
| Eat@Goatoh p_insId | |||
| } | |||
| If eating.cnt { | |||
| Eat@Goatoh cnt | |||
| } | |||
| frame.p_insId++ | |||
| frame.cnt++ | |||
| Loop | |||
| Return | |||
| @@ -1,3 +1,9 @@ | |||
| #include "./modules/char.mod.hsp" | |||
| #ifndef __KEYBOARD__ | |||
| #define __KEYBOARD__ | |||
| #module \ | |||
| Keyboard | |||
| @@ -14,10 +20,10 @@ Hide | |||
| Return | |||
| #defcfunc local \ | |||
| #deffunc local \ | |||
| GetChar | |||
| if showing = False { | |||
| Return "" | |||
| Return | |||
| } | |||
| MTList getChar_id | |||
| @@ -25,17 +31,23 @@ GetChar | |||
| If stat = 0 { | |||
| touching = False | |||
| Return "" | |||
| Return | |||
| } | |||
| If touching { | |||
| Return "" | |||
| Return | |||
| } | |||
| MTInfo getChar_touchInfo, getChar_id.0 | |||
| touching = True | |||
| If Length (getChar_touchInfo) < 4 { | |||
| Return | |||
| } | |||
| If getChar_touchInfo.2 < 1920 - 480 { | |||
| Return "" | |||
| Return | |||
| } | |||
| getChar_charId = (1080 - getChar_touchInfo.1) / 96 * 5 + (getChar_touchInfo.2 - (1920 - 480)) / 96 | |||
| @@ -45,9 +57,7 @@ GetChar | |||
| Poke text, getChar_textLength + cnt, Peek (charDict@Char, getChar_charId * 3 + cnt) | |||
| Loop | |||
| touching = True | |||
| Return "" | |||
| Return | |||
| #deffunc local \ | |||
| Draw | |||
| @@ -67,3 +77,5 @@ Draw | |||
| #global | |||
| #endif ; not __KEYBOARD__ | |||
| @@ -0,0 +1,96 @@ | |||
| #ifndef __MY_BUTTON__ | |||
| #define __MY_BUTTON__ | |||
| #module \ | |||
| MyButton | |||
| #const SIZE_X 240 | |||
| #const SIZE_Y 120 | |||
| #const ZOOM 0.8 | |||
| #defcfunc local \ | |||
| New \ | |||
| int p_posX,\ | |||
| int p_posY,\ | |||
| int p_bufferId,\ | |||
| label p_onClicked | |||
| posX.insNum = p_posX | |||
| posY.insNum = p_posY | |||
| bufferId.insNum = p_bufferId | |||
| onClicked.insNum = p_onClicked | |||
| touching.insNum = False | |||
| exists.insNum = True | |||
| insNum++ | |||
| Return insNum - 1 | |||
| #deffunc local \ | |||
| Destroy \ | |||
| int p_insId | |||
| exists.p_insId = False | |||
| Return | |||
| #deffunc local \ | |||
| Interval \ | |||
| int p_insId,\ | |||
| local l_id,\ | |||
| local l_touchInfo | |||
| MTList l_id | |||
| If stat = 0 { | |||
| touching.p_insId = False | |||
| Return | |||
| } | |||
| If touching.p_insId { | |||
| Return | |||
| } | |||
| MTInfo l_touchInfo, l_id.0 | |||
| touching.p_insId = True | |||
| If l_touchInfo.1 < posX.p_insId - ZOOM * SIZE_X / 2 { | |||
| Return | |||
| } | |||
| If l_touchInfo.1 >= posX.p_insId + ZOOM * SIZE_X / 2 { | |||
| Return | |||
| } | |||
| If l_touchInfo.2 < posY.p_insId - ZOOM * SIZE_Y / 2 { | |||
| Return | |||
| } | |||
| If l_touchInfo.2 >= posY.p_insId + ZOOM * SIZE_Y / 2 { | |||
| Return | |||
| } | |||
| GoSub onClicked.p_insId | |||
| Return | |||
| #deffunc local \ | |||
| Draw | |||
| Repeat insNum | |||
| If exists.cnt = False { | |||
| Continue | |||
| } | |||
| Pos posX.cnt, posY.cnt | |||
| CelPut bufferId.cnt, 0, ZOOM, ZOOM | |||
| Loop | |||
| Interval | |||
| Return | |||
| #global | |||
| #endif ; not __MY_BUTTON__ | |||
| @@ -0,0 +1,67 @@ | |||
| #include "./modules/dialogue.mod.hsp" | |||
| #include "./modules/my_button.mod.hsp" | |||
| #include "./modules/keyboard.mod.hsp" | |||
| #include "./modules/char.mod.hsp" | |||
| #include "./modules/user.mod.hsp" | |||
| #ifndef __NAME_DIALOGUE__ | |||
| #define __NAME_DIALOGUE__ | |||
| #module \ | |||
| NameDialogue | |||
| #const DIALOGUE_TOP DIALOGUE_TOP@Dialogue | |||
| #const DIALOGUE_BOTTOM DIALOGUE_BOTTOM@Dialogue | |||
| #const DIALOGUE_LEFT DIALOGUE_LEFT@Dialogue | |||
| #const DIALOGUE_RIGHT DIALOGUE_RIGHT@Dialogue | |||
| #deffunc local \ | |||
| Show | |||
| ButtonOk = New@MyButton (DISPLAY_WIDTH / 2, DIALOGUE_BOTTOM@Dialogue - 132, BUFFER_BUTTON_OK, *Ok) | |||
| Char = New@Char (DIALOGUE_LEFT + 168, DIALOGUE_TOP + 272, "") | |||
| size@Char.Char = 64 | |||
| Show@Keyboard | |||
| bufferId@Dialogue = BUFFER_NAME_DIALOGUE | |||
| Show@Dialogue | |||
| Return | |||
| #deffunc local \ | |||
| Hide | |||
| Destroy@MyButton ButtonOk | |||
| Destroy@Char Char | |||
| Hide@Keyboard | |||
| Hide@Dialogue | |||
| Return | |||
| #deffunc local \ | |||
| Interval | |||
| GetChar@Keyboard | |||
| text@Char.Char = text@Keyboard | |||
| Return | |||
| #deffunc local \ | |||
| Draw | |||
| Draw@Dialogue | |||
| Draw@MyButton | |||
| Interval | |||
| Return | |||
| *Ok | |||
| Hide | |||
| Create@User text@Keyboard | |||
| Return | |||
| #global | |||
| #endif ; not __NAME_DIALOGUE__ | |||
| @@ -6,8 +6,9 @@ User | |||
| #deffunc local \ | |||
| Create \ | |||
| str p_name,\ | |||
| local l_data | |||
| HTTPLoad CREATE_URL | |||
| HTTPLoad CREATE_URL + "?name=" + p_name | |||
| HTTPInfo l_data | |||
| id = 0 | |||