Kingdom Hearts
Kingdom Hearts |
---|
Also known as: Kingdom Hearts: Final Mix This game has unused areas. This game has a prerelease article This game has a notes page |
This page is rather stubbly and could use some expansion. Are you a bad enough dude to rescue this article? |
To do:
|
Kingdom Hearts is a game where you play as a kid named Sora who is trying to find his friend. Did we mention that you get to fight Disney characters and Heartless with a giant key?
Contents
Sub-Pages
Prerelease Info |
Notes |
Unused Areas
To do: There are boss/cutscene exclusive maps that have names. Document these. |
Crumbling Island
This area was planned to be used for a boss battle with Riku possessed by Ansem in the End of the World level. It was set to take place within the darkness-consumed Destiny Islands area between the other boss battles with Ansem. Because it was scrapped at the last minute, it can be found mostly complete in the game's data. The following code(s) will require you to hold R2 while loading a map to access it.
Room Modifier: Crumbling Island (US)
- E003FDFF 004DD49C
- 102B6568 00000010
- 102B6570 0000001F
- 102B6574 00000001
Room Modifier: Crumbling Island (PAL)
- E003FDFF 004DDB1C
- 102B6AE8 00000010
- 102B6AF0 0000001F
- 102B6AF4 00000001
Disney Castle
As seen in an early trailer, Disney Castle was originally set to appear as a playable world in Kingdom Hearts. The world can still be accessed via cheat codes, as areas of the world exist from the game's opening cutscenes. It was later made fully accessible in the sequel.
According to an interview, it was removed early in development because it was a place where only Disney characters could reside and is the complete opposite of End of The World.[1]
Unused Graphics
World Icons
There are a few unused world icons inside "world.ps2".
Hook's Ship
This icon of Hook's ship never appears on the world map even when first going to Neverland, making it unused.
Neverland
A version of Neverland's world icon without Hook's ship is present. The used version has Hook's ship on the bottom of it.
Unused Summon
Bahamut from the Final Fantasy series was originally going to be a summon. The name can appear on the summons menu through hacking but attempting to use it will make the game crash.
Bahamut in Summon Menu (NTSC-U/C Version)
003F2466 00000006
HDD Installation
To do: Confirm whether or not the installation process actually functions on international copies of the game. |
The Japanese versions of the game (both the original and Final Mix) feature support for the PlayStation BB Navigator, or an alternate HDD, which allows one to install the game to the hard drive to reduce load times. After installing, you're able to choose whether or not the game loads data from the DVD-ROM or from the HDD upon starting a new game. Due to this feature being largely unknown and underutilized outside of Japan, the option was removed entirely for the international release.
However, the option can be added back to the main menu through hacking, or if a properly formatted HDD is detected, which allows the installation process (as well as viewing the exclusive animation to go along with it) to be performed on an international copy of the game. However, because the mode was never intended to be accessible in non-Japanese versions of the game, all of the related text is completely untranslated and uses garbage characters.
Source Code Leftovers
Present only in the Trial demo and initial Japanese release is the file 1d140a5d.bin with source code and printf functions. It was removed in later releases. The contents are as follows.
#include <eeregs.h> #include <eekernel.h> #include <libgraph.h> #include <libipu.h> #include <stdio.h> #include <stdlib.h> #include <libdma.h> #include <sifrpc.h> #include <sifdev.h> #include <sif.h> #include <libcdvd.h> #include <libpad.h> #include <libvu0.h> #include "../include/libyas.h" #include "../include/libkgr.h" #include "../include/yilib.h" #include "../include/TiLib.h" #include "../include/WorldMapInfo.h" #include "mem.h" #include "sa_task.h" #include "sasa_gumi.h" #include "debug.h" #include "sa_worldmap.h" //#include "../data/world_sel/wdata.h" #include "sa_key.h" #include "ps2def.h" #include "sa_mathfunc.h" #include "../data/world_sel/WORLDMSG.H" #include "../data/world_sel/worldmap/wdata.h" #include "../data/gumi_event/gevent.h" #include "../data/world_point/psel.h" #include "../data/world_point/POINTMSG.H" #define bound(val, x) ((((val) + (x) - 1) / (x))*(x)) #define UncachedAddr(val) ((void*)((unsigned int)(val) | 0x20000000)) #define DmaAddr(val) val #define WIN_DEBUG_MENU_SEL_W 280 #define WIN_DEBUG_MENU_SEL_CX 20 #define WIN_DEBUG_MENU_SEL_CY 40 #define WIN_DEBUG_MENU_SEL_CX 20 #define WIN_DEBUG_MENU_SEL_CW (WIN_DEBUG_MENU_SEL_W-WIN_DEBUG_MENU_SEL_CX*2) #define WIN_DEBUG_MENU_SEL_CH 36 #define WIN_DEBUG_MENU_SEL_CSH 2 #define ID_TOP WSID_dc #define CHECK_ID_MAX WSID_pp_n #define CHECK_ID_MAX_DISP WSID_pc_ew #define ID_CHECK_OFS 70 #define SA_RGBA32(r,g,b,a) ((r*230/128)|((g*230/128)<<8)|((b*230/128)<<16)|((a)<<24)) /* A = 8bit */ enum{ CUR_TYPE_STOP=66, CUR_TYPE_MOVE, CUR_TYPE_WAPE, CUR_TYPE_CUR, CUR_TYPE_CUR_KEY, }; typedef struct{ unsigned char r,g,b,a; }SA_COLOR; void TiWmSetClearColor(unsigned char,unsigned char,unsigned char); static SA_TASK *world_task_buff=NULL; static int skip_flg=0; extern SA_WORLD_MAP sa_world_map; static int sasa_world_exit=0; static void sasa_world_control_task(void); static void sasa_world_key_control_task(void); static int sa_file_read_size; static char *sa_file_read_buff; static char *sa_data_buff[2]; static int win_all_close; static char *mes_buff,*mes_buffo,*bottom_tex; static int start_flg; static float rot_x = 0.0f, rot_y = 0.0f, rot_z = 0.0f, rot_w = 0.0f; static float trans_x = 0.0f, trans_y = 0.0f, trans_z = 0.0f, trans_w = 0.0f; static sceVu0FVECTOR camera_p = { 0.0f, 0.0f, -70.0f, 1.0f }; static sceVu0FVECTOR camera_zd = { 0.0f, 0.0f, 1.0f, 1.0f }; static sceVu0FVECTOR camera_yd = { 0.0f, 1.0f, 0.0f, 1.0f }; static sceVu0FVECTOR camera_rot = { 0.0f, 0.0f, 0.0f, 1.0f }; static int key_on_flg; static int wape_flg; static int wape_gumi_flg; static sceVu0FMATRIX ScreenLocalMatrix; typedef union { u_long128 ul128; u_long ul64[2]; u_int ui32[4]; float f[4]; }Q_WORDDATA; #define PACKET_MAX 2 static char *packet[PACKET_MAX]; inline static void setGIFtag( u_int *p, u_long regs, u_int nreg, u_int flg, u_int prim, u_int pre, u_int eop, u_int nloop ) { p[0] = eop<<15 | nloop; p[1] = pre<<(46-32) | prim<<(47-32) | flg<<(58-32) | nreg<<(60-32); p[2] = regs&0xffffffff; p[3] = regs>>32; } inline static void setGIFad(u_int *p, u_int reg, u_long value) { p[0] = value&0xffffffff; p[1] = value>>32; p[2] = reg; p[3] = 0x00; } inline static void setBITBLTBUF(u_int *p, u_int dbp, u_int dbw, u_int dpsm,int vram_high_use) { u_long val; if(vram_high_use==0){ val=((u_long)dpsm << 24) | ((u_long)dpsm << 56) // 転送先24ビット | ((u_long)dbw << 48) | ((u_long)dbp << 32); }else{ val=((u_long)dpsm << 56) | ((u_long)dbw << 48) | ((u_long)dbp << 32); } setGIFad(p, SCE_GS_BITBLTBUF, val); } inline static void setTRXREG(u_int *p, u_int rrw, u_int rrh) { u_long val = ((u_long)rrh << 32) | ((u_long)rrw << 0); setGIFad(p, SCE_GS_TRXREG, val); } inline static void setTRXPOS(u_int *p, u_int dir, u_int dsax, u_int dsay) { u_long val = ((u_long)dir << 59) | ((u_long)dsay << 48) | ((u_long)dsax << 32); setGIFad(p, SCE_GS_TRXPOS, val); } inline static void setTRXDIR(u_int *p, u_int xdir) { setGIFad(p, SCE_GS_TRXDIR, (u_long)xdir); } static void world_read_callback(int size, int id, void *addr){ sa_file_read_size=size; printf("world map file read done : size=%d\n",size); } static void *sa_file_read(char *path,void *pBuff,int align,int *size){ printf("file read %s\n",path); sa_file_read_size=-1; YaReadFileBack(path,pBuff,world_read_callback,0); for(;;){ if(sa_file_read_size != -1)break; task_wait(1); } if(size != NULL){ *size=sa_file_read_size; } if(align==0){ return (void*)(((unsigned int)pBuff)+sa_file_read_size); }else{ return (void*)(((((unsigned int)pBuff)+sa_file_read_size)+(align-1)) & (0xffffffff^(align-1))); } } static int ti_file_read(char *path,void *pBuff){ printf("file read %s\n",path); sa_file_read_size=-1; YaReadFileBack(path,pBuff,world_read_callback,0); for(;;){ if(sa_file_read_size != -1)break; TiEntryTask(); } return sa_file_read_size; } inline static void setDMAscTag( u_int *p, u_int spr, void *addr, u_int irq, u_int id, u_int pce, u_int qwc ) { u_long *val = (u_long*)p; *val = \ (u_long)spr << 63 | (u_long)((u_int)addr & 0xfffffff0) << 32 | (u_long)irq << 31 | (u_long)id << 28 | (u_long)pce << 26 | (u_long)qwc; } static int now_cur_ofs=-1; static int now_id=-1; static int fuki_x; static int fuki_y; static int put_cur_no; static char world_name_id[]={ SA_MSG_EW, // 0 dummy SA_MSG_PI, // 1 dummy SA_MSG_DC, // 2 SA_MSG_TW, // 3 SA_MSG_AW, // 4 SA_MSG_TZ, // 5 SA_MSG_PC, // 6 dummy SA_MSG_NL, // 7 dummy SA_MSG_AL, // 8 SA_MSG_LM, // 9 SA_MSG_NM, // 10 SA_MSG_HE, // 11 SA_MSG_DC, // 12 dummy SA_MSG_NL, // 13 SA_MSG_DC, // 14 dummy SA_MSG_PC, // 15 SA_MSG_EW, // 16 SA_MSG_PI, // 17 SA_MSG_PI, // 18 SA_MSG_PP, // 19 SA_MSG_PP, // 20 SA_MSG_WH, // 21 SA_MSG_WH, // 22 SA_MSG_WH, // 23 SA_MSG_WH, // 24 SA_MSG_WH, // 25 SA_MSG_WH, // 26 SA_MSG_NL, // 27 }; static int win_x,win_y; static void top_mes_put_func(YI_WIN *win){ int x,y,no,i,yy,list; // int color[]={ // YI_MENU_PLATE_MSG_COLOR_NO_SELECT3, /* 操作型、非選択状態、選択可能 */ // YI_MENU_PLATE_MSG_COLOR_SELECT3, /* 操作型、選択状態、選択可能 */ // }; int color[2][2]={ { YI_MENU_PLATE_MSG_COLOR_NO_SELECT_BAD4, /* 操作型、非選択状態、選択可能 */ YI_MENU_PLATE_MSG_COLOR_SELECT4, /* 操作型、選択状態、選択可能 */ }, { YI_MENU_PLATE_MSG_COLOR_NO_SELECT_BAD5, /* 操作型、非選択状態、選択可能 */ YI_MENU_PLATE_MSG_COLOR_SELECT5, /* 操作型、選択状態、選択可能 */ } }; int mes[]={ SA_MSG_NORMAL_DRAIVE, SA_MSG_WAPE_DRAIVE, }; YiSetSystemMsg(mes_buff,mes_buffo); // 自分のメッセージバッファ設定 YiWinDrawMsgListFreeRGBA(win,2,512/2,11,SA_MSG_WORLD_SELECT,16,YI_RGBA32(255,255,255,0x80)); no=now_cur_ofs; if(no>=ID_TOP && no<=CHECK_ID_MAX /*&& put_cur_no==CUR_TYPE_STOP*/){ x=(win_x>>4)-2048+256-64-211+256/2; y=(win_y>>4)-2048+384/2-64; YiWinDrawMsgListFreeRGBA(win,2,x,y,world_name_id[no],15,YI_RGBA32(255,255,255,0x80)); } YiWinDrawMsgListFreeRGBA(win,0,276,384-28,SA_MSG_LOCK_WORLD,15,YI_RGBA32(255,255,255,0x80)); YiWinDrawMsgListFreeRGBA(win,0,412,384-28,SA_MSG_GO_ROOT,15,YI_RGBA32(255,255,255,0x80)); // if(put_cur_no==CUR_TYPE_STOP){ if(YiWinGetControl(win)){ YiWinPadCursor(win); } // YiWinScissorList(win); list = YiWinGetListTop(win); x=(win_x>>4)-2048+512/2-220; y = YiWinGetListY(win)+(win_y>>4)-2048+512/2-136; yy=YiWinGetCursorListPos(win); for(i=2+1; i>=0; i--, list++, y+=WIN_DEBUG_MENU_SEL_CH){ if(list < 2) { if(wape_gumi_flg==0){ if(list==1)continue; } YiMenuDrawPlateMsgList(win,color[list][yy==list] , 2 ,x, y,140,mes[list] ); //extern void YiWinDrawPlateMsgListFree(YI_WIN *win, int type, int mode, int x, int y, int w, int msg_x, YI_WIN_PLATE_MSG_COLOR *col, int list, int size); /* プレート、メッセージの描画、サイズ指定、リスト */ } } skip_flg=yy; // } win_x=fuki_x; win_y=fuki_y; YiWinScissorDef(); if(win_all_close >= 0){ YiWinCloseLink(win); } } static YI_WIN_PARAM top_mes_put = { top_mes_put_func, NULL, YI_WIN_STATUS_ONLY_ONE, // ステータス 0, // ウィンドウX 0, // ウィンドウY 512, // ウィンドウW 384, // ウィンドウH WIN_DEBUG_MENU_SEL_CX,WIN_DEBUG_MENU_SEL_CY,WIN_DEBUG_MENU_SEL_CW,WIN_DEBUG_MENU_SEL_CH, WIN_DEBUG_MENU_SEL_CSH, 2, // リストの最大数 2, // 表示の最大数 }; static void sa_world_map_init(char *work_ram,int size){ int task_size; char *buff; /* パッドカーソルモード設定 */ YiWinSetPadCursorMode(YI_WIN_PAD_CURSOR_MODE_DIGITAL); TiWmSetClearColor(40,80,40); // TiWmSetClearColor(0,0,0); now_id=-1; sa_data_buff[0]=NULL; sa_data_buff[1]=NULL; sasa_world_exit=0; buff=work_ram; task_size=sa_task_buff_size_get(2); world_task_buff=sa_task_init2(2,buff,0); world_task_buff->task_create(sasa_world_control_task,1,1); buff+=task_size; sa_file_read_buff=buff; } static void sa_world_map_control(unsigned int **buff){ int i,mode; if(world_task_buff != NULL){ for(i=0;i<PACKET_MAX;i++){ packet[i]=(char*)(buff[i]); } world_task_buff->task_main(); for(i=0;i<PACKET_MAX;i++){ buff[i]=(unsigned int*)(packet[i]); } } mode=-1; if(YaPad[0].trigger & SA_PAD_RR)mode=0; if(YaPad[0].trigger & SA_PAD_RL)mode=1; if(mode>=0){ if(world_task_buff != NULL){ if(now_id != -1){ if(skip_flg){ if(wape_flg){ dkSOUND_SystemSePlay(SE_SYSTEM_BEEP); return; } } world_task_buff->task_end(); world_task_buff=NULL; win_all_close=0; sasa_world_exit=1; /* パッドカーソルモード初期化 */ YiWinInitPadCursorMode(); sa_world_map.select_id=now_id; sa_world_map.skip_flg=skip_flg; sa_world_map.exit_mode=mode; printf("return select_id=%d\n",sa_world_map.select_id); printf("return skip=%d\n",sa_world_map.skip_flg); } } } } static int sa_world_map_sync(void){ return sasa_world_exit; } #if 0 static void make_packt_sp(int x0,int y0,int x1,int y1,int w,int h,float u0,float v0,float u1,float v1,int rgb_mode,unsigned int clut_ofs){ int ww,hh; int pos; unsigned int z; int vram; int clut; int tex_size_w; int tex_size_h; Q_WORDDATA *pbuf=(Q_WORDDATA*)packet[0]; vram=sa_world_map.vram; clut=sa_world_map.vram+clut_ofs; ww=w; hh=h; tex_size_w=1; if(ww>16){tex_size_w=5;} if(ww>32){tex_size_w=6;} if(ww>64){tex_size_w=7;} if(ww>128){tex_size_w=8;} if(ww>256){tex_size_w=9;} if(ww>512){tex_size_w=10;} tex_size_h=1; if(hh>16){tex_size_h=5;} if(hh>32){tex_size_h=6;} if(hh>64){tex_size_h=7;} if(hh>128){tex_size_h=8;} if(hh>256){tex_size_h=9;} if(hh>512){tex_size_h=10;} x0+=2048-512/2; y0+=2048-384/2; x1+=2048-512/2; y1+=2048-384/2; pos=0; pbuf[pos].ul128 = (u_long128)0; // pbuf[pos].ui32[0] = 0x1000000e; // DMA cnt pos++; pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(6, 0, 0, 0, 0, 1); pbuf[pos].ul64[1] = 0xe; pos++; pbuf[pos].ul64[0] = 0; pbuf[pos].ul64[1] = SCE_GS_TEXFLUSH; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_TEX0(vram, ww/64, rgb_mode ,tex_size_w,tex_size_h, 1,0,clut,SCE_GS_PSMCT32, 0, 0 , 1); pbuf[pos].ul64[1] = SCE_GS_TEX0_1; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ); pbuf[pos].ul64[1] = SCE_GS_ALPHA_1; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2); pbuf[pos].ul64[1] = SCE_GS_TEST_1; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_PABE(0); pbuf[pos].ul64[1] = SCE_GS_PABE; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_TEX1(0, 0, SCE_GS_NEAREST, SCE_GS_NEAREST, 0, 0, 0); pbuf[pos].ul64[1] = SCE_GS_TEX1_1; pos++; pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 1, 1,SCE_GS_PRIM_SPRITE | SCE_GS_PRIM_TME | SCE_GS_PRIM_ABE , 0, 6); pbuf[pos].ul64[1] = 0x412412; pos++; z=(1 << 24)-1; pbuf[pos].f[0] = u0; // U pbuf[pos].f[1] = v0; // V pbuf[pos].f[2] = 1.0f; // Q(1.0f) pbuf[pos].f[3] = 0.0f; pos++; pbuf[pos].ui32[0] = 0x80; // R pbuf[pos].ui32[1] = 0x80; // G pbuf[pos].ui32[2] = 0x80; // B pbuf[pos].ui32[3] = 0x80; // A pos++; pbuf[pos].ui32[0] = (x0 << 4); // X pbuf[pos].ui32[1] = (y0 << 4); // Y pbuf[pos].ui32[2] = z; // Z pbuf[pos].ui32[3] = 0; // F pos++; pbuf[pos].f[0] = u1; // U pbuf[pos].f[1] = v1; // V pbuf[pos].f[2] = 1.0f; // Q(1.0f) pbuf[pos].f[3] = 0.0f; pos++; pbuf[pos].ui32[0] = 0x80; // R pbuf[pos].ui32[1] = 0x80; // G pbuf[pos].ui32[2] = 0x80; // B pbuf[pos].ui32[3] = 0x80; // A pos++; pbuf[pos].ui32[0] = (x1 << 4); // X pbuf[pos].ui32[1] = (y1 << 4); // Y pbuf[pos].ui32[2] = z; // Z pbuf[pos].ui32[3] = 0; // F pos++; // pbuf[pos].ul128 = (u_long128)0; // pbuf[pos].ui32[0] = 0x70000000; // DMA end pbuf[0].ui32[0] = 0x10000000|(pos-1); // DMA cnt packet[0]=(unsigned char*)(pbuf+pos); } #endif static void make_packt(int *x,int *y,int *z,int *w,int ww,int hh,float *u,float *v,int rgb_mode,unsigned int clut_ofs,int type,SA_COLOR *color,unsigned long alpha,unsigned int alpha_mask,unsigned long test,int cnt){ int pos; int vram; int clut; int tex_size_w; int tex_size_h; int i; unsigned char r,g,b,a; float fw; Q_WORDDATA *pbuf=(Q_WORDDATA*)packet[0]; vram=sa_world_map.vram; clut=sa_world_map.vram+clut_ofs; tex_size_w=1; if(ww>16){tex_size_w=5;} if(ww>32){tex_size_w=6;} if(ww>64){tex_size_w=7;} if(ww>128){tex_size_w=8;} if(ww>256){tex_size_w=9;} if(ww>512){tex_size_w=10;} tex_size_h=1; if(hh>16){tex_size_h=5;} if(hh>32){tex_size_h=6;} if(hh>64){tex_size_h=7;} if(hh>128){tex_size_h=8;} if(hh>256){tex_size_h=9;} if(hh>512){tex_size_h=10;} pos=0; pbuf[pos].ul128 = (u_long128)0; // pbuf[pos].ui32[0] = 0x1000000e; // DMA cnt pos++; if(alpha_mask){ pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(7, 0, 0, 0, 0, 1); }else{ pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(6, 0, 0, 0, 0, 1); } pbuf[pos].ul64[1] = 0xe; pos++; pbuf[pos].ul64[0] = 0; pbuf[pos].ul64[1] = SCE_GS_TEXFLUSH; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_TEX0(vram, ww/64, rgb_mode ,tex_size_w,tex_size_h, 1,0,clut,SCE_GS_PSMCT32, 0, 0 , 1); pbuf[pos].ul64[1] = SCE_GS_TEX0_1; pos++; // pbuf[pos].ul64[0] = SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ); pbuf[pos].ul64[0] = alpha; pbuf[pos].ul64[1] = SCE_GS_ALPHA_1; pos++; // if(alpha_mask){ // pbuf[pos].ul64[0] = SCE_GS_SET_TEST(1, 1, 1, 0, 0, 0, 1, 2); // }else{ // pbuf[pos].ul64[0] = SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2); // pbuf[pos].ul64[0] = SCE_GS_SET_TEST(1, 6, 1, 0, 1, 1, 1, 2); // } pbuf[pos].ul64[0] = test; pbuf[pos].ul64[1] = SCE_GS_TEST_1; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_PABE(0); pbuf[pos].ul64[1] = SCE_GS_PABE; pos++; // pbuf[pos].ul64[0] = SCE_GS_SET_TEX1(0, 0, SCE_GS_NEAREST, SCE_GS_NEAREST, 0, 0, 0); // 補間なし pbuf[pos].ul64[0] = SCE_GS_SET_TEX1(0, 0, SCE_GS_LINEAR, SCE_GS_LINEAR, 0, 0, 0); // 補間あり pbuf[pos].ul64[1] = SCE_GS_TEX1_1; pos++; if(alpha_mask){ pbuf[pos].ul64[0] = GS_DEF_FRAME | ((unsigned long)alpha_mask<<32); pbuf[pos].ul64[1] = SCE_GS_FRAME_1; pos++; if(cnt==3){ pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 0, 1,SCE_GS_PRIM_TRI | SCE_GS_PRIM_TME , 0 ,3*cnt); }else{ pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 0, 1,SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_TME , 0 ,3*cnt); } }else{ if(cnt==3){ pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 1, 1,SCE_GS_PRIM_TRI | SCE_GS_PRIM_TME | SCE_GS_PRIM_ABE , 0 ,3*cnt); }else{ pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 1, 1,SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_ABE , 0 ,3*cnt); } } pbuf[pos].ul64[1] = 0x412412412412; pos++; if(type){ r=color->r; g=color->g; b=color->b; a=color->a; }else{ r=0x40; g=0x40; b=0x40; a=0x60; } for(i=0;i<cnt;i++){ fw=(float)w[i]; pbuf[pos].f[0] = u[i]/fw; // U pbuf[pos].f[1] = v[i]/fw; // V pbuf[pos].f[2] = 1.0f/fw; // Q(1.0f) pbuf[pos].f[3] = 0.0f; pos++; pbuf[pos].ui32[0] = r; // R pbuf[pos].ui32[1] = g; // G pbuf[pos].ui32[2] = b; // B pbuf[pos].ui32[3] = a; // A pos++; pbuf[pos].ui32[0] = (x[i]); // X pbuf[pos].ui32[1] = (y[i]); // Y pbuf[pos].ui32[2] = (1 << 24)-1; // Z pbuf[pos].ui32[3] = 0; // F pos++; } // pbuf[pos].ul128 = (u_long128)0; // pbuf[pos].ui32[0] = 0x70000000; // DMA end if(alpha_mask){ pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 1, 0, 0, 0, 1); pbuf[pos].ul64[1] = 0xe; pos++; pbuf[pos].ul64[0] = GS_DEF_FRAME; pbuf[pos].ul64[1] = SCE_GS_FRAME_1; pos++; } pbuf[0].ui32[0] = 0x10000000|(pos-1); // DMA cnt packet[0]=(unsigned char*)(pbuf+pos); /* if(alpha_mask){ pbuf=(Q_WORDDATA*)packet[0]; pos=0; pbuf[pos].ul128 = (u_long128)0; // pbuf[pos].ui32[0] = 0x1000000e; // DMA cnt pos++; pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 0, 0, 0, 0, 1); pbuf[pos].ul64[1] = 0xe; pos++; pbuf[pos].ul64[0] = GS_DEF_FRAME; pbuf[pos].ul64[1] = SCE_GS_FRAME_1; pos++; pbuf[0].ui32[0] = 0x10000000|(pos-1); // DMA cnt packet[0]=(unsigned char*)(pbuf+pos); } */ } static void make_flat_packt(int x,int y,int w,int h,SA_COLOR *color,unsigned long alpha,unsigned long test){ int pos; unsigned char r,g,b,a; Q_WORDDATA *pbuf=(Q_WORDDATA*)packet[0]; x+=2048-512/2; y+=2048-384/2; pos=0; pbuf[pos].ul128 = (u_long128)0; // pbuf[pos].ui32[0] = 0x1000000e; // DMA cnt pos++; pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(4, 0, 0, 0, 0, 1); pbuf[pos].ul64[1] = 0xe; pos++; pbuf[pos].ul64[0] = alpha; pbuf[pos].ul64[1] = SCE_GS_ALPHA_1; pos++; pbuf[pos].ul64[0] = test; pbuf[pos].ul64[1] = SCE_GS_TEST_1; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_PABE(0); pbuf[pos].ul64[1] = SCE_GS_PABE; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_TEX1(0, 0, SCE_GS_LINEAR, SCE_GS_LINEAR, 0, 0, 0); // 補間あり pbuf[pos].ul64[1] = SCE_GS_TEX1_1; pos++; pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 1, 1,SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_ABE , 0 ,2*4); pbuf[pos].ul64[1] = 0x41414141; pos++; r=color->r; g=color->g; b=color->b; a=color->a; pbuf[pos].ui32[0] = r; // R pbuf[pos].ui32[1] = g; // G pbuf[pos].ui32[2] = b; // B pbuf[pos].ui32[3] = a; // A pos++; pbuf[pos].ui32[0] = ((x+w)<<4); // X pbuf[pos].ui32[1] = ((y+h)<<4); // Y pbuf[pos].ui32[2] = (1 << 24)-1; // Z pbuf[pos].ui32[3] = 0; // F pos++; pbuf[pos].ui32[0] = r; // R pbuf[pos].ui32[1] = g; // G pbuf[pos].ui32[2] = b; // B pbuf[pos].ui32[3] = a; // A pos++; pbuf[pos].ui32[0] = ((x+w)<<4); // X pbuf[pos].ui32[1] = ((y+0)<<4); // Y pbuf[pos].ui32[2] = (1 << 24)-1; // Z pbuf[pos].ui32[3] = 0; // F pos++; pbuf[pos].ui32[0] = r; // R pbuf[pos].ui32[1] = g; // G pbuf[pos].ui32[2] = b; // B pbuf[pos].ui32[3] = a; // A pos++; pbuf[pos].ui32[0] = ((x+0)<<4); // X pbuf[pos].ui32[1] = ((y+h)<<4); // Y pbuf[pos].ui32[2] = (1 << 24)-1; // Z pbuf[pos].ui32[3] = 0; // F pos++; pbuf[pos].ui32[0] = r; // R pbuf[pos].ui32[1] = g; // G pbuf[pos].ui32[2] = b; // B pbuf[pos].ui32[3] = a; // A pos++; pbuf[pos].ui32[0] = ((x+0)<<4); // X pbuf[pos].ui32[1] = ((y+0)<<4); // Y pbuf[pos].ui32[2] = (1 << 24)-1; // Z pbuf[pos].ui32[3] = 0; // F pos++; pbuf[0].ui32[0] = 0x10000000|(pos-1); // DMA cnt packet[0]=(unsigned char*)(pbuf+pos); } #if 0 static void *setLoadImageTagsTexAnim(u_int *tags, unsigned int *image,int x,int y,int w, int h,int dbw,u_int vram){ u_int *p; u_int dbp, dpsm; u_int dir; u_int rrw, rrh; u_int xdir; int size; int eop=1; size=w * h * 1 /16; // memset(image+8,0xff,size*16); // ////////////////////////////////////// // // set params // dbp = vram; // VRAM BACE dbw = bound(dbw, 64)/64; dpsm = SCE_GS_PSMT8; dir = 0; rrw = w; rrh = h; xdir = 0; // ////////////////////////////////////// // // packet creation // p = (u_int*)tags; *p++ = 0x10000000 | 6; *p++ = 0x0; *p++ = SCE_VIF1_SET_NOP(0); *p++ = SCE_VIF1_SET_NOP(0); *p++=SCE_VIF1_SET_NOP(0); *p++=SCE_VIF1_SET_NOP(0); *p++=SCE_VIF1_SET_NOP(0); *p++=SCE_VIF1_SET_DIRECT(5, 0); setGIFtag(p, 0x0e, 1, 0, 0, 0, eop, 4); p += 4; setBITBLTBUF(p, dbp, dbw, dpsm,0); p += 4; setTRXREG(p, rrw, rrh); p += 4; setTRXPOS(p, dir, x , y ); p += 4; setTRXDIR(p, xdir); p += 4; image[0]=SCE_VIF1_SET_NOP(0); image[1]=SCE_VIF1_SET_NOP(0); image[2]=SCE_VIF1_SET_NOP(0); image[3]=SCE_VIF1_SET_DIRECT(1+size, 0); setGIFtag(image+4, 0, 0, 2, 0, 0, eop, size); *p++ = 0x30000000 | (2+size); *p++ = (u_int)image & 0x7fffffff; *p++ = SCE_VIF1_SET_NOP(0); *p++ = SCE_VIF1_SET_NOP(0); return (void*)p; } #endif static void *setLoadImageTagsTexAnim(u_int *tags, unsigned char *image,int x,int y,int w, int h,u_int vram,unsigned int dpsm,unsigned int dbw,int bitcount){ u_int *p; u_int dir, dsax, dsay; u_int rrw, rrh; u_int xdir; int size; int eop = 1; unsigned int dbp = vram; // VRAM BACE size=w*h*bitcount/(16*8); // ////////////////////////////////////// // // set params // dir = 0; dsax = x; dsay = y; rrw = w; rrh = h; xdir = 0; // ////////////////////////////////////// // // packet creation // // p = (u_int*)UncachedAddr(tags); p = (u_int*)tags; setDMAscTag( p, // u_int *p, 0, // u_int spr, 0, // u_int addr, 0, // u_int irq, 1, // u_int id, 0, // u_int pce, 3 ); p += 4; setGIFtag(p, 0x0e, 1, 0, 0, 0, 0, 2);p += 4; //setBITBLTBUF(p, dbp , dbw, dpsm , vram);p += 4; setBITBLTBUF(p, dbp , dbw, dpsm , 1);p += 4; setTRXREG(p, rrw, rrh);p += 4; // -------------------------------- setDMAscTag( p, // u_int *p, 0, // u_int spr, 0, // u_int addr, 0, // u_int irq, 1, // u_int id, 0, // u_int pce, 4 );p += 4; setGIFtag(p, 0x0e, 1, 0, 0, 0, 0, 2); p += 4; setTRXPOS(p, dir, dsax, dsay); p += 4; setTRXDIR(p, xdir); p += 4; setGIFtag(p, 0, 0, 2, 0, 0, eop, size); p += 4; setDMAscTag( p, // u_int *p, 0, // u_int spr, DmaAddr(image), // void *addr, 0, // u_int irq, 3, // u_int id, (ref) 0, // u_int pce, size );p += 4; /* // DMA tag end setDMAscTag( p, // u_int *p, 0, // u_int spr, NULL, // void *addr, 0, // u_int irq, 7, // u_int id, 0, // u_int pce, 0 );p += 4; */ return (void*)p; } static int get_poly_point(float *x,float *y,float *z,int ofs){ PS2HEAD *ps2head=(PS2HEAD*)sa_data_buff[0]; PS2IDX *idx; PS2IMAGE *ps2image; int i,j,k; int err=0; PS2 *point; float xx,yy,zz; idx=(PS2IDX*)(sa_data_buff[0]+(unsigned int)ps2head->idx); ps2image=(PS2IMAGE*)(sa_data_buff[0]+(unsigned int)ps2head->tex); for(i=0;i<ps2head->cnt;i++,idx++){ point=(PS2*)(sa_data_buff[0]+(unsigned int)idx->point); for(j=0;j<idx->cnt;j++,point++){ if(ofs != point->user)continue; if(point->user > CHECK_ID_MAX)continue; if(point->user < ID_TOP)continue; if((sa_world_map.world_flg[point->user] & WORLD_SELECT)==0)continue; if(point->cnt==4 || point->cnt==3){ xx=yy=zz=0.0f; for(k=0;k<point->cnt;k++){ xx+=point->x[k]; yy+=point->y[k]; zz+=point->z[k]; } xx/=(float)point->cnt; yy/=(float)point->cnt; zz/=(float)point->cnt; *x=xx; *y=yy; *z=zz; return 1; } } } return err; } static void make_sprite_packt(unsigned char *image,unsigned char *clut,int x,int y,int w,int h,int bitcount,SA_COLOR *color,int x_flip,unsigned long alpha,unsigned int alpha_mask,unsigned long test){ unsigned int dpsm=0; int cx,cy; unsigned int clut_ofs; int xx[4]; int yy[4]; int zz[4]; int ww[4]; float u[4],v[4]; int hh; float vv; switch(bitcount){ case 4: dpsm = SCE_GS_PSMT4; cx=8; cy=2; clut_ofs=w*h/(2*64); break; case 8: dpsm = SCE_GS_PSMT8; cx=16; cy=16; clut_ofs=w*h/64; break; default: dpsm = SCE_GS_PSMCT32; cx=cy=0; clut_ofs=0; break; } if(image != NULL){ packet[0]=setLoadImageTagsTexAnim((u_int*)packet[0],(unsigned char*)image,0,0,w,h,sa_world_map.vram,dpsm,w/64,bitcount); } if(clut != NULL){ packet[0]=setLoadImageTagsTexAnim((u_int*)packet[0],(unsigned char*)clut,0,0,cx,cy,sa_world_map.vram+clut_ofs,SCE_GS_PSMCT32,1,32); } x+=2048-512/2; y+=2048-384/2; x<<=4; y<<=4; if(x_flip==0){ xx[0]=x+(w<<4); xx[1]=x+(w<<4); xx[2]=x-(0<<4); xx[3]=x-(0<<4); }else{ xx[0]=x-(w<<4); xx[1]=x-(w<<4); xx[2]=x+(0<<4); xx[3]=x+(0<<4); } yy[0]=y+(h<<4); yy[1]=y-(0<<4); yy[2]=y+(h<<4); yy[3]=y-(0<<4); ww[0]=ww[1]=ww[2]=ww[3]=1.0f; hh=2; for(;;){ if(h <= hh)break; hh*=2; } vv=(float)(h-1)/(float)hh; u[3]=0.0f; v[3]=0.0f; u[2]=0.0f; v[2]=vv; u[1]=1.0f; v[1]=0.0f; u[0]=1.0f; v[0]=vv; make_packt(xx,yy,zz,ww,w,hh,u,v,dpsm,clut_ofs,1,color,alpha,alpha_mask,test,4); } static void put_bottom(void){ unsigned char *image; unsigned char *clut; SA_COLOR color; color.r=0x80; color.g=0x80; color.b=0x80; color.a=0x80; image=bottom_tex+wsel_button0_tex; // □ clut=bottom_tex+wsel_button0_plt; make_sprite_packt(image,clut,16,384-32,wsel_button0_w_size,wsel_button0_h_size,wsel_button0_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); image=bottom_tex+wsel_gumblck_tex; clut=bottom_tex+wsel_gumblck_plt; make_sprite_packt(image,clut,48,384-32+4,wsel_gumblck_w_size,wsel_gumblck_h_size,wsel_gumblck_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); image=bottom_tex+wsel_button1_tex; // △ clut=bottom_tex+wsel_button1_plt; make_sprite_packt(image,clut,246,384-32,wsel_button1_w_size,wsel_button1_h_size,wsel_button1_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); image=bottom_tex+wsel_button3_tex; // ○ clut=bottom_tex+wsel_button3_plt; make_sprite_packt(image,clut,380,384-32,wsel_button3_w_size,wsel_button3_h_size,wsel_button3_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=0x80; color.g=0x80; color.b=0x80; color.a=77; image=bottom_tex+wsel_title_arrw_tex; // < clut=bottom_tex+wsel_title_arrw_plt; make_sprite_packt(image,clut,90+12*0,8,wsel_title_arrw_w_size,wsel_title_arrw_h_size,wsel_title_arrw_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=0x80; color.g=0x80; color.b=0x80; color.a=102; image=bottom_tex+wsel_title_arrw_tex; // < clut=bottom_tex+wsel_title_arrw_plt; make_sprite_packt(image,clut,90+12*1,8,wsel_title_arrw_w_size,wsel_title_arrw_h_size,wsel_title_arrw_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=0x80; color.g=0x80; color.b=0x80; color.a=128; image=bottom_tex+wsel_title_arrw_tex; // < clut=bottom_tex+wsel_title_arrw_plt; make_sprite_packt(image,clut,90+12*2,8,wsel_title_arrw_w_size,wsel_title_arrw_h_size,wsel_title_arrw_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=0x80; color.g=0x80; color.b=0x80; color.a=128; image=bottom_tex+wsel_title_arrw_tex; // < clut=bottom_tex+wsel_title_arrw_plt; make_sprite_packt(image,clut,394+12*0,8,wsel_title_arrw_w_size,wsel_title_arrw_h_size,wsel_title_arrw_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=0x80; color.g=0x80; color.b=0x80; color.a=102; image=bottom_tex+wsel_title_arrw_tex; // < clut=bottom_tex+wsel_title_arrw_plt; make_sprite_packt(image,clut,394+12*1,8,wsel_title_arrw_w_size,wsel_title_arrw_h_size,wsel_title_arrw_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=0x80; color.g=0x80; color.b=0x80; color.a=77; image=bottom_tex+wsel_title_arrw_tex; // < clut=bottom_tex+wsel_title_arrw_plt; make_sprite_packt(image,clut,394+12*2,8,wsel_title_arrw_w_size,wsel_title_arrw_h_size,wsel_title_arrw_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); } static void make_gra(SA_COLOR *color,int *x,int *y,unsigned int alpha){ int pos; int i,xx,yy; Q_WORDDATA *pbuf=(Q_WORDDATA*)packet[0]; pos=0; pbuf[pos].ul128 = (u_long128)0; // pbuf[pos].ui32[0] = 0x1000000e; // DMA cnt pos++; pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(5, 0, 0, 0, 0, 1); pbuf[pos].ul64[1] = 0xe; pos++; pbuf[pos].ul64[0] = 0; pbuf[pos].ul64[1] = SCE_GS_TEXFLUSH; pos++; // pbuf[pos].ul64[0] = SCE_GS_SET_TEX0(vram, ww/64, rgb_mode ,tex_size_w,tex_size_h, 1,0,clut,SCE_GS_PSMCT32, 0, 0 , 1); // pbuf[pos].ul64[1] = SCE_GS_TEX0_1; // pos++; pbuf[pos].ul64[0] = alpha; pbuf[pos].ul64[1] = SCE_GS_ALPHA_1; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2); pbuf[pos].ul64[1] = SCE_GS_TEST_1; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_PABE(0); pbuf[pos].ul64[1] = SCE_GS_PABE; pos++; pbuf[pos].ul64[0] = SCE_GS_SET_TEX1(0, 0, SCE_GS_NEAREST, SCE_GS_NEAREST, 0, 0, 0); pbuf[pos].ul64[1] = SCE_GS_TEX1_1; pos++; pbuf[pos].ul64[0] = SCE_GIF_SET_TAG(1, 1, 1,SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_ABE | SCE_GS_PRIM_IIP, 0 ,2*4); pbuf[pos].ul64[1] = 0x41414141; pos++; for(i=0;i<4;i++){ xx=x[i]; xx+=2048-512/2; xx<<=4; yy=y[i]; yy+=2048-384/2; yy<<=4; pbuf[pos].ui32[0] = color[i].r; // R pbuf[pos].ui32[1] = color[i].g; // G pbuf[pos].ui32[2] = color[i].b; // B pbuf[pos].ui32[3] = color[i].a; // A pos++; pbuf[pos].ui32[0] = xx; // X pbuf[pos].ui32[1] = yy; // Y pbuf[pos].ui32[2] = (1 << 24)-1; // Z pbuf[pos].ui32[3] = 0; // F pos++; } pbuf[0].ui32[0] = 0x10000000|(pos-1); // DMA cnt packet[0]=(unsigned char*)(pbuf+pos); } static float cur_x_3d; static float cur_y_3d; static float cur_z_3d; static void make_poly_packt_sub(int cur_ofs){ PS2HEAD *ps2head; PS2IDX *idx; PS2IMAGE *ps2image; int i,j,k,w,h,tex,tex_old; unsigned char *image; unsigned int dpsm=0; unsigned int clut_ofs=0; int cx,cy; PS2 *point; int xx[4]; int yy[4]; int zz[4]; int ww[4]; int cur_x,cur_y,type; sceSamp0FVECTOR pos; sceSamp0IVECTOR v; SA_COLOR color; u_long alpha; int loop; key_on_flg=0; if(cur_ofs>=ID_TOP && cur_ofs <= CHECK_ID_MAX){ if((sa_world_map.world_flg[cur_ofs] & WORLD_NORMAL_DISP)){ if((sa_world_map.world_flg[cur_ofs] & WORLD_KEY_DISP)){ key_on_flg=1; } } } for(loop=1;loop>=0;loop--){ ps2head=(PS2HEAD*)sa_data_buff[loop]; pos[3]=1.0f; idx=(PS2IDX*)(sa_data_buff[loop]+(unsigned int)ps2head->idx); ps2image=(PS2IMAGE*)(sa_data_buff[loop]+(unsigned int)ps2head->tex); tex_old=-1; w=h=0; cx=cy=0; cur_x=cur_y=0; for(i=0;i<ps2head->cnt;i++,idx++){ point=(PS2*)(sa_data_buff[loop]+(unsigned int)idx->point); for(j=0;j<idx->cnt;j++,point++){ tex=point->tex; if(tex != tex_old){ tex_old=tex; w=(ps2image+tex)->w; h=(ps2image+tex)->h; switch((ps2image+tex)->bitcount){ case 4: dpsm = SCE_GS_PSMT4; clut_ofs=w*h/(2*64); cx=8; cy=2; break; case 8: dpsm = SCE_GS_PSMT8; clut_ofs=w*h/64; cx=16; cy=16; break; default: dpsm = SCE_GS_PSMCT32; clut_ofs=0; break; } image=sa_data_buff[loop]+(unsigned int)(ps2image+tex)->image; packet[0]=setLoadImageTagsTexAnim((u_int*)packet[0],(unsigned char*)image,0,0,w,h,sa_world_map.vram,dpsm,w/64,(ps2image+tex)->bitcount); if(clut_ofs){ image=image+clut_ofs*64; packet[0]=setLoadImageTagsTexAnim((u_int*)packet[0],(unsigned char*)image,0,0,cx,cy,sa_world_map.vram+clut_ofs,SCE_GS_PSMCT32,1,32); } } if(cur_ofs == point->user){ } if(point->cnt==4 || point->cnt==3){ switch(point->user){ case CUR_TYPE_CUR: case CUR_TYPE_CUR_KEY: if(key_on_flg==0){ if(point->user==CUR_TYPE_CUR_KEY)break; }else{ if(point->user==CUR_TYPE_CUR)break; } pos[0]=cur_x_3d; pos[1]=cur_y_3d; pos[2]=cur_z_3d; sceVu0RotTransPers(v,ScreenLocalMatrix,pos,2); fuki_x=cur_x=v[0]; fuki_y=cur_y=v[1]; xx[0]=cur_x+(64<<4)-(80<<4)+(16<<4); yy[0]=cur_y+(32<<4)-(53<<4)-(2<<4); xx[1]=cur_x+(64<<4)-(80<<4)+(16<<4); yy[1]=cur_y-(32<<4)-(53<<4)-(2<<4); xx[2]=cur_x-(64<<4)-(208<<4)+(16<<4); yy[2]=cur_y+(32<<4)-(53<<4)-(2<<4); xx[3]=cur_x-(64<<4)-(208<<4)+(16<<4); yy[3]=cur_y-(32<<4)-(53<<4)-(2<<4); ww[0]=ww[1]=ww[2]=ww[3]=1.0f; // if(put_cur_no==CUR_TYPE_STOP){ color.r=230; color.g=230; color.b=230; color.a=0x80; make_packt(xx,yy,zz,ww,w,h,point->u,point->v,dpsm,clut_ofs,1,&color,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2),point->cnt); // } break; case CUR_TYPE_MOVE: case CUR_TYPE_STOP: case CUR_TYPE_WAPE: if(skip_flg==0){ if(point->user != put_cur_no)break; }else{ if(point->user==CUR_TYPE_WAPE){ }else{ if(point->user != put_cur_no)break; } } pos[0]=cur_x_3d; pos[1]=cur_y_3d; pos[2]=cur_z_3d; sceVu0RotTransPers(v,ScreenLocalMatrix,pos,2); cur_x=v[0]; cur_y=v[1]; xx[0]=cur_x-(64<<4); yy[0]=cur_y+(64<<4); xx[1]=cur_x-(64<<4); yy[1]=cur_y-(64<<4); xx[2]=cur_x+(64<<4); yy[2]=cur_y+(64<<4); xx[3]=cur_x+(64<<4); yy[3]=cur_y-(64<<4); ww[0]=ww[1]=ww[2]=ww[3]=1.0f; if(skip_flg==0){ color.r=0x46; color.g=0xf0; color.b=0x46; color.a=0x60; }else{ color.r=0xf0; color.g=0x46; color.b=0xf0; color.a=0x60; } if(point->user==CUR_TYPE_WAPE){ color.a=51; } make_packt(xx,yy,zz,ww,w,h,point->u,point->v,dpsm,clut_ofs,1,&color,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2),point->cnt); break; default: if(point->user>=ID_TOP && point->user <= CHECK_ID_MAX_DISP){ if((sa_world_map.world_flg[point->user] & WORLD_NORMAL_DISP)==0)break; if(sa_world_map.world_flg[point->user] & WORLD_UNKNOWN_DISP)break; } if(point->user>=ID_TOP+ID_CHECK_OFS && point->user<=CHECK_ID_MAX+ID_CHECK_OFS){ if((sa_world_map.world_flg[point->user-ID_CHECK_OFS] & WORLD_UNKNOWN_DISP)==0)break; if(loop==1){ if(point->user>=WSID_tw_wpb && point->user<=WSID_pc_ew){ if((sa_world_map.world_flg[point->user] & WORLD_NORMAL_DISP)==0)break; } } } for(k=0;k<point->cnt;k++){ pos[0]=point->x[k]; pos[1]=point->y[k]; pos[2]=point->z[k]; sceVu0RotTransPers(v,ScreenLocalMatrix,pos,2); if(v[2]<=0 || v[2]>=0x7fffffff)goto L00; xx[k]=v[0]; yy[k]=v[1]; zz[k]=v[2]; ww[k]=v[3]; } type=1; if(point->user>=ID_TOP && point->user<=CHECK_ID_MAX){ if(cur_ofs != point->user){ type=0; } if(point->user == sa_world_map.start_id){ type=1; } } color.r=0x80; color.g=0x80; color.b=0x80; color.a=0x80; //switch(point->user){ // case 21: // 21 // case 22: // 22 // case 23: // 23 // case 24: // 24 // case 25: // 25 // case 26: // 26 // add=1; // break; // default: // add=0; // break; //} if(loop==1 /*|| add*/){ alpha=SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ); }else{ alpha=SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ); } make_packt(xx,yy,zz,ww,w,h,point->u,point->v,dpsm,clut_ofs,type,&color,alpha,0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2),point->cnt); break; } } L00:; } } } } static void dma_end_set(void){ Q_WORDDATA *pbuf; pbuf=(Q_WORDDATA*)packet[0]; pbuf[0].ul128 = (u_long128)0; pbuf[0].ui32[0] = 0x70000000; // DMA end packet[0]=(unsigned char*)(pbuf+1); FlushCache(0); } static void make_poly_packt(int cur_ofs){ SA_COLOR color[4]; int x[4]; int y[4]; color[1].r=color[0].r=0; color[1].g=color[0].g=0; color[1].b=color[0].b=0; // color[1].a=color[0].a=0; color[1].a=color[0].a=90; color[3].r=color[2].r=0; color[3].g=color[2].g=0; color[3].b=color[2].b=0; color[3].a=color[2].a=90; x[0]=0; y[0]=344; x[1]=512; y[1]=344; x[2]=0; y[2]=359; x[3]=512; y[3]=359; make_gra(color,x,y,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 )); x[2]=0; y[2]=24; x[3]=512; y[3]=24; x[0]=0; y[0]=40; x[1]=512; y[1]=40; make_gra(color,x,y,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 )); color[1].r=color[0].r=0; color[1].g=color[0].g=0; color[1].b=color[0].b=0; color[1].a=color[0].a=90; color[3].r=color[2].r=0; color[3].g=color[2].g=0; color[3].b=color[2].b=0; color[3].a=color[2].a=90; x[0]=0; y[0]=359; x[1]=512; y[1]=359; x[2]=0; y[2]=384; x[3]=512; y[3]=384; make_gra(color,x,y,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 )); x[2]=0; y[2]=0; x[3]=512; y[3]=0; x[0]=0; y[0]=24; x[1]=512; y[1]=24; make_gra(color,x,y,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 )); make_poly_packt_sub(cur_ofs); put_bottom(); dma_end_set(); } //function to calculate ViewWorlMatrix static void create_viewworld(sceVu0FMATRIX ViewWorldMatrix, sceVu0FVECTOR camera_rot, sceVu0FVECTOR camera_p, sceVu0FVECTOR camera_zd, sceVu0FVECTOR camera_yd){ sceVu0FMATRIX work; sceVu0FVECTOR camera_p2, camera_zd2, camera_yd2; sceVu0UnitMatrix(work); sceVu0RotMatrixX(work,work,camera_rot[0]); sceVu0RotMatrixY(work,work,camera_rot[1]); sceVu0ApplyMatrix(camera_zd2, work, camera_zd); sceVu0ApplyMatrix(camera_yd2, work, camera_yd); sceVu0ApplyMatrix(camera_p2, work, camera_p); sceVu0CameraMatrix(ViewWorldMatrix, camera_p2, camera_zd2, camera_yd2); } static void set_matrix(void){ sceVu0FMATRIX ScreenWorldMatrix; sceVu0FMATRIX ScreenViewMatrix; sceVu0FMATRIX WorldLocalMatrix; sceVu0FMATRIX ViewWorldMatrix; sceVu0FVECTOR rot = { rot_x, rot_y, rot_z, rot_w }; sceVu0FVECTOR trans = { trans_x, trans_y, trans_z, trans_w }; sceVu0FMATRIX RotMatrix; float near; float t, vw, ax, ay; float screen_w=512.0f; float screen_h=384.0f; float yn_aspect=((screen_h * 4.0f) / (screen_w * 3.0f)); float angle=10.0f; float aspect; angle=angle*3.1415f/180.0f; t = tanf(angle * 0.5f); aspect=((float)screen_w/2.0f)/t; vw = (2.0f * aspect) * t; ax = screen_w / vw; ay = ax * yn_aspect; near=(screen_w/2) / t; sceVu0UnitMatrix(RotMatrix); sceVu0RotMatrix(RotMatrix, RotMatrix, rot); // make matrix transforming from Local to World sceVu0TransMatrix(WorldLocalMatrix, RotMatrix, trans); // make matrix transforming from World to View create_viewworld(ViewWorldMatrix, camera_rot, camera_p, camera_zd, camera_yd); // make matrix to transform from View to Screen sceVu0ViewScreenMatrix(ScreenViewMatrix, 512.0f,ax,ay, 2048.0f, 2048.0f, 1.0f, 16777215.0f, near,65536.0f); sceVu0MulMatrix(ScreenWorldMatrix, ScreenViewMatrix, ViewWorldMatrix); sceVu0MulMatrix(ScreenLocalMatrix, ScreenWorldMatrix, WorldLocalMatrix); } #if 1 typedef struct{ char key[8]; char line[8]; char line2[8]; }NEXT_CHECK; #define NEXT_CHECK_MAX 28 static NEXT_CHECK next_check_tbl[NEXT_CHECK_MAX]={ { // 0 // dummy 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 1 // dummy 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 2 0, // up 0, // down 0, // left 3, // right 0, // left_up 3, // right_up 0, // left_down 3, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 3 0, // up 25, // down 2, // left 21, // right 0, // left_up 21, // right_up 0, // left_down 0, // right_down 0, // up 36, // down 0, // left 30, // right 0, // left_up 30, // right_up 0, // left_down 0, // right_down 0, // up 35, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 4 21, // up 5, // down 21, // left 5, // right 21, // left_up 0, // right_up 0, // left_down 5, // right_down 31, // up 32, // down 31, // left 32, // right 31, // left_up 0, // right_up 0, // left_down 32, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 5 4, // up 23, // down 0, // left 0, // right 4, // left_up 0, // right_up 23, // left_down 0, // right_down 32, // up 33, // down 0, // left 0, // right 32, // left_up 0, // right_up 33, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 6 // dummy 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 7 // dummy 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 8 22, // up 24, // down 0, // left 0, // right 0, // left_up 22, // right_up 0, // left_down 24, // right_down 46, // up 49, // down 0, // left 0, // right 0, // left_up 46, // right_up 0, // left_down 49, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 9 20, // up 18, // down 18, // left 20, // right 0, // left_up 20, // right_up 18, // left_down 0, // right_down 57, // up 51, // down 51, // left 57, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 10 0, // up 0, // down 17, // left 19, // right 0, // left_up 19, // right_up 17, // left_down 0, // right_down 0, // up 0, // down 48, // left 54, // right 0, // left_up 54, // right_up 48, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 11 25, // up 0, // down 25, // left 23, // right 25, // left_up 0, // right_up 0, // left_down 23, // right_down 35, // up 0, // down 35, // left 34, // right 35, // left_up 0, // right_up 0, // left_down 34, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 12 // dummy 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 13 0, // up 20, // down 19, // left 26, // right 19, // left_up 26, // right_up 20, // left_down 20, // right_down 0, // up 56, // down 55, // left 58, // right 55, // left_up 58, // right_up 56, // left_down 56, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 14 // dummy 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 15 26, // up 16, // down 0, // left 0, // right 26, // left_up 0, // right_up 0, // left_down 0, // right_down 59, // up 64, // down 0, // left 0, // right 59, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 16 15, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 64, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 17 0, // up 8, // down 22, // left 10, // right 22, // left_up 10, // right_up 8, // left_down 0, // right_down 0, // up 47, // down 41, // left 48, // right 41, // left_up 48, // right_up 47, // left_down 0, // right_down 0, // up 46, // down 47, // left 0, // right 47, // left_up 0, // right_up 46, // left_down 0, // right_down }, { // 18 0, // up 0, // down 24, // left 9, // right 0, // left_up 9, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 50, // left 51, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 19 0, // up 0, // down 10, // left 27, // right 0, // left_up 0, // right_up 10, // left_down 0, // right_down 0, // up 0, // down 54, // left 55, // right 0, // left_up 0, // right_up 54, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 20 27, // up 9, // down 9, // left 0, // right 0, // left_up 0, // right_up 9, // left_down 0, // right_down 56, // up 57, // down 57, // left 0, // right 0, // left_up 0, // right_up 57, // left_down 0, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 21 22, // up 0, // down 3, // left 4, // right 0, // left_up 22, // right_up 3, // left_down 4, // right_down 40, // up 0, // down 30, // left 31, // right 0, // left_up 40, // right_up 30, // left_down 31, // right_down 41, // up 0, // down 0, // left 0, // right 0, // left_up 41, // right_up 0, // left_down 0, // right_down }, { // 22 21, // up 8, // down 0, // left 17, // right 21, // left_up 17, // right_up 8, // left_down 0, // right_down 40, // up 46, // down 0, // left 47, // right 41, // left_up 47, // right_up 47, // left_down 0, // right_down 41, // up 0, // down 0, // left 0, // right 40, // left_up 0, // right_up 46, // left_down 0, // right_down }, { // 23 5, // up 24, // down 11, // left 0, // right 0, // left_up 5, // right_up 0, // left_down 24, // right_down 33, // up 38, // down 34, // left 0, // right 0, // left_up 33, // right_up 0, // left_down 38, // right_down 0, // up 39, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 39, // right_down }, { // 24 0, // up 23, // down 8, // left 18, // right 8, // left_up 0, // right_up 23, // left_down 0, // right_down 0, // up 39, // down 49, // left 50, // right 49, // left_up 0, // right_up 39, // left_down 0, // right_down 0, // up 38, // down 0, // left 0, // right 0, // left_up 0, // right_up 38, // left_down 0, // right_down }, { // 25 3, // up 11, // down 26, // left 11, // right 0, // left_up 0, // right_up 0, // left_down 11, // right_down 36, // up 35, // down 62, // left 35, // right 0, // left_up 0, // right_up 0, // left_down 35, // right_down 0, // up 0, // down 63, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, { // 26 25, // up 0, // down 27, // left 15, // right 0, // left_up 25, // right_up 27, // left_down 15, // right_down 63, // up 0, // down 58, // left 59, // right 0, // left_up 63, // right_up 58, // left_down 59, // right_down 62, // up 0, // down 0, // left 0, // right 0, // left_up 62, // right_up 0, // left_down 0, // right_down }, { // 27 0, // up 20, // down 19, // left 26, // right 19, // left_up 26, // right_up 20, // left_down 20, // right_down 0, // up 56, // down 55, // left 58, // right 55, // left_up 58, // right_up 56, // left_down 56, // right_down 0, // up 0, // down 0, // left 0, // right 0, // left_up 0, // right_up 0, // left_down 0, // right_down }, }; #if 0 static int get_next_pos(unsigned int key,int cur_ofs){ int mode,ret,i,nkey; if((key&(SA_PAD_R|SA_PAD_L|SA_PAD_U|SA_PAD_D))==0)return cur_ofs; if(cur_ofs>=NEXT_CHECK_MAX)return cur_ofs; mode=-1; if(key&SA_PAD_U)mode=0; if(key&SA_PAD_D)mode=1; if(key&SA_PAD_L)mode=2; if(key&SA_PAD_R)mode=3; if((key&(SA_PAD_L | SA_PAD_U))==(SA_PAD_L | SA_PAD_U))mode=4; if((key&(SA_PAD_R | SA_PAD_U))==(SA_PAD_R | SA_PAD_U))mode=5; if((key&(SA_PAD_L | SA_PAD_D))==(SA_PAD_L | SA_PAD_D))mode=6; if((key&(SA_PAD_R | SA_PAD_D))==(SA_PAD_R | SA_PAD_D))mode=7; if(mode==-1)return cur_ofs; ret=(int)next_check_tbl[cur_ofs].key[mode]; L00:; if(ret==WSID_pp){ if((sa_world_map.world_flg[ret] & WORLD_SELECT)==0){ ret=WSID_pp_n; return ret; } } if(ret==WSID_pp_n){ if((sa_world_map.world_flg[ret] & WORLD_SELECT)==0){ ret=WSID_pp; return ret; } } if(ret){ if((sa_world_map.world_flg[ret] & WORLD_SELECT)==0){ for(i=0;i<8;i++){ nkey=next_check_tbl[ret].key[i]; if(nkey==0)continue; if(nkey != cur_ofs){ if(cur_ofs==WSID_pp_n){ if(nkey == WSID_pp)continue; } if(cur_ofs==WSID_pp){ if(nkey==WSID_pp_n)continue; } ret=nkey; goto L00; } } return cur_ofs; } }else{ return cur_ofs; } return ret; } #else //static int stack_cnt; static int get_next_point(int cur_ofs,int cur_ofs2,int mode){ int ret,ret2,i,line,line2; //stack_cnt++; //printf("stack_cnt++=%d\n",stack_cnt); line=next_check_tbl[cur_ofs].line[mode]; if(line){ if((sa_world_map.world_flg[line] & WORLD_NORMAL_DISP)==0)goto L00; } line2=next_check_tbl[cur_ofs].line2[mode]; if(line2){ if((sa_world_map.world_flg[line2] & WORLD_NORMAL_DISP)==0)goto L00; } if(line ==0 && line2==0)goto L00; ret=(int)next_check_tbl[cur_ofs].key[mode]; if(ret==0)goto L00; if(ret==WSID_pp){ if((sa_world_map.world_flg[ret] & WORLD_SELECT)==0){ ret=WSID_pp_n; } }else{ if(ret==WSID_pp_n){ if((sa_world_map.world_flg[ret] & WORLD_SELECT)==0){ ret=WSID_pp; } } } if(cur_ofs == ret)goto L00; if(cur_ofs2 == ret)goto L00; if((sa_world_map.world_flg[ret] & WORLD_SELECT)==0){ for(i=0;i<8;i++){ ret2=get_next_point(ret,cur_ofs,i); if(ret2){ if(cur_ofs != ret2){ if(cur_ofs2 != ret2){ //stack_cnt--; //printf("stack_cnt--=%d\n",stack_cnt); return ret2; } } } } }else{ //stack_cnt--; //printf("stack_cnt--=%d\n",stack_cnt); return ret; } L00: //stack_cnt--; //printf("stack_cnt--=%d\n",stack_cnt); return 0; } static int get_next_pos(unsigned int key,int cur_ofs){ int mode,ret; if((key&(SA_PAD_R|SA_PAD_L|SA_PAD_U|SA_PAD_D))==0)return cur_ofs; if(cur_ofs>=NEXT_CHECK_MAX)return cur_ofs; mode=-1; if(key&SA_PAD_U)mode=0; if(key&SA_PAD_D)mode=1; if(key&SA_PAD_L)mode=2; if(key&SA_PAD_R)mode=3; if((key&(SA_PAD_L | SA_PAD_U))==(SA_PAD_L | SA_PAD_U))mode=4; if((key&(SA_PAD_R | SA_PAD_U))==(SA_PAD_R | SA_PAD_U))mode=5; if((key&(SA_PAD_L | SA_PAD_D))==(SA_PAD_L | SA_PAD_D))mode=6; if((key&(SA_PAD_R | SA_PAD_D))==(SA_PAD_R | SA_PAD_D))mode=7; if(mode==-1)return cur_ofs; //stack_cnt=0; ret=get_next_point(cur_ofs,cur_ofs,mode); if(ret==0)return cur_ofs; return ret; } #endif #else #define SERCH_ADD 16 static int get_next_pos(unsigned int key,int cur_ofs){ float x,y,z; int i,j; sceSamp0FVECTOR pos; sceSamp0IVECTOR v; int xx,yy,xxx,yyy; int x_pos[CHECK_ID_MAX+1]; int y_pos[CHECK_ID_MAX+1]; int kyori[CHECK_ID_MAX+1]; int x_add,y_add; int lng,lng2,wk,wk2,hit; if(get_poly_point(&x,&y,&z,cur_ofs)==0)return cur_ofs; pos[0]=x; pos[1]=y; pos[2]=z; pos[3]=1.0f; sceVu0RotTransPers(v,ScreenLocalMatrix,pos,2); xxx=xx=v[0]>>4; yyy=yy=v[1]>>4; x_add=y_add=0; if(key & SA_PAD_R)x_add=+SERCH_ADD; if(key & SA_PAD_L)x_add=-SERCH_ADD; if(key & SA_PAD_D)y_add=+SERCH_ADD; if(key & SA_PAD_U)y_add=-SERCH_ADD; //printf("key=%x\n",key); //printf("add x=%d\n",x_add); //printf("add y=%d\n",y_add); for(i=0;i<=CHECK_ID_MAX;i++){ x_pos[i]=-1000; y_pos[i]=-1000; kyori[i]=0x1fffffff; if(i==cur_ofs)continue; if(get_poly_point(&x,&y,&z,i)==0)continue; pos[0]=x; pos[1]=y; pos[2]=z; sceVu0RotTransPers(v,ScreenLocalMatrix,pos,2); x_pos[i]=v[0]>>4; y_pos[i]=v[1]>>4; kyori[i]=(xxx-x_pos[i])*(xxx-x_pos[i])+(yyy-y_pos[i])*(yyy-y_pos[i]); } hit=-1; lng2=lng=0x1fffffff; for(j=0;j<=CHECK_ID_MAX;j++){ for(i=0;i<=CHECK_ID_MAX;i++){ if(i==cur_ofs)continue; if(x_pos[i]==-1000 && y_pos[i]==-1000)continue; wk=(xx-x_pos[i])*(xx-x_pos[i])+(yy-y_pos[i])*(yy-y_pos[i]); if(wk<lng){ wk2=(xxx-x_pos[i])*(xxx-x_pos[i])+(yyy-y_pos[i])*(yyy-y_pos[i]); if(wk < kyori[i]){ if(lng2*2 > wk2){ lng=wk; hit=i; lng2=wk2; } } } } xx+=x_add; yy+=y_add; } if(hit>=0){ cur_ofs=hit; } return cur_ofs; } #endif typedef struct{ int flg; }SA_WORLD_MAP_WIN_SUB; static SA_WORLD_MAP_WIN_SUB sa_world_map_win_sub[SA_WORLD_MAP_WIN_MAX]; static SA_COLOR win_color[SA_WORLD_MAP_WIN_MAX]; static void world_mask_icon_put(int ofs){ unsigned char *image; unsigned char *clut; int x,y; unsigned int vram_old=sa_world_map.vram; sa_world_map.vram=sa_world_map_win.tmp_vram; x=sa_world_map_win.x[ofs]; y=sa_world_map_win.y[ofs]; // 奥の下敷き image=sa_world_map_win.mask_data_adr+chara_window_test_tex; clut=sa_world_map_win.mask_data_adr+chara_window_test_plt; make_sprite_packt(image,clut,x,y,chara_window_test_w_size,chara_window_test_h_size,chara_window_test_bit_size,&win_color[ofs],0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0x00000000,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); // 上の半円 sa_world_map.vram=sa_world_map_win.tmp_vram; image=sa_world_map_win.mask_data_adr+chara_window_test3_tex; clut=sa_world_map_win.mask_data_adr+chara_window_test3_plt; make_sprite_packt(image,clut,x,y,chara_window_test3_w_size,chara_window_test3_h_size/2,chara_window_test3_bit_size,&win_color[ofs],0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0x00000000,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); // アルファマスク image=sa_world_map_win.mask_data_adr+chara_window_test2_tex; clut=sa_world_map_win.mask_data_adr+chara_window_test2_plt; make_sprite_packt(image,clut,x,y,chara_window_test2_w_size,chara_window_test2_h_size,chara_window_test2_bit_size,&win_color[ofs],0,SCE_GS_SET_ALPHA( 0 , 0, 0 , 0 , 0 ),0x00ffffff,SCE_GS_SET_TEST(1, 1, 1, 0, 0, 0, 1, 2)); // キャラ sa_world_map.vram=sa_world_map_win.chr_vram[ofs]; image=NULL; clut=NULL; make_sprite_packt(image,clut,x,y,128,128,32,&win_color[ofs],0,SCE_GS_SET_ALPHA( 0 , 2, 1 , 2 , 0 ),0x00000000,SCE_GS_SET_TEST(1, 6, 1, 0, 1, 1, 1, 2)); // 下の半円 sa_world_map.vram=sa_world_map_win.tmp_vram; image=sa_world_map_win.mask_data_adr+chara_window_test3_tex+chara_window_test3_w_size*(chara_window_test3_h_size/2)*chara_window_test3_bit_size/8; clut=sa_world_map_win.mask_data_adr+chara_window_test3_plt; make_sprite_packt(image,clut,x,y+chara_window_test3_h_size/2,chara_window_test3_w_size,chara_window_test3_h_size/2,chara_window_test3_bit_size,&win_color[ofs],0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); sa_world_map.vram=vram_old; } static void world_mes_put(int ofs){ int mes_no; int x,y; int xx,yy; Q_WORDDATA *pbuf,*pbuf2; unsigned char *image; unsigned char *clut; unsigned int vram_old=sa_world_map.vram; sa_world_map.vram=sa_world_map_win.tmp_vram; // ウィンドウ x=sa_world_map_win.x[ofs]; y=sa_world_map_win.y[ofs]; if(sa_world_map_win.right_reft[ofs]){ // ウィンドウ左 xx=x=sa_world_map_win.x[ofs]; yy=y=sa_world_map_win.y[ofs]; x-=370+8; y+=20-16; xx-=310+4; yy+=48; }else{ // ウィンドウ右 xx=x=sa_world_map_win.x[ofs]; yy=y=sa_world_map_win.y[ofs]; x-=14-8; y+=20-16; xx+=156+14; yy+=48; } if(sa_world_map_win.right_reft[ofs]==0){ image=sa_world_map_win.mask_data_adr+chara_window_test5_tex; clut=sa_world_map_win.mask_data_adr+chara_window_test5_plt; make_sprite_packt(image,clut,x,y,chara_window_test5_w_size,chara_window_test5_h_size,chara_window_test5_bit_size,&win_color[ofs],0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0x00000000,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); }else{ image=sa_world_map_win.mask_data_adr+chara_window_test4_tex; clut=sa_world_map_win.mask_data_adr+chara_window_test4_plt; make_sprite_packt(image,clut,x,y,chara_window_test4_w_size,chara_window_test4_h_size,chara_window_test4_bit_size,&win_color[ofs],0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0x00000000,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); } // レジスタを戻す pbuf=(Q_WORDDATA*)packet[0]; pbuf[0].ul128 = (u_long128)0; pbuf2=pbuf+1; mes_no=sa_world_map_win.mes_no[ofs]; if(mes_no>0){ pbuf2[0].ul64[0] = SCE_GIF_SET_TAG(2, 0, 0, 0, 0, 1); }else{ pbuf2[0].ul64[0] = SCE_GIF_SET_TAG(2, 1, 0, 0, 0, 1); } pbuf2[0].ul64[1] = 0xe; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_TEST(1, 5, 1, 0, 0, 0, 0, 0); pbuf2[0].ul64[1] = SCE_GS_TEST_1; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ); pbuf2[0].ul64[1] = SCE_GS_ALPHA_1; pbuf2++; if(mes_no>0){ YiSetSystemMsg(sa_world_map_win.mes_data_adr,sa_world_map_win.mes_data_o_adr); // 自分のメッセージバッファ設定 pbuf2=(Q_WORDDATA*)YiSetMsgListPacketDetail(pbuf2, 1 , 0 , SA_RGBA32(win_color[ofs].r,win_color[ofs].g,win_color[ofs].b,win_color[ofs].a) ,xx, yy, mes_no , 15 ); } pbuf[0].ui32[0] = 0x10000000|(((int)pbuf2-(int)pbuf)/sizeof(Q_WORDDATA)-1); // DMA cnt packet[0]=(char*)pbuf2; sa_world_map.vram=vram_old; } static void sa_world_map_win_init_sub(void){ int i; for(i=0;i<SA_WORLD_MAP_WIN_MAX;i++){ sa_world_map_win_sub[i].flg=0; win_color[i].r=0; win_color[i].g=0; win_color[i].b=0; win_color[i].a=0; } } static int sa_world_win_sync(int ofs){ return sa_world_map_win_sub[ofs].flg; } static void sa_world_win_close(int ofs){ sa_world_map_win_sub[ofs].flg=2; } static void sa_world_win_start(int ofs){ sa_world_map_win_sub[ofs].flg=1; } static void sa_world_map_win_control_sub(unsigned int **buff){ int i,flg,alpha; #if 0 sa_world_map_win.x[0]=16+360; sa_world_map_win.y[0]=64; sa_world_map_win.right_reft[0]=1; //sa_world_map_win.x[0]=16; //sa_world_map_win.y[0]=64; //sa_world_map_win.right_reft[0]=0; #endif for(i=0;i<PACKET_MAX;i++){ packet[i]=(char*)(buff[i]); } for(i=0;i<SA_WORLD_MAP_WIN_MAX;i++){ flg=sa_world_map_win_sub[i].flg; if(flg){ switch(flg){ case 1: alpha=win_color[i].a; alpha+=0x20; if(alpha>=0x80)alpha=0x80; win_color[i].r=win_color[i].g=win_color[i].b=win_color[i].a=alpha; break; case 2: alpha=win_color[i].a; alpha-=0x20; if(alpha<0){ alpha=0; sa_world_map_win_sub[i].flg=0; } win_color[i].r=win_color[i].g=win_color[i].b=win_color[i].a=alpha; break; } world_mask_icon_put(i); world_mes_put(i); } } if((int)packet[0] != (int)buff[0]){ dma_end_set(); } for(i=0;i<PACKET_MAX;i++){ buff[i]=(unsigned int*)(packet[i]); } } SA_WORLD_MAP_WIN sa_world_map_win={ {0,0}, NULL, NULL, NULL, 0, {0,0}, {0,0}, {0,0}, {0,0}, sa_world_map_win_init_sub, sa_world_map_win_control_sub, sa_world_win_start, sa_world_win_sync, sa_world_win_close, }; static void mdl_matrix(float rx,float ry,float rz,float z,sceVu0FMATRIX WorldLocalMatrix){ sceVu0FVECTOR rot = { rx, ry, rz, 1.0f }; sceVu0FVECTOR trans = { 0.0f, 0.0f, z, 1.0f }; sceVu0FMATRIX RotMatrix; sceVu0UnitMatrix(RotMatrix); sceVu0RotMatrix(RotMatrix, RotMatrix, rot); sceVu0TransMatrix(WorldLocalMatrix, RotMatrix, trans); } static char world_id_tbl[]={ WSID_dc, WSID_tw, WSID_aw, WSID_tz, WSID_al, WSID_lm, WSID_nm, WSID_he, WSID_pp, WSID_pc, WSID_ew, WSID_monstro1, WSID_monstro2, WSID_pirate1, WSID_pirate2, WSID_warphole1_1, WSID_warphole1_2, WSID_warphole2_1, WSID_warphole2_2, WSID_warphole3_1, WSID_warphole3_2, WSID_pp_n, 0, }; static void sasa_world_key_control_task(void){ float x,y,z; double xwk,ywk,zwk,xx,yy,zz; int i; int cur_ofs_old; int cur_ofs; // now_cur_ofs=cur_ofs=ID_TOP; now_cur_ofs=cur_ofs=sa_world_map.start_id; printf("input start_id=%d\n",sa_world_map.start_id); for(;;){ if(get_poly_point(&x,&y,&z,cur_ofs))break; cur_ofs++; now_cur_ofs=cur_ofs; } now_id=cur_ofs; printf("get cur_ofs=%d\n",cur_ofs); switch(cur_ofs){ case 21: // 21 case 22: // 22 case 23: // 23 case 24: // 24 case 25: // 25 case 26: // 26 wape_flg=1; break; default: wape_flg=0; break; } key_on_flg=0; if(cur_ofs>=ID_TOP && cur_ofs <= CHECK_ID_MAX){ if((sa_world_map.world_flg[cur_ofs] & WORLD_NORMAL_DISP)){ if((sa_world_map.world_flg[cur_ofs] & WORLD_KEY_DISP)){ key_on_flg=1; } } } cur_x_3d=x; cur_y_3d=y; cur_z_3d=z; camera_p[0]=x; task_wait(2); put_cur_no=CUR_TYPE_STOP; for(;;){ // デバッグルーチン #if WORLD_SEL_DEBUG == 1 if(YaPad[0].trigger & SA_PAD_R1){ for(i=0;;i++){ if(world_id_tbl[i]==0)break; if(world_id_tbl[i]==sa_world_map.start_id)break; } if(world_id_tbl[i]){ if(world_id_tbl[i+1]==0){ sa_world_map.start_id=world_id_tbl[0]; }else{ sa_world_map.start_id=world_id_tbl[i+1]; } } } #endif // //printf("YaPad[0].trigger=%x\n",YaPad[0].trigger); if(YaPad[0].trigger & SA_PAD_RU){ { sceVu0FMATRIX m; float rz,ry,z; sa_world_map.world_mdl_sync=0; TiWSReadWorldIcon(now_cur_ofs); for(;;){ if(sa_world_map.world_mdl_sync)break; task_wait(1); } if(sa_world_map.world_mdl_sync>0){ task_wait(1); rz=0.0f; ry=0.0f; z=6000.0f+20000.0f; sa_world_map.r=sa_world_map.g=sa_world_map.b=0; for(i=0;i<10;i++){ sa_world_map.a=i*4; z-=20000.0f/10.0f; mdl_matrix(0.0f,ry,rz,z,m); TiWSDrawWorldIconWS(0,0,m); task_wait(1); } for(;;){ if((YaPad[0].button>>16) & SA_PAD_R)ry+=0.1f; if((YaPad[0].button>>16) & SA_PAD_L)ry-=0.1f; if((YaPad[0].button>>16) & SA_PAD_U)rz+=0.1f; if((YaPad[0].button>>16) & SA_PAD_D)rz-=0.1f; if((YaPad[0].button) & SA_PAD_RD)break; if(ry>=3.14f)ry-=2.0f*3.14f; if(ry<=-3.14f)ry+=2.0f*3.14f; if(rz>=3.14f)rz-=2.0f*3.14f; if(rz<=-3.14f)rz+=2.0f*3.14f; mdl_matrix(0.0f,ry,rz,z,m); TiWSDrawWorldIconWS(0,0,m); task_wait(1); } for(i=0;i<10;i++){ sa_world_map.a=(9-i)*4; z+=20000.0f/10.0f; mdl_matrix(0.0f,ry,rz,z,m); TiWSDrawWorldIconWS(0,0,m); task_wait(1); } sa_world_map.a=0; task_wait(1); } } } if(((YaPad[0].button>>16) & (SA_PAD_R | SA_PAD_L | SA_PAD_U | SA_PAD_D)) && start_flg){ cur_ofs_old=cur_ofs; cur_ofs=get_next_pos(YaPad[0].button>>16,cur_ofs); //printf("get cur_ofs=%d\n",cur_ofs); if(cur_ofs_old != cur_ofs){ cur_ofs_old=cur_ofs; now_id=-1; if(get_poly_point(&x,&y,&z,cur_ofs)){ key_on_flg=0; xx=(double)cur_x_3d; yy=(double)cur_y_3d; zz=(double)cur_z_3d; xwk=(double)(x-cur_x_3d); ywk=(double)(y-cur_y_3d); zwk=(double)(z-cur_z_3d); xwk/=10.0; ywk/=10.0; zwk/=10.0; put_cur_no=CUR_TYPE_MOVE; for(i=0;i<10;i++){ xx+=xwk; yy+=ywk; zz+=zwk; cur_x_3d=(float)xx; cur_y_3d=(float)yy; cur_z_3d=(float)zz; camera_p[0]=cur_x_3d; task_wait(1); } cur_x_3d=x; cur_y_3d=y; cur_z_3d=z; camera_p[0]=x; put_cur_no=CUR_TYPE_STOP; now_cur_ofs=cur_ofs; now_id=cur_ofs; dkSOUND_SystemSePlay(SE_SYSTEM_CURSOR_MOVE); //printf("cur_ofs=%d\n",cur_ofs); switch(cur_ofs){ case 21: // 21 case 22: // 22 case 23: // 23 case 24: // 24 case 25: // 25 case 26: // 26 wape_flg=1; break; default: wape_flg=0; break; } // key_on_flg=0; // if(cur_ofs>=ID_TOP && cur_ofs <= CHECK_ID_MAX){ // if((sa_world_map.world_flg[cur_ofs] & WORLD_NORMAL_DISP)){ // if((sa_world_map.world_flg[cur_ofs] & WORLD_KEY_DISP)){ // key_on_flg=1; // } // } // } } } } task_wait(1); } } static int ControlMenu(void){ if(YiWinGetExec()){ YiWinControl(); return 0; }else{ if(win_all_close==0){ return (_YA_TASK_UNLINK); }else{ return 0; } } } static void world_map_mes_init(void){ YA_TASK_HEAD *task; YI_WIN *win_menu; win_all_close=-1; task = YaLinkMainTask(DK_MAIN_PRI_WINDOW+1, ControlMenu); if(wape_gumi_flg){ top_mes_put.list_max=2; }else{ top_mes_put.list_max=1; } if((win_menu = YiWinOpenAction(&top_mes_put, YI_WIN_ACTION_QUICK))) { } } static void sasa_world_control_task(void){ int i,cnt; printf("sasa_world_control_task()\n"); win_x=win_y=start_flg=fuki_x=fuki_y=0; sa_data_buff[0]=sa_file_read_buff; wape_flg=0; sa_data_buff[1]=sa_file_read("worldmap/world.ps2",sa_data_buff[0],0x100,NULL); printf("world map date file read done.\n"); bottom_tex=sa_file_read("worldmap/wm_route.ps2",sa_data_buff[1],0x100,NULL); printf("world map route date file read done.\n"); mes_buff=sa_file_read("worldmap/wdata.bin",bottom_tex,0x10,NULL); printf("world map bottom tex file read done.\n"); mes_buffo=sa_file_read("worldmap/SAWDMSG.BIN",mes_buff,0x10,NULL); printf("world map mes0 file read done.\n"); sa_file_read("worldmap/SAWDOMSG.BIN",mes_buffo,0x10,NULL); printf("world map mes1 file read done.\n"); #if DVD_MODE == 1 #if 0 sa_world_map.world_flg[WSID_dc]=2; sa_world_map.world_flg[WSID_tw]=2; sa_world_map.world_flg[WSID_aw]=1+1; sa_world_map.world_flg[WSID_tz]=1+1; sa_world_map.world_flg[WSID_al]=1+1; sa_world_map.world_flg[WSID_lm]=1+1; sa_world_map.world_flg[WSID_nm]=1+1; sa_world_map.world_flg[WSID_he]=1+1; sa_world_map.world_flg[WSID_pp]=0; sa_world_map.world_flg[WSID_pp_n]=2; sa_world_map.world_flg[WSID_pc]=1+1; sa_world_map.world_flg[WSID_ew]=1+1; sa_world_map.world_flg[WSID_monstro1]= 0; sa_world_map.world_flg[WSID_monstro2]= 0; sa_world_map.world_flg[WSID_pirate1]= 0; sa_world_map.world_flg[WSID_pirate2]= 0; sa_world_map.world_flg[WSID_warphole1_1]=2; sa_world_map.world_flg[WSID_warphole1_2]=2; sa_world_map.world_flg[WSID_warphole2_1]=2; sa_world_map.world_flg[WSID_warphole2_2]=2; sa_world_map.world_flg[WSID_warphole3_1]=2; sa_world_map.world_flg[WSID_warphole3_2]=2; #endif #endif if(TiGetGumiCount(GUMI_GUMMY_WARP_1)){ wape_gumi_flg=1; }else{ wape_gumi_flg=0; } set_matrix(); make_poly_packt(now_cur_ofs); world_map_mes_init(); world_task_buff->task_create(sasa_world_key_control_task,1,0); task_wait(2); ////フェードアウトが完了するまで待つ while(dkOverDispFadeFlag)task_wait(1); dkVsyncLimit = DK_LIMIT_30; cnt=30; ////フェードインを行う dkDBUF_AllFadeIn(30); for(i=0;i<cnt;i++){ set_matrix(); make_poly_packt(now_cur_ofs); task_wait(1); } start_flg=1; for(;;){ set_matrix(); make_poly_packt(now_cur_ofs); task_wait(1); } } SA_WORLD_MAP sa_world_map={ sa_world_map_init, sa_world_map_control, sa_world_map_sync, 0, 0 }; //--------------------------------------------------------------------------------- // // 上陸地点セレクト(伊藤さんタスク) // static void sa_point_sel_sub(SA_POINT_SEL *point,int alpha,int ofs){ SA_COLOR color; char *first_prim_buff; char *work=point->work_ram; Q_WORDDATA *pbuf,*pbuf2; int x,y,y2,x2,eop,i; unsigned int rgba; unsigned char *image,*clut; int xx[4],yy[4]; SA_COLOR color2[4]; int alpha2; sa_world_map.vram=point->tmp_vram; x=0; y=70; ///バッファを取得 first_prim_buff=packet[0]=(char*)TiWmGetPrimBuff(); color.a=alpha; color.r=color.g=color.b=0; color.r=255; make_sprite_packt(work+randing_pt_sel_tex,work+randing_pt_sel_plt,x,y,randing_pt_sel_w_size,randing_pt_sel_h_size,randing_pt_sel_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); //------------------------------------------------ color.r=color.g=color.b=0; color.a=90; make_flat_packt(0,0,512,40,&color,SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ),SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); //------------------------------------------------ pbuf=(Q_WORDDATA*)packet[0]; pbuf[0].ul128 = (u_long128)0; pbuf2=pbuf+1; pbuf2[0].ul64[0] = SCE_GIF_SET_TAG(2, 0, 0, 0, 0, 1); pbuf2[0].ul64[1] = 0xe; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_TEST(1, 5, 1, 0, 0, 0, 0, 0); pbuf2[0].ul64[1] = SCE_GS_TEST_1; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ); pbuf2[0].ul64[1] = SCE_GS_ALPHA_1; pbuf2++; eop=1; color.r=color.g=color.b=(230*alpha)/128; color.a=(80*alpha)/100; rgba=YI_RGBA32(color.r,color.g,color.b,color.a); YiSetSystemMsg(work+Sapomsg_bin,work+Sapoomsg_bin); // 自分のメッセージバッファ設定 pbuf2=(Q_WORDDATA*)YiSetMsgListPacketDetail(pbuf2,eop , 2 , rgba ,512/2,12, SA_MSG_JO , 16 ); pbuf[0].ui32[0] = 0x10000000|(((int)pbuf2-(int)pbuf)/sizeof(Q_WORDDATA)-1); // DMA cnt packet[0]=(char*)pbuf2; //-------------------------------------------- color.r=color.g=color.b=(0x80*alpha)/128; color.a=(77*alpha)/128; image=work+wsel_title_arrw2_tex; // < clut=work+wsel_title_arrw2_plt; make_sprite_packt(image,clut,90+12*0,8,wsel_title_arrw2_w_size,wsel_title_arrw2_h_size,wsel_title_arrw2_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha)/128; color.a=(102*alpha)/128; image=work+wsel_title_arrw2_tex; // < clut=work+wsel_title_arrw2_plt; make_sprite_packt(image,clut,90+12*1,8,wsel_title_arrw2_w_size,wsel_title_arrw2_h_size,wsel_title_arrw2_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha)/128; color.a=(128*alpha)/128; image=work+wsel_title_arrw2_tex; // < clut=work+wsel_title_arrw2_plt; make_sprite_packt(image,clut,90+12*2,8,wsel_title_arrw2_w_size,wsel_title_arrw2_h_size,wsel_title_arrw2_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha)/128; color.a=(128*alpha)/128; image=work+wsel_title_arrw2_tex; // < clut=work+wsel_title_arrw2_plt; make_sprite_packt(image,clut,394+12*0,8,wsel_title_arrw2_w_size,wsel_title_arrw2_h_size,wsel_title_arrw2_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha)/128; color.a=(102*alpha)/128; image=work+wsel_title_arrw2_tex; // < clut=work+wsel_title_arrw2_plt; make_sprite_packt(image,clut,394+12*1,8,wsel_title_arrw2_w_size,wsel_title_arrw2_h_size,wsel_title_arrw2_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha)/128; color.a=(77*alpha)/128; image=work+wsel_title_arrw2_tex; // < clut=work+wsel_title_arrw2_plt; make_sprite_packt(image,clut,394+12*2,8,wsel_title_arrw2_w_size,wsel_title_arrw2_h_size,wsel_title_arrw2_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); //------------------------------------------------ // ワールド セレクト pbuf=(Q_WORDDATA*)packet[0]; pbuf[0].ul128 = (u_long128)0; pbuf2=pbuf+1; pbuf2[0].ul64[0] = SCE_GIF_SET_TAG(2, 0, 0, 0, 0, 1); pbuf2[0].ul64[1] = 0xe; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_TEST(1, 5, 1, 0, 0, 0, 0, 0); pbuf2[0].ul64[1] = SCE_GS_TEST_1; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ); pbuf2[0].ul64[1] = SCE_GS_ALPHA_1; pbuf2++; eop=1; color.r=color.g=color.b=(230*alpha)/128; if(ofs == 5){ color.a=(80*alpha)/100; alpha2=0x80; }else{ color.a=(20*alpha)/100; alpha2=0x40; } YiSetSystemMsg(work+Sapomsg_bin,work+Sapoomsg_bin); // 自分のメッセージバッファ設定 rgba=YI_RGBA32(color.r,color.g,color.b,color.a); pbuf2=(Q_WORDDATA*)YiSetMsgListPacketDetail(pbuf2,eop , 0 , rgba ,x+64, y+49+32*5, SA_MSG_WA , 15 ); pbuf[0].ui32[0] = 0x10000000|(((int)pbuf2-(int)pbuf)/sizeof(Q_WORDDATA)-1); // DMA cnt packet[0]=(char*)pbuf2; color.r=color.g=color.b=(0x80*alpha2)/128; color.a=(77*alpha2)/128; image=work+wsel_title_arrw2_small_tex; // < clut=work+wsel_title_arrw2_small_plt; make_sprite_packt(image,clut,x+16+12*0,y+47+32*5,wsel_title_arrw2_small_w_size,wsel_title_arrw2_small_h_size,wsel_title_arrw2_small_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha2)/128; color.a=(102*alpha2)/128; image=work+wsel_title_arrw2_small_tex; // < clut=work+wsel_title_arrw2_small_plt; make_sprite_packt(image,clut,x+16+12*1,y+47+32*5,wsel_title_arrw2_small_w_size,wsel_title_arrw2_small_h_size,wsel_title_arrw2_small_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha2)/128; color.a=(128*alpha2)/128; image=work+wsel_title_arrw2_small_tex; // < clut=work+wsel_title_arrw2_small_plt; make_sprite_packt(image,clut,x+16+12*2,y+47+32*5,wsel_title_arrw2_small_w_size,wsel_title_arrw2_small_h_size,wsel_title_arrw2_small_bit_size,&color,0,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha2)/128; color.a=(128*alpha2)/128; image=work+wsel_title_arrw2_small_tex; // < clut=work+wsel_title_arrw2_small_plt; make_sprite_packt(image,clut,x+16+180+12*0,y+47+32*5,wsel_title_arrw2_small_w_size,wsel_title_arrw2_small_h_size,wsel_title_arrw2_small_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha2)/128; color.a=(102*alpha2)/128; image=work+wsel_title_arrw2_small_tex; // < clut=work+wsel_title_arrw2_small_plt; make_sprite_packt(image,clut,x+16+180+12*1,y+47+32*5,wsel_title_arrw2_small_w_size,wsel_title_arrw2_small_h_size,wsel_title_arrw2_small_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); color.r=color.g=color.b=(0x80*alpha2)/128; color.a=(77*alpha2)/128; image=work+wsel_title_arrw2_small_tex; // < clut=work+wsel_title_arrw2_small_plt; make_sprite_packt(image,clut,x+16+180+12*2,y+47+32*5,wsel_title_arrw2_small_w_size,wsel_title_arrw2_small_h_size,wsel_title_arrw2_small_bit_size,&color,1,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 ),0,SCE_GS_SET_TEST(1, 6, 1, 0, 0, 0, 1, 2)); //------------------------------------------------ // レジスタを戻す y2=y; x2=x; if(point->point_mes_buff[0] != 0 || point->title_mes_buff != NULL){ pbuf=(Q_WORDDATA*)packet[0]; pbuf[0].ul128 = (u_long128)0; pbuf2=pbuf+1; pbuf2[0].ul64[0] = SCE_GIF_SET_TAG(2, 0, 0, 0, 0, 1); pbuf2[0].ul64[1] = 0xe; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_TEST(1, 5, 1, 0, 0, 0, 0, 0); pbuf2[0].ul64[1] = SCE_GS_TEST_1; pbuf2++; pbuf2[0].ul64[0] = SCE_GS_SET_ALPHA( 0 , 1, 0 , 1 , 0 ); pbuf2[0].ul64[1] = SCE_GS_ALPHA_1; pbuf2++; if(point->title_mes_buff != 0){ eop=0; if(point->point_mes_buff[0]==NULL)eop=1; color.a=128; color.r=color.g=color.b=(230*alpha)/128; rgba=YI_RGBA32(color.r,color.g,color.b,color.a); pbuf2=(Q_WORDDATA*)YiSetMsgDataPacketDetail(pbuf2,eop, 2 , rgba ,x+122, y+14, point->title_mes_buff , 15 ); } x+=16; y+=52; eop=0; color.r=color.g=color.b=(230*alpha)/128; for(i=0;;i++){ if(point->point_mes_buff[i]==NULL)break; if(point->point_mes_buff[i+1]==NULL)eop=1; if(i == ofs){ color.a=(80*alpha)/100; }else{ color.a=(20*alpha)/100; } rgba=YI_RGBA32(color.r,color.g,color.b,color.a); pbuf2=(Q_WORDDATA*)YiSetMsgDataPacketDetail(pbuf2,eop , 2 , rgba ,x+90, y, point->point_mes_buff[i] , 15 ); y+=32; } pbuf[0].ui32[0] = 0x10000000|(((int)pbuf2-(int)pbuf)/sizeof(Q_WORDDATA)-1); // DMA cnt packet[0]=(char*)pbuf2; } if(point->point_mes_buff[0] != 0){ y2+=52+16+1; for(i=0;i<=5;i++){ //------------------------------------------------ if(i == ofs){ color2[0].r=color2[2].r=80; color2[0].g=color2[2].g=80; color2[0].b=color2[2].b=80; color2[0].a=color2[2].a=80; color2[1].r=color2[3].r=0; color2[1].g=color2[3].g=0; color2[1].b=color2[3].b=0; color2[1].a=color2[3].a=0; }else{ color2[0].r=color2[2].r=40; color2[0].g=color2[2].g=40; color2[0].b=color2[2].b=40; color2[0].a=color2[2].a=40; color2[1].r=color2[3].r=0; color2[1].g=color2[3].g=0; color2[1].b=color2[3].b=0; color2[1].a=color2[3].a=0; } xx[0]=x2; yy[0]=y2+1; xx[1]=x2+340; yy[1]=y2+1; xx[2]=x2; yy[2]=y2+3; xx[3]=x2+340; yy[3]=y2+3; make_gra(color2,xx,yy,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 )); xx[0]=x2; yy[0]=y2+2; xx[1]=x2+340; yy[1]=y2+2; xx[2]=x2; yy[2]=y2+2; xx[3]=x2+340; yy[3]=y2+2; make_gra(color2,xx,yy,SCE_GS_SET_ALPHA( 0 , 2, 0 , 1 , 0 )); //------------------------------------------------ y2+=32; } } dma_end_set(); ///バッファを設定 TiWmSetPrimBuff(packet[0]); /////描画キューに登録 TiKdSetDrawPrim(point->prior,first_prim_buff); } int sa_point_sel(SA_POINT_SEL *point){ int size,i; char *name="worldmap/psel.bin"; char *work=point->work_ram; int alpha,ofs,ofs2; int ret=0; size=ti_file_read(name,work); if(size > point->work_ram_size){ printf("file <%s> buffer over %d > %d !!!\n",name , size,(int)point->work_ram_size); asm __volatile__ ("break"); } for(i=0;i<POINT_MES_BUFF_MAX;i++){ if(point->point_mes_buff[i]==NULL)break; } for(;i<POINT_MES_BUFF_MAX;i++){ point->point_mes_buff[i]=NULL; } alpha=0; ofs2=ofs=0; for(;;){ alpha+=0x20; if(alpha>=0x80)break; sa_point_sel_sub(point,alpha,ofs); TiEntryTask(); } alpha=0x80; for(;;){ if(YaPad[0].trigger & SA_PAD_RR){ dkSOUND_SystemSePlay(SE_SYSTEM_OK); break; } #if DVD_MODE == 1 if(YaPad[0].trigger & SA_PAD_RD){ ret=1; dkSOUND_SystemSePlay(SE_SYSTEM_CANCEL); break; } #endif if(YaPad[0].repeat & SA_PAD_U){ ofs--; if(ofs<0){ ofs=5; }else{ if(point->point_mes_buff[ofs]==NULL){ for(i=ofs;i>=0;i--){ if(point->point_mes_buff[i] != NULL)break; } ofs=i; } } } if(YaPad[0].repeat & SA_PAD_D){ if(ofs==5){ ofs=0; }else{ ofs++; if(point->point_mes_buff[ofs]==NULL){ ofs=5; } } } sa_point_sel_sub(point,alpha,ofs); if(ofs != ofs2){ ofs2=ofs; dkSOUND_SystemSePlay(SE_SYSTEM_CURSOR_MOVE); } TiEntryTask(); } point->select_point=ofs; for(;;){ alpha-=0x20; if(alpha < 0)break; sa_point_sel_sub(point,alpha,ofs); TiEntryTask(); } return ret; } //---------------------------------------------------------------------------------
Oddities
Gummi Ship Default Name
When playing through the game normally, you'd get an option to name the raft and it would be the default name of the Gummi Ship depending on whether you win the race or not. If you somehow bypass this though, which is only possible via hacking or cheats, the default name of the Gummi Ship will be Kingdom, which is also the model's name.
Version Differences
This page or section needs more images. There's a whole lotta words here, but not enough pictures. Please fix this. |
Kingdom Hearts has been reissued a total of four times. One for the international release which has some unique additions, the Japan-exclusive Final Mix version with some new content, and an international re-release of the Final Mix version as HD 1.5 ReMIX.
Changes from the original Japanese to International versions
- Difficulty options have been added, allowing the player to choose between the default "Normal" difficulty and an "Expert" difficulty mode, when starting a new game.
- Enemy stats were rebalanced. Some general changes were made to the bosses:
- Most bosses have less HP, but higher stats elsewhere. For instance, the Rock Titan has 4500 HP in the original Japanese version and 2100 HP in the international versions.
- After the first visit to Hollow Bastion, most bosses give out a lot less experience in the international versions. For instance, regular Ursula gives 7000 EXP after Hollow Bastion in the original Japanese version, but only 1500 EXP in the international versions.
- Many bosses in the Japanese version have a x0.5 resistance to Thunder, a x0.02 resistance to Gravity, and a x0.2 resistance to Stop in the Japanese version. In the international versions, these bosses typically take regular damage from Thunder, have a x0.04 resistance to Gravity, and have a x0.3 resistance to Stop. After the first Hollow Bastion trip, the resistances are changed to x.03 and x0.2 respectively.
- The "Gold Match" and "Platinum Match" were added to Olympus Coliseum, which lets you fight Ice Titan and Sephiroth respectively as new bosses, unlocked after clearing Hollow Bastion.
- Kurt Zisa was added as an optional boss in Agrabah, accessible after clearing Hollow Bastion.
- The track "Night on Bald Mountain" was added, and plays instead of "Squirming Evil" while fighting Chernabog at the End of the World.
- One of the shortcut commands was changed from O to X, and was moved from the top to the bottom of the shortcut list. This change was reverted in the Final Mix version.
- The "Install" option on the main menu has been made inaccessible. This also renders all of its related text untranslated.
Changes from the International versions to the Japanese-exclusive Final Mix version
The Final Mix version retains all of the additional content added to the international release, as well as adding more content on top of it.
- Despite being Japan exclusive, this version uses the English dub. Since no new lines were recorded, any new scenes are left silent or voiced with re-used lines.
- A trailer for Final Fantasy X-2 was added to the main menu, labeled as "Special Movie".
- The "Install" option was also re-added. However, installation now requires the HDD to have the PlayStation Broadband Navigator interface installed. As such, all text referencing the HDD now refers to it as "PlayStation BB Unit" instead of "Hard Disk Drive".
- Sora's character model will now turn transparent if the camera gets too close to him.
- The difficulty system has been altered, now having 3 difficulties: Final Mix Beginner, Final Mix Normal, and Final Mix Proud.
- Multiple new synthesis items and equipment have been added, including new weapons for both Donald (Fantasista) and Goofy (Seven Elements). As a result, the synthesis chart received a massive overhaul.
- Almost all Heartless have been recolored, and eleven new ones have been added. Two recolors of the Behemoth Heartless have also been made into unique enemies.
- Most enemies have the same stats as the international versions. However, a couple of tweaks were made:
- Sephiroth gives 18,000 EXP in the international versions, but only 10,000 EXP in the Final Mix version.
- The Strength for the Agrabah bosses was lowered from 18 to 17, which is the same as the original Japanese version.
- Sora can now obtain the Diamond Dust and One Winged Angel Keyblades from the Gold and Platinum matches in Olympus Coliseum. Donald and Goofy also have two new weapons that can be found at the End of the World.
- Eleven new abilities have been added. The order that abilities are learned in has also been changed to reflect their addition.
- The Unknown can be fought in Hollow Bastion as an optional boss after reaching the Final Rest in the End of the World.
- Three new Ansem Reports were added, now dropped by the Unknown (AKA: Xemnas), Kurt Zisa, and Sephiroth.
- New cutscenes, including a new secret movie, and 3 Gummi Ship missions for each world were added.
- Cutscenes can now be skipped after viewing them once.
- The contents of most treasure chests in the game have been changed.
- A miss-able Red Trinity located inside Oogie's Manor at the Halloween Town world has been moved to a different location, due to the place becoming destroyed and inaccessible later in the story.
- The damage output of the Wooden Sword in Hollow Bastion has been heavily weakened to do little-to-no-damage compared to the original version of the game.
- Numerous formulae, character stats, equipment, and abilities were adjusted for game balance. For example, Goofy's MP Gift ability was changed to require 2 MP to use.
Differences between PS2 Final Mix and HD Remix 1.5 versions
- The "Install" option has been removed again, this time because the game lacks the system permissions to install data (or even know what media it is being loaded from). The Final Fantasy X-2 trailer is also gone.
- Cutscenes can be skipped at any point. Furthermore, it is possible to pause during the FMV cutscenes, such as the opening and ending movies. However, on the PlayStation 3 version, these FMVs cannot be skipped; this functionality was added in the later versions for PlayStation 4, Xbox One, PC, and Nintendo Switch.
- A new ability - EXP Zero - was added, available from the start of the game. It functions as it does in later titles (disabling the gaining of experience) while also enabling the Damage Storage exploit and functioning as a poor man's Second Chance ability, effectively activating only at full HP rather than at 2 HP (although it stacks with Aero, allowing Sora to take several hits). Combo Master has also been added, acting as it does in Kingdom Hearts II Final Mix, and is unlocked at level 50 regardless of Sora's class.
- Unlike the original Final Mix, the Japanese version now has the full Japanese dub instead of the English one. The Final Mix exclusive cutscenes are completely voiceless outside of aforementioned Japanese dub.
- The camera can now be controlled with the right stick/mouse.
- The command menu has been redesigned, with the "Summons" option now being the fourth option instead of inside the magic menu, and with all context sensitive actions being mapped to the Triangle/Y buttons like future games.
- The PlayStation 4, Xbox One, and Nintendo Switch versions add a Theater Menu to the title screen, allowing all of the game's cutscenes to be viewed at any time, regardless of progress made in the game. Rather than simply replaying the in-engine cutscenes, they are presented as video files, many of which have been edited together. The PlayStation 4 version adds this mode through a 10.5GB free DLC download from the PlayStation Store. However, even if the DLC is not installed, the Theater option remains on the title screen and selecting the option will cause the game to crash.
- The size of the text has been adjusted to compensate for the increased internal rendering resolution.
References
The Kingdom Hearts series
| |
---|---|
PlayStation 2 | Kingdom Hearts • Kingdom Hearts II • Re:Chain of Memories (Prototype) |
Game Boy Advance | Chain of Memories |
Nintendo DS | 358/2 Days • Re:coded |
PlayStation Portable | Birth by Sleep |
Nintendo 3DS | Dream Drop Distance |
PlayStation 3 | Kingdom Hearts HD 1.5 ReMIX (Prototype) |
PlayStation 4, Xbox One, Windows, Nintendo Switch | Kingdom Hearts HD 1.5+2.5 ReMIX • Kingdom Hearts III (Prototypes) |
- Pages missing developer references
- Games developed by Squaresoft
- Pages missing publisher references
- Games published by Square
- Games published by Square EA
- Games published by SCEE
- PlayStation 2 games
- Pages missing date references
- Games released in 2002
- Games released in March
- Games released on March 28
- Games released in December
- Games released on December 26
- Games with unused areas
- Games with uncompiled source code
- Games with unused graphics
- Games with regional differences
- Games with revisional differences
- Stubs
- To do
- Needs more images
- Kingdom Hearts series
Cleanup > Needs more images
Cleanup > Pages missing date references
Cleanup > Pages missing developer references
Cleanup > Pages missing publisher references
Cleanup > Stubs
Cleanup > To do
Games > Games by content > Games with regional differences
Games > Games by content > Games with revisional differences
Games > Games by content > Games with uncompiled source code
Games > Games by content > Games with unused areas
Games > Games by content > Games with unused graphics
Games > Games by developer
Games > Games by developer > Games developed by Square Enix > Games developed by Square > Games developed by Squaresoft
Games > Games by platform > PlayStation 2 games
Games > Games by publisher > Games published by Electronic Arts
Games > Games by publisher > Games published by Sony > Games published by Sony Interactive Entertainment > Games published by Sony Computer Entertainment > Games published by SCEE
Games > Games by publisher > Games published by Square Enix > Games published by Square
Games > Games by publisher > Games published by Square Enix > Games published by Square > Games published by Square EA
Games > Games by release date > Games released in 2002
Games > Games by release date > Games released in December
Games > Games by release date > Games released in December > Games released on December 26
Games > Games by release date > Games released in March
Games > Games by release date > Games released in March > Games released on March 28
Games > Games by series > Kingdom Hearts series