📄 puyopuyo2.java
字号:
{
if(draw_intro())
start_cnt = 99;
} else
{
Draw_flag = false;
if(!key_pause)
{
field[0].draw(flag);
field[1].draw(flag);
} else
{
for(int i = 0; i < 2; i++)
draw_message("PAUSE", 14 + i * 94, 54, 27, 0);
}
if(flag && start_cnt > 1)
{
gc.setColor(0);
gc.fillRect(37 + offsetX, 66 + offsetY, 75, 21);
gc.setColor(65280);
gc.drawRect(37 + offsetX, offsetY + 66, 75, 21);
draw_message("START", 57, 72, 0, 2);
}
}
}
private static boolean draw_intro()
{
boolean flag = false;
int ai[] = {
2, 1, 1, 1, 2, 1, 2, 1, 2, 2,
2, 2, 3, 2, 2
};
String as[][] = {
{
"\"SKELETON-T\"", "A skeleton who", "loves tea. He's", "a member of", "\"Hachibu-shyu\"and", "as usual he", "can't rotate", "Puyos.", "", ""
}, {
"\"SUKIYA PODES\"", "He is very", "sensitive about", "people saying he", "has a big foot."
}, {
"\"NOMI\"", "He is just a", "flea, but he's", "a member of", "\"Hachibu-shyu\"."
}, {
"\"UROKO SAKANA BITO\"", "To tell the", "truth, she's a", "mermaid and she's", "very timid."
}, {
"\"SASORI MAN\"", "This mysterious", "scorpion speaks the", "kansai dialect of", "Japanese. Very affable", "and a member of", "\"Gonin-bayashi\"", "", "", ""
}, {
"\"HARPY\"", "Causes people to", "become confused", "with her bad", "singing."
}, {
"\"NASU GRAVE\"", "An eggplant as", "you can see.", "", "", "This guy will", "catch and eat kids", "who don't like", "eggplant. Maybe.", ""
}, {
"\"SUKETOUDARA\"", "He loves to dance.", "A fish dancer who", "is proud of his legs.", ""
}, {
"\"WITCH\"", "She is a", "witch.", "", "", "She has a", "slightly warped", "personality.", "", ""
}, {
"\"MINOTAUR\"", "An ax master.", "", "", "", "He has the", "dangerous habit of", "occasionally swinging", "his ax around.", ""
}, {
"\"DRACO CENTAUR\"", "A cute girl with", "horns, fangs and", "wings.", "She is sometimes", "mistaken to be", "a boy.", "", "", ""
}, {
"\"ZOH DAIMAOH\"", "A large elephant", "who likes to", "display his", "ethnicity.", "A powerful player", "who still slams", "his Puyos into", "the ground.", ""
}, {
"\"SCHEZO WEGEY\"", "A wizard with a", "crystal sword.", "His name is", "difficult to", "pronounce.", "He is looking", "for a second", "chance to beat", "ARLE with he's",
"improved ability.", "", "", "", ""
}, {
"\"RULUE\"", "Her icy gaze and", "voice causes those", "who hear it to", "shake with fear.", "Her overbearing", "laughter echoes", "around the field.", "", ""
}, {
"\"SATAN\"", "Looks a little like", "DRACO, with horns,", "fangs and wings.", "", "However, he does", "not have a tail.", "This is the", "final boss of", "the tower."
}
};
if(intro_cnt == 0 || Draw_flag)
{
Draw_flag = false;
gc.drawImage(cut_img, 105 + offsetX, 110 + offsetY, 20);
int j = (intro_cnt != 0 ? intro_page - 1 : intro_page++) * 5;
for(int i = 0; i < 5; i++)
drawCenter(0xffffff, as[enemyNo][i + j], 40 + i * 20);
System.gc();
}
if(intro_cnt++ == 100)
{
Draw_flag = true;
intro_cnt = 0;
if(intro_page == ai[enemyNo])
return true;
}
if((keyPush & 0x10c20) != 0)
{
Draw_flag = true;
return true;
} else
{
return false;
}
}
public static int draw_value(int i, int j, int k, int l)
{
do
{
j -= 8;
drawSprite(img_font[l], j, k, 10, 10, i % 10);
i /= 10;
} while(i > 0);
return j;
}
public static void draw_message(String s, int i, int j, int k, int l)
{
if(s == null || img_font[l] == null)
return;
for(int i1 = 0; i1 < s.length(); i1++)
if(s.charAt(i1) != ' ')
{
drawSprite(img_font[l], i, j, 10, 10, 10 + (s.charAt(i1) - 65) + k);
i += k != 0 ? 6 : 7;
} else
{
i += 4;
}
}
static void getImageParts(Image image, Image image1, int i)
{
int j = image1.getWidth();
int k = image1.getHeight();
int l = image.getWidth() / j;
image1.getGraphics().drawImage(image, -j * (i % l), -k * (i / l), 20);
}
static void drawSprite(Image image, int i, int j, int k, int l, int i1)
{
if(k <= 0)
k = image.getWidth();
if(l <= 0)
l = image.getHeight();
int j1 = image.getWidth() / k;
if(k == 10)
{
gc.setClip(offsetX + i, offsetY + j, k, l);
gc.drawImage(image, i + -k * (i1 % j1) + offsetX, offsetY + j + -l * (i1 / j1), 20);
gc.setClip(offsetX, offsetY, 150, 170);
} else
{
gc.drawImage(image, i + -k * (i1 % j1) + offsetX, offsetY + j + -l * (i1 / j1), 20);
}
}
static void MyRanking()
{
int i = 0;
do
{
if(i >= 5)
break;
if(my_score > hi_score[i])
{
for(int j = 4; j > i; j--)
hi_score[j] = hi_score[j - 1];
hi_score[i] = my_score;
break;
}
i++;
} while(true);
}
static void score_get(int i)
{
my_score = i;
}
static void c_Screen()
{
gc.setColor(0);
gc.fillRect(offsetX, offsetY, 150, 150);
}
static void LoadData()
{
byte abyte0[] = readSram("PuyoPuyo2");
if(abyte0 != null)
{
sound_flag = abyte0[0] != 0;
config[1] = sound_flag;
config[0] = abyte0[1] != 0;
int l = 2;
for(int i = 0; i < 5; i++)
{
for(int k = 0; k < 4; k++)
{
hi_score[i] <<= 8;
hi_score[i] += abyte0[l++] & 0xff;
}
}
} else
{
sound_flag = true;
config[1] = sound_flag;
config[0] = true;
for(int j = 0; j < 5; j++)
hi_score[j] = 0;
SaveData(true, false);
}
}
static void SaveData(boolean flag, boolean flag1)
{
byte abyte0[] = new byte[200];
abyte0[0] = (byte)(sound_flag ? 1 : 0);
abyte0[1] = (byte)(config[0] ? 1 : 0);
if(flag1)
MyRanking();
int k = 2;
for(int i = 0; i < 5; i++)
{
for(int j = 24; j >= 0; j -= 8)
abyte0[k++] = (byte)(hi_score[i] >> j & 0xff);
}
writeSram("PuyoPuyo2", abyte0, flag);
}
static void Font_Init()
{
try
{
Image_Release(1);
do
{
file_open(1);
img_font[0] = load_image();
img_font[1] = load_image();
img_font[2] = load_image();
img_font[3] = load_image();
} while(!file_close());
}
catch(Throwable throwable)
{
Font_Init();
}
}
static void Title_Init(int i)
{
try
{
Image_Release(1);
if(i == 1)
do
{
file_open(10);
img_title[0] = load_image();
img_cur_arrow = load_image();
img_cur_puyo = load_image();
} while(!file_close());
else
do
{
file_open(10);
skip_resource(2);
img_cur_puyo = load_image();
img_title[1] = load_image();
} while(!file_close());
}
catch(Throwable throwable)
{
file_close();
Title_Init(i);
}
Draw_flag = true;
}
static void GameImage1_Init()
{
try
{
Image_Release(2);
do
{
file_open(16);
for(int i = 0; i < 3; i++)
img_game[i] = load_image();
img_face = load_image();
for(int j = 0; j < 3; j++)
img_kar[j] = load_image();
} while(!file_close());
}
catch(Throwable throwable)
{
GameImage1_Init();
}
}
static void GameImage2_Init(int i)
{
try
{
if(i == 1)
{
Image_Release(3);
do
{
file_open(15);
img_stand = load_image();
} while(!file_close());
getImageParts(img_stand, cut_img, enemyNo);
img_stand = null;
} else
{
do
{
file_open(15);
skip_resource(1);
img_gframe = load_image();
img_gframe2 = load_image();
for(int j = 0; j < 10; j++)
img_spr[j] = load_image();
} while(!file_close());
}
}
catch(Throwable throwable)
{
GameImage2_Init(i);
}
}
static void Ending_Init(int i)
{
try
{
Image_Release(4);
if(i == 1)
do
{
file_open(11);
img_ending[0] = load_image();
} while(!file_close());
else
do
{
file_open(11);
skip_resource(1);
img_ending[1] = load_image();
} while(!file_close());
}
catch(Throwable throwable)
{
Ending_Init(i);
}
Draw_flag = true;
}
static void Image_Release(int i)
{
for(int j = 0; j < 2; j++)
img_title[j] = null;
img_cur_arrow = null;
img_cur_puyo = null;
for(int k = 0; k < 3; k++)
img_game[k] = null;
img_face = null;
for(int l = 0; l < 3; l++)
img_kar[l] = null;
img_stand = null;
img_gframe = null;
img_gframe2 = null;
for(int i1 = 0; i1 < 10; i1++)
img_spr[i1] = null;
for(int j1 = 0; j1 < 2; j1++)
img_ending[j1] = null;
do
switch(i)
{
case 1: // '\001'
cut_img = null;
break;
case 2: // '\002'
cut_img = Image.createImage(30, 30);
break;
case 3: // '\003'
cut_img = Image.createImage(40, 35);
break;
case 4: // '\004'
cut_img = Image.createImage(80, 60);
break;
}
while(i != 1 && cut_img == null);
System.gc();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -