1#pragma helper_mask_gpr 0x30
2#pragma helper_mask_fpr 0x1000
12#include "menu_draw.hpp"
13#include "menu_inventory.hpp"
14#include "menu_manual.hpp"
51enum EAST_KING_EVENT_MODE {
55 EAST_KING_MESSAGE_FADE_OUT,
56 EAST_KING_MESSAGE_FADE_IN,
64s16 PrevEastKingSndVol;
67u_int *EastKingSndReadBuf;
78s8 EastKingMsgMax[12] = {2, 2, 3, 3, 2, 3, 2, 2, 2, 2, 6, 1};
83static inline void ResetEastKingMessage() {
89 EastKingMsgCls.
fade = 0.0f;
99 EastKingMsgCls.
wait = 0;
100 EastKingMsgCls.
blink = 0;
105 for (
int slot = 0; slot < 10; slot++) {
106 EastKingMsgCls.
mes_no[slot] = -1;
109 for (
int value_no = 0; value_no < 8; value_no++) {
110 EastKingMsgCls.
values[value_no] = 0;
113 EastKingMsgCls.
value = 0;
123 for (
int line = 0; line < 10; line++) {
129void EastKingTextureEnter() {
130 if (EastKing.
resources_ready == 0 && ReadBGSync() == 0 && SndBgmSyncBG() == 0) {
132 {
"#frame_image#640#" SCREEN_HEIGHT_STR
"#4", EastKing.
texture_block, 0},
137 char image_name[64] =
"st.img";
138 sprintf(image_name, image_name, EastKing.
event_no);
139 textures[1].
name = (
char *) GetPackFile((u_int *) archive->
buffer, image_name, NULL);
141 TexManager.CleanUpTextureList();
142 TexManager.LoadTextureBlockEX(-1, textures);
144 u_long128 *buffer_end = EastKing.
load_buffer + (archive->
size >> 4) + 1;
145 s16 *messages = (s16 *) GetPackFile((u_int *) archive->
buffer,
"eastking.bin", NULL);
146 ResetEastKingMessage();
149 s8 font_width[8] = {16, 14, 14, 15, 15, 15, 15};
151 s8 font_width[] = {16, 14, 14, 14, 14, 14, 14};
153 EastKingMsgCls.
char_width = font_width[GetMenuLangFlag()];
164 EastKingMsgCls.
tex_buff = buffer_end;
165 EastKingMsgCls.
SetBuff(messages);
167 EastKingMsgCls.unk_02C = 0x10;
183static void EastKingMsgDraw() {
188 MenuTextureReload(EastKingMsgCls.
tex_block);
190 switch (EastKing.
mode) {
191 case EAST_KING_LOADING:
196 case EAST_KING_DIALOGUE:
197 case EAST_KING_MESSAGE_FADE_IN:
198 EastKingMsg.
alpha += 2;
200 case EAST_KING_CLOSING:
201 case EAST_KING_MESSAGE_FADE_OUT:
202 EastKingMsg.
alpha -= 2;
206 if (EastKingMsg.
alpha < 0) {
207 EastKingMsg.
alpha = 0;
210 if (EastKingMsg.
alpha > 0x80) {
211 EastKingMsg.
alpha = 0x80;
215 int half_width = EastKingMsgCls.
char_width >> 1;
216 GetMenuCommonPutXY(&EastKingMsgCls, 0x14C - half_width);
218 EastKingMsgCls.
text_y = 0x156;
220 EastKingMsgCls.
text_y = 0x132;
223 EastKingMsgCls.
Step();
228void GetPrevEastKingSndVol() {
229 PrevEastKingSndVol = SndGetBgmVol();
233int InitEastKingEvent(
int event_no,
int *texture_block, u_long128 *load_buffer) {
235void InitEastKingEvent(
int event_no,
int *texture_block, u_long128 *load_buffer) {
240 GetPathReadDifferntLang(path);
241 strcat(path,
"eastk/st%d.pak");
242 sprintf(path, path, event_no + 1);
248 EastKingSndReadBuf = (u_int *) (EastKing.
load_buffer + size / 16 + 0x10);
249 EastKingSndReadBuf = (u_int *) MenuCalcBufAlignment((u_long128 *) EastKingSndReadBuf);
250 PrevEastKingSndNo = SndGetBgmNo();
251 SndBgmLoadBG(0x16, EastKingSndReadBuf, &size);
255 EastKing.
mode = EAST_KING_LOADING;
259 EastKingMsg.
alpha = 0;
271int EastKingEventKey() {
277 switch (EastKing.
mode) {
278 case EAST_KING_LOADING:
280 EastKingTextureEnter();
283 EastKing.
mode = EAST_KING_DIALOGUE;
289 case EAST_KING_CLOSING:
296 SndBgmLoadBG(PrevEastKingSndNo, EastKingSndReadBuf, &size);
303 SndBgmFadeIn(0x3C, PrevEastKingSndVol, 0);
308 case EAST_KING_DIALOGUE:
309 if (GamePad.
Down(PAD_CROSS) != 0 && EastKingMsgCls.
State() == CLSMES_SHOWN) {
311 EastKing.
mode = EAST_KING_CLOSING;
313 SndBgmFadeOut(0x5A, 0);
315 EastKing.
mode = EAST_KING_MESSAGE_FADE_OUT;
319 }
else if (GamePad.
Down(PAD_CIRCLE) != 0) {
321 EastKing.
mode = EAST_KING_CLOSING;
325 case EAST_KING_MESSAGE_FADE_OUT:
328 if (EastKingMsg.
alpha <= 0) {
329 EastKing.
mode = EAST_KING_MESSAGE_FADE_IN;
330 EastKingMsg.
alpha = 0;
337 case EAST_KING_MESSAGE_FADE_IN:
340 if (EastKingMsg.
alpha >= 0x80) {
341 EastKing.
mode = EAST_KING_DIALOGUE;
352void EastKingEventDraw() {
353 AllFadeForMenu(0x80);
360 picture = TexManager.GetTexture(
"st1", EastKing.
texture_block);
363 DrawFullSizePicture(picture, 0, 0, 0x80);
369 switch (EastKing.
mode) {
370 case EAST_KING_LOADING:
373 case EAST_KING_CLOSING:
376 case EAST_KING_MESSAGE_FADE_OUT:
382 case EAST_KING_MESSAGE_FADE_IN:
398 AllFadeForMenu(fade);
int GetGameFlag(int flag_no)
int SetGameFlag(int flag_no, int value)
void SetBuff(short *buff)
void SetMesFukidashi(int style)
MES_LINE_POS line_pos[10]
int MakeMesWin(int mes_no)