📄 gamescreen.java
字号:
g.setColor(0xffabd1ff);
g.fillRect(0, 58, 176, 60);
Graphics _tmp30 = g;
Graphics _tmp31 = g;
_img[11].draw(g, 0, 71, 16 + 4);
Graphics _tmp32 = g;
Graphics _tmp33 = g;
_img[11].draw(g, 139, 71, 16 + 4);
Graphics _tmp34 = g;
Graphics _tmp35 = g;
_img[10].draw(g, _scroll - 158, 114, 16 + 4);
Graphics _tmp36 = g;
Graphics _tmp37 = g;
_img[10].draw(g, _scroll, 114, 16 + 4);
Graphics _tmp38 = g;
Graphics _tmp39 = g;
_img[10].draw(g, _scroll + 158, 114, 16 + 4);
g.setColor(-1);
g.fillRect(0, 150, 176, 54);
break;
case 4: // '\004'
Graphics _tmp40 = g;
Graphics _tmp41 = g;
_img[11].draw(g, 0, 24, 16 + 4);
Graphics _tmp42 = g;
Graphics _tmp43 = g;
_img[10].draw(g, _scroll - 132, 87, 16 + 4);
Graphics _tmp44 = g;
Graphics _tmp45 = g;
_img[10].draw(g, _scroll, 87, 16 + 4);
Graphics _tmp46 = g;
Graphics _tmp47 = g;
_img[10].draw(g, _scroll + 132, 87, 16 + 4);
g.setColor(0xff1ebd38);
g.fillRect(0, 150, 176, 54);
break;
}
for(int l = 0; l < 54; l++)
{
int i = (58 - 2 * l - (_roadX * l) / 6) + _curvX * (_road[l] / 4);
int j = ((118 + 2 * l) - (_roadX * l) / 6) + _curvX * (_road[l] / 4);
int k = 150 + l;
if(l + 150 == _Y)
{
_xLeft = i;
_xRight = j;
}
g.setColor(0xff929292);
g.drawLine(i, k, j, k);
g.setColor(-1);
if(l >= _yellow1[0] && l < _yellow1[0] + _yellow1[1] || l >= _yellow2[0] && l < _yellow2[0] + _yellow2[1])
g.drawLine((i + j) / 2 - l / 5, k, (i + j) / 2 + l / 5, k);
if(_finish._state <= 1)
{
g.setColor(-1);
if(l >= _finish._posY && l < (_finish._posY * 4) / 3)
g.drawLine(i, k, j, k);
}
g.setColor(0xffff0000);
if(l >= _yellow1[0] && l < _yellow1[0] + _yellow1[1])
g.setColor(-256);
g.drawLine(i - 1 - l / 2, k, i - 1, k);
g.setColor(0xffff0000);
if(l >= _yellow2[0] && l < _yellow2[0] + _yellow2[1])
g.setColor(-256);
g.drawLine(j + 1, k, j + l / 2 + 1, k);
}
if(_obj._state <= 1)
{
Graphics _tmp48 = g;
Graphics _tmp49 = g;
_img[18 + _obj._nb].drawFrame(g, _obj._posX, (_obj._posY + 150) - OBJ_HEIGHT[_obj._nb], _obj._zoom, 16 + 4);
}
if(_sumo._state <= 1)
{
Graphics _tmp50 = g;
Graphics _tmp51 = g;
_img[22].drawFrame(g, _sumo._posX, (_sumo._posY + 150) - 41, _sumo._zoom, 16 + 4);
}
for(byte byte0 = 0; byte0 < 3; byte0++)
if(_decor[byte0]._state <= 1)
{
Graphics _tmp52 = g;
Graphics _tmp53 = g;
_img[16 + _decor[byte0]._nb].drawFrame(g, _decor[byte0]._posX, (_decor[byte0]._posY + 150) - DECOR_HEIGHT[_level], _decor[byte0]._zoom, 16 + 4);
Graphics _tmp54 = g;
Graphics _tmp55 = g;
_img[16 + _decor[byte0]._nb].drawFrame(g, _decor[byte0]._transX, (_decor[byte0]._posY + 150) - DECOR_HEIGHT[_level], _decor[byte0]._zoom, 16 + 4);
}
Graphics _tmp56 = g;
Graphics _tmp57 = g;
_img[9].drawFrame(g, _X - 25, (_Y - 39) + _shakeY, _anim, 16 + 4);
if(_cptBoost > 0)
{
Graphics _tmp58 = g;
Graphics _tmp59 = g;
_img[24].drawFrame(g, (_X + 7) - 25, (_Y + 10) - 39, (_cptMain % 6) / 2, 16 + 4);
}
Draw_Time(g, _time, 1, 1);
Graphics _tmp60 = g;
Graphics _tmp61 = g;
_img[21].drawFrame(g, 78, 0, _position, 16 + 4);
mu.print(g, 134, 1, "" + _speed);
mu.print(g, 128, 18, "km/h");
mu.print(g, 0, 18, "" + _lap);
mu.print(g, 13, 18, "/3");
mu.print(g, 134, 1, "" + _speed);
if(_boost > 0)
{
Graphics _tmp62 = g;
Graphics _tmp63 = g;
_img[20].drawFrame(g, 0, 35, 4, 16 + 4);
mu.print(g, 21, 36, "" + _boost);
}
Graphics _tmp64 = g;
mu.print(g, 116, 188, 20, 4);
if(_cptFinish > 0)
{
Graphics _tmp65 = g;
mu.print(g, 0, 90, 39, 2);
} else
if(_cptLap > 0 && _cptMain % 4 < 2)
{
Graphics _tmp66 = g;
mu.print(g, 0, 90, 38, 2);
mu.print(g, 108, 90, "" + _lap);
}
g.setClip(0, 0, 176, 204);
Graphics _tmp67 = g;
Graphics _tmp68 = g;
_img[14].draw(g, _startX, _startY, 16 + 4);
if(_cptStart < 15)
{
Graphics _tmp69 = g;
Graphics _tmp70 = g;
_img[15].drawFrame(g, _startX + 4, _startY + 3, 0, 16 + 4);
} else
if(_cptStart < 30)
{
Graphics _tmp71 = g;
Graphics _tmp72 = g;
_img[15].drawFrame(g, _startX + 20, _startY + 3, 0, 16 + 4);
} else
{
Graphics _tmp73 = g;
Graphics _tmp74 = g;
_img[15].drawFrame(g, _startX + 36, _startY + 3, 1, 16 + 4);
}
}
void Draw_Time(Graphics g, int i, int j, int k)
{
mu.print(g, j, k, Integer.toString(i / 60));
mu.print(g, j + 3, k, " : ");
int l = i % 60;
if(l >= 10)
{
mu.print(g, j + 20, k, Integer.toString(l));
} else
{
mu.print(g, j + 20, k, "0");
mu.print(g, j + 33, k, Integer.toString(l));
}
}
void GameExit()
{
boolean flag = false;
for(byte byte0 = 0; byte0 < 25; byte0++)
if(_img[byte0] != null)
_img[byte0] = null;
music.freeMusic();
music = null;
mu = null;
_finish = null;
_obj = null;
_sumo = null;
for(byte byte1 = 0; byte1 < 3; byte1++)
_decor[byte1] = null;
}
void GameInit()
{
_rand = new Random();
_keyMap = new byte[19];
_img = new Image2[25];
_yellow1 = new int[2];
_yellow2 = new int[2];
_finish = new Object(this, (byte)1);
_obj = new Object(this, (byte)2);
_sumo = new Object(this, (byte)3);
_decor = new Object[3];
for(byte byte0 = 0; byte0 < 3; byte0++)
_decor[byte0] = new Object(this, (byte)0);
_highScores = new int[5][5];
_names = new byte[5][15];
_tmpLetter = new byte[3];
_locked = new byte[5];
music = new Sound();
Load_Records();
_begin = System.currentTimeMillis();
}
void Load_Records()
{
try
{
byte abyte0[] = new byte[182];
for(byte byte0 = 0; byte0 < 5; byte0++)
{
for(byte byte1 = 0; byte1 < 5; byte1++)
_highScores[byte0][byte1] = 50 * (byte1 + 1);
for(byte byte2 = 0; byte2 < 15; byte2++)
_names[byte0][byte2] = 122;
_locked[0] = 0;
_locked[1] = 1;
_locked[2] = 1;
_locked[3] = 1;
_locked[4] = 1;
_lang = -1;
_isMusic = 0;
}
RecordStore recordstore = RecordStore.openRecordStore("RacingRecord", true);
if(recordstore.getNumRecords() > 0)
{
recordstore.getRecord(1, abyte0, 0);
for(byte byte3 = 0; byte3 < 5; byte3++)
{
for(byte byte4 = 0; byte4 < 5; byte4++)
_highScores[byte3][byte4] = abyte0[byte3 * 20 + byte4 * 4] * 1000 + abyte0[byte3 * 20 + byte4 * 4 + 1] * 100 + abyte0[byte3 * 20 + byte4 * 4 + 2] * 10 + abyte0[byte3 * 20 + byte4 * 4 + 3];
}
for(byte byte5 = 0; byte5 < 5; byte5++)
{
for(byte byte6 = 0; byte6 < 15; byte6++)
_names[byte5][byte6] = abyte0[100 + byte5 * 15 + byte6];
}
_isMusic = abyte0[175];
_lang = abyte0[176];
for(byte byte7 = 0; byte7 < 5; byte7++)
_locked[byte7] = abyte0[177 + byte7];
} else
{
recordstore.addRecord(abyte0, 0, 182);
}
recordstore.closeRecordStore();
}
catch(Exception exception) { }
System.gc();
}
void New_Object(int i)
{
if(i == 0)
{
for(byte byte0 = 0; byte0 < 3; byte0++)
{
if(_decor[byte0]._state != 3)
continue;
_decor[byte0]._state = 0;
break;
}
} else
if(i == 2)
{
if(_obj._state == 3)
_obj._state = 0;
} else
if(i == 3 && _sumo._state == 3)
_sumo._state = 0;
}
void Reset_Data()
{
boolean flag = false;
_score = 0;
_enterScore = false;
_tmpScore = 0;
_time = 0;
_X = 88;
_Y = 203;
_anim = 3;
_finish._posY = 33;
_finish._state = 1;
_roadX = 0;
_curvX = 0;
_curvWanted = 0;
_speed = 0;
_cptTurn = 0;
_cptRace = 0;
_cptBend = 0;
_yellow1[0] = 10;
_yellow2[0] = 60;
_lap = 0;
_bendLength = 0;
_cptRoad = 0;
_startX = 60;
_startY = -20;
_rebound = 0;
_cptStart = 0;
_roadTime = System.currentTimeMillis();
_sec = System.currentTimeMillis();
_cptObj = 0;
_cptBoost = 0;
_boost = 0;
_position = 7;
_cptDecor = 40;
_cptLap = 0;
_cptFinish = 0;
_cptSumo = 10;
_offRoad = false;
_cptOff = 0;
_shakeY = 0;
_cptShake = 0;
_obj._state = 3;
_sumo._state = 3;
for(byte byte0 = 0; byte0 < 3; byte0++)
_decor[byte0]._state = 3;
if(_level == 2 || _level == 4)
_scroll = 22;
else
if(_level == 3)
_scroll = 9;
else
_scroll = 0;
if(_kart == 0)
{
_speedMax = 100;
_acc = 2;
_weight = 2;
} else
if(_kart == 1)
{
_speedMax = 90;
_acc = 3;
_weight = 1;
} else
{
_speedMax = 120;
_acc = 1;
_weight = 2;
}
}
void Reset_Direction_Keys()
{
_keyMap[2] = -1;
_keyMap[3] = -1;
_keyMap[4] = -1;
_keyMap[5] = -1;
_keyMap[8] = -1;
_keyMap[14] = -1;
_keyMap[10] = -1;
_keyMap[12] = -1;
}
void Save_Records()
{
byte abyte0[] = new byte[182];
try
{
RecordStore recordstore = RecordStore.openRecordStore("RacingRecord", false);
if(recordstore.getNumRecords() > 0)
{
for(byte byte0 = 0; byte0 < 5; byte0++)
{
for(byte byte1 = 0; byte1 < 5; byte1++)
{
byte byte3 = (byte)(_highScores[byte0][byte1] / 1000);
byte byte6 = (byte)((_highScores[byte0][byte1] - 1000 * byte3) / 100);
byte byte7 = (byte)((_highScores[byte0][byte1] - 1000 * byte3 - 100 * byte6) / 10);
byte byte8 = (byte)(_highScores[byte0][byte1] % 10);
abyte0[byte0 * 20 + byte1 * 4] = byte3;
abyte0[byte0 * 20 + byte1 * 4 + 1] = byte6;
abyte0[byte0 * 20 + byte1 * 4 + 2] = byte7;
abyte0[byte0 * 20 + byte1 * 4 + 3] = byte8;
}
}
for(byte byte2 = 0; byte2 < 5; byte2++)
{
for(byte byte4 = 0; byte4 < 15; byte4++)
abyte0[100 + byte2 * 15 + byte4] = _names[byte2][byte4];
}
abyte0[175] = _isMusic;
abyte0[176] = _lang;
for(byte byte5 = 0; byte5 < 5; byte5++)
abyte0[177 + byte5] = _locked[byte5];
recordstore.setRecord(1, abyte0, 0, 182);
}
recordstore.closeRecordStore();
}
catch(Exception exception) { }
System.gc();
}
void Update_Game(Graphics g)
{
keyUpdate();
label0:
switch(_gameState)
{
default:
break;
case 0: // '\0'
_gameState = 1;
Reset_Data();
if(_isMusic == 0)
music.startMusic(0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -