ハートに16連射。(11)
このプロジェクトですが、全て含めた状態で言うとそれなりの規模を予定してます。
ですので急に何か別のものを作ってるわけじゃないです。最終的に統合・収束するつもりで作ってます。
出来るところからコツコツと切り崩していきます。
全体の連携までを頭と机上だけで考えてるのは動くコードを書くより大変なので。動かして微調整してくです。
ジャンケンゲームも忘れてませんが。こっちは冬コミ合わせなスケジュールなので後回しにしていたりします。
ある程度書いて、飽きて来たら切り替えてシングルタスクで進行な感じです。
リソース・アートワーク・サウンドまで含めてどっちも多分夏までには終わるんじゃないかと予想。<夏コミ合わせ
んで、これはというと
早打ち計測ゲームの音無し版です。昨年のソースのリテイクです。
ゲームエンドで状態固定なのはオリジナルを忠実に再現するためです。(ぉ
でもまあ NDS で電源入れ直しを要求するのもあんまりなので(面倒だし。)
救済措置として L + R + START + SELECT によるソフトウェアリセットも一応用意です(汗)。
ファミコンオリジナルの PSG 再生部分は全く調べていないので
やるとしたら次以降の土日にでも。完成したらアーカイブを公開の予定です。
プロジェクトソースは以下の他に、「NDS Homebrew 用に利用可能なフォントリソース。(2)」エントリーで公開してる
アタリ風フォントリソースも含まれます。
NDS Homebrew 用に利用可能なフォントリソース。(2)
http://d.hatena.ne.jp/dumbo001/20090324/1237936437
main.c
/*--------------------------------------------------------------------------------- keisoku 早射ち計測ゲーム for NDS (音無し版) version 0.01 Jan 31, 2010 By. REGEKATSU ---------------------------------------------------------------------------------*/ #include <string.h> #include <nds/ndstypes.h> #include <nds/interrupts.h> #include <nds/system.h> #include <nds/arm9/input.h> #include "Bg.h" #include "Keisoku.h" typedef enum{ MAIN_INIT, MAIN_RESET, MAIN_KEISOKU }MAIN_ACT; typedef struct{ u16 act; }MainStatus; static MainStatus st_main; void main_Init(void); void main_Reset(void); bool main_IsReset(void); //--------------------------------------------------------------------------------- int main(void){ //--------------------------------------------------------------------------------- lcdSwap(); while(1) { swiWaitForVBlank(); scanKeys(); if(main_IsReset()){ st_main.act = MAIN_RESET; } switch(st_main.act){ case MAIN_INIT: main_Init(); st_main.act = MAIN_RESET; break; case MAIN_RESET: main_Reset(); st_main.act = MAIN_KEISOKU; break; case MAIN_KEISOKU: Keisoku_Update(); break; } } } //--------------------------------------------------------------------------------- void main_Init(void){ //--------------------------------------------------------------------------------- memset(&st_main, 0, sizeof(st_main)); Bg_Init(); } //--------------------------------------------------------------------------------- void main_Reset(void){ //--------------------------------------------------------------------------------- Keisoku_Clear(); } //--------------------------------------------------------------------------------- bool main_IsReset(void){ //--------------------------------------------------------------------------------- bool ans = false; u32 keys; if(keysDown() & (KEY_L | KEY_R | KEY_SELECT | KEY_START)){ keys = keysDown() | keysHeld(); keys = keys & (KEY_L | KEY_R | KEY_SELECT | KEY_START); if(keys == (KEY_L | KEY_R | KEY_SELECT | KEY_START)){ ans = true; } } return ans; } //---------------------------------------------------------------------------------
keisoku.h
/*--------------------------------------------------------------------------------- keisoku keisoku module header version 0.01 Jan 31, 2010 By. REGEKATSU ---------------------------------------------------------------------------------*/ #ifndef _KEISOKU_H_ #define _KEISOKU_H_ #ifdef __cplusplus extern "C" { #endif void Keisoku_Clear(void); void Keisoku_Update(void); #ifdef __cplusplus } #endif #endif //_KEISOKU_H_
keisoku.c
/*--------------------------------------------------------------------------------- keisoku keisoku module routine version 0.01 Jan 31, 2010 By. REGEKATSU ---------------------------------------------------------------------------------*/ #include <string.h> #include <nds/ndstypes.h> #include <nds/arm9/input.h> #include "Keisoku.h" #include "Bg.h" #define END_TIME 8 #define SET_TIME(x) ((x)*60) typedef enum{ KEISOKU_INIT, KEISOKU_READY, KEISOKU_EXEC, KEISOKU_STOP, KEISOKU_END, KEISOKU_EXIT }KEISOKU_ACT; typedef struct{ u16 act; int frame; int count; }KeisokuStatus; static KeisokuStatus st_keisoku; void keisoku_Init(void); void keisoku_Ready(void); void keisoku_Exec(void); void keisoku_Stop(void); void keisoku_End(void); void keisoku_Exit(void); void keisoku_IncCount(void); //--------------------------------------------------------------------------------- void Keisoku_Clear(void){ //--------------------------------------------------------------------------------- keisoku_Exit(); } //--------------------------------------------------------------------------------- void Keisoku_Update(void){ //--------------------------------------------------------------------------------- switch(st_keisoku.act){ case KEISOKU_INIT: keisoku_Init(); break; case KEISOKU_READY: keisoku_Ready(); break; case KEISOKU_EXEC: keisoku_Exec(); break; case KEISOKU_STOP: keisoku_Stop(); break; case KEISOKU_END: keisoku_End(); break; } } //--------------------------------------------------------------------------------- void keisoku_Init(void){ //--------------------------------------------------------------------------------- memset(&st_keisoku, 0, sizeof(st_keisoku)); Bg_DrawConsString(9, 9, "PUSH A BUTTON"); st_keisoku.act = KEISOKU_READY; } //--------------------------------------------------------------------------------- void keisoku_Ready(void){ //--------------------------------------------------------------------------------- if(keysDown() & KEY_A){ keisoku_IncCount(); st_keisoku.frame++; st_keisoku.act = KEISOKU_EXEC; } } //--------------------------------------------------------------------------------- void keisoku_Exec(void){ //--------------------------------------------------------------------------------- if(keysDown() & KEY_A){ keisoku_IncCount(); } if( st_keisoku.frame != SET_TIME(END_TIME) ){ st_keisoku.frame++; }else{ st_keisoku.act = KEISOKU_STOP; } } //--------------------------------------------------------------------------------- void keisoku_Stop(void){ //--------------------------------------------------------------------------------- Bg_SetConsScrollX(0); Bg_DrawConsValue(7, 12, st_keisoku.count / END_TIME); Bg_DrawConsString(11, 12, "TIMES PER SEC"); st_keisoku.act = KEISOKU_END; } //--------------------------------------------------------------------------------- void keisoku_End(void){ //--------------------------------------------------------------------------------- // no operation } //--------------------------------------------------------------------------------- void keisoku_Exit(void){ //--------------------------------------------------------------------------------- Bg_DrawConsClear(); st_keisoku.act = KEISOKU_INIT; } //--------------------------------------------------------------------------------- void keisoku_IncCount(void){ //--------------------------------------------------------------------------------- st_keisoku.count++; Bg_SetConsScrollX( Bg_GetConsScrollX() + 2 ); } //---------------------------------------------------------------------------------
Bg.h
/*--------------------------------------------------------------------------------- keisoku bg module header version 0.01 Jan 31, 2010 By. REGEKATSU ---------------------------------------------------------------------------------*/ #ifndef _BG_H_ #define _BG_H_ #include <nds/ndstypes.h> #ifdef __cplusplus extern "C" { #endif void Bg_Init(void); void Bg_DrawConsClear(void); void Bg_DrawConsValue(int x, int y, int value); void Bg_DrawConsString(int x, int y, char *string); int Bg_GetConsScrollX(void); void Bg_SetConsScrollX(int scrollX); #ifdef __cplusplus } #endif #endif //_BG_H_
Bg.c
/*--------------------------------------------------------------------------------- keisoku bg module routine version 0.01 Jan 31, 2010 By. REGEKATSU ---------------------------------------------------------------------------------*/ #include <stdio.h> #include <string.h> #include <nds/ndstypes.h> #include <nds/arm9/background.h> #include <nds/arm9/video.h> #include <nds/arm9/console.h> #include "Bg.h" #include "font.h" typedef struct{ //console state PrintConsole cons; ConsoleFont font; int cons_scrollx; }BgStatus; static BgStatus st_bg; //--------------------------------------------------------------------------------- void Bg_Init(void){ //--------------------------------------------------------------------------------- //initStruct memset(&st_bg, 0, sizeof(st_bg)); //initBgole st_bg.cons = *consoleDemoInit(); //initFont st_bg.font.gfx = (u16*)fontTiles; st_bg.font.bpp = 4; st_bg.font.numChars = 128; st_bg.font.convertSingleColor = true; consoleSetFont(&st_bg.cons, &st_bg.font); //initBGPalette BG_PALETTE_SUB[0] = RGB8(48, 80, 128); } //--------------------------------------------------------------------------------- void Bg_DrawConsClear(void){ //--------------------------------------------------------------------------------- printf("\x01b[2J"); } //--------------------------------------------------------------------------------- void Bg_DrawConsValue(int x, int y, int value){ //--------------------------------------------------------------------------------- printf("\x01b[%d;%dH%3d", y, x, value); } //--------------------------------------------------------------------------------- void Bg_DrawConsString(int x, int y, char *string){ //--------------------------------------------------------------------------------- printf("\x01b[%d;%dH%s", y, x, string); } //--------------------------------------------------------------------------------- int Bg_GetConsScrollX(void){ //--------------------------------------------------------------------------------- return st_bg.cons_scrollx; } //--------------------------------------------------------------------------------- void Bg_SetConsScrollX(int scrollX){ //--------------------------------------------------------------------------------- st_bg.cons_scrollx = scrollX; bgSetScroll(st_bg.cons.bgId, st_bg.cons_scrollx, 0); bgUpdate(); } //---------------------------------------------------------------------------------