📄 data.cpp
字号:
//////////////////////////////////////////////////////////////////////
//FILE: Data.cpp
//Data initialization
//////////////////////////////////////////////////////////////////////
#include "data.h"
Data::Data()
{
int i;
for (i = 0; i < NUM_BIKETYPE; i++)
{
bikeNames[i]=NULL;
}
for (i = 0; i < NUM_PARTS; i++)
{
partsStrings[i]=NULL;
}
for (i = 0; i < NUM_BIKETYPE*NUM_ENGINE_OPTION*NUM_ENGINE_STR; i++)
{
engineParts[i]=NULL;
}
for (i = 0; i < NUM_OTHER_PARTS*NUM_PARTS_OPTION; i++)
{
bikeParts[i]=NULL;
}
for (i = 0; i < NUM_PARTS_OPTION*NUM_WHEEL; i++)
{
wheelWeights[i]=NULL;
}
for (i = 0; i < NUM_TRACKS*NUM_TRACK_INFO; i++)
{
trackinfo[i]=NULL;
}
for (i = 0; i < NUM_WEATHER_TYPE; i++)
{
weatherTypes[i]=NULL;
}
for (i = 0; i < NUM_BIKES; i++)
{
positions[i]=NULL;
}
for (i = 0; i < NUM_BIKES; i++)
{
names[i]=NULL;
}
for (i = 0; i < NUM_BIKES; i++)
{
bios[i] =NULL;
}
for (i = 0; i < NUM_TAUNTS; i++)
{
taunts[i] =NULL;
}
for (i = 0; i < NUM_RULES; i++)
{
ruleString[i] =NULL;
}
}
Data::~Data()
{
int i;
for (i = 0; i < NUM_BIKETYPE; i++)
{
if (bikeNames[i])
delete bikeNames[i];
}
/* for (i = 0; i < NUM_PARTS; i++)
{
if (partsStrings[i])
delete partsStrings[i];
}*/
for (i = 0; i < NUM_BIKETYPE*NUM_ENGINE_OPTION*NUM_ENGINE_STR; i++)
{
if (engineParts[i])
delete engineParts[i];
}
for (i = 0; i < NUM_OTHER_PARTS*NUM_PARTS_OPTION; i++)
{
if (bikeParts[i])
delete bikeParts[i];
}
for (i = 0; i < NUM_PARTS_OPTION*NUM_WHEEL; i++)
{
if (wheelWeights[i])
delete wheelWeights[i];
}
for (i = 0; i < NUM_TRACKS*NUM_TRACK_INFO; i++)
{
if (trackinfo[i])
delete trackinfo[i];
}
for (i = 0; i < NUM_WEATHER_TYPE; i++)
{
if (weatherTypes[i])
delete weatherTypes[i];
}
for (i = 0; i < NUM_BIKES; i++)
{
if (positions[i])
delete positions[i];
}
for (i = 0; i < NUM_BIKES; i++)
{
if (names[i])
delete names[i];
}
for (i = 0; i < NUM_BIKES; i++)
{
if (bios[i])
delete bios[i];
}
for (i = 0; i < NUM_TAUNTS; i++)
{
if (taunts[i])
delete taunts[i];
}
for (i = 0; i < NUM_RULES; i++)
{
if (ruleString[i])
delete ruleString[i];
}
}
void Data::Init()
{
int i;
//////////////////////////////////////////////////////////////////////////
int _weather[NUM_TRACKS] = {0,1,0,0,0,0,1,2,0};
for (i = 0; i < NUM_TRACKS; i++)
{
weather[i] = _weather[i];
}
//////////////////////////////////////////////////////////////////////////
int _trackLengths[] = { 0x3ffff,0x3ffff,0x7ffff,0x3ffff,
0x3ffff,0x7ffff,0x3ffff,0x3ffff,
0x7ffff };
for (i = 0; i < NUM_TRACKS; i++)
{
trackLengths[i] = _trackLengths[i];
}
//////////////////////////////////////////////////////////////////////////
int _gearPercent[NUM_GEAR] = {20,40,58,74,88,100};
for (i = 0; i < NUM_GEAR; i++)
{
gearPercent[i] = _gearPercent[i];
}
//////////////////////////////////////////////////////////////////////////
int _tunnelTable[TUNNELTABLE_NUM] =
{
0x1800,0x3000,
0x6000,0x9000,
0x10000,0x18000,
0x23000,0x27800,
0x40000,0x47400,
0x60000,0x77400,
-1
};
for (i = 0; i < TUNNELTABLE_NUM; i++)
{
tunnelTable[i] = _tunnelTable[i];
}
//////////////////////////////////////////////////////////////////////////
short _roadTable[ROAD_TABLE_NUM] =
{
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,
3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,
5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,8,
8,8,8,8,9,9,9,9,9,10,10,10,10,10,11,11,
11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,
15,15,16,16,16,16,17,17,17,18,18,18,19,19,19,19,
20,20,20,21,21,21,22,22,22,23,23,23,24,24,24,25,
25,25,26,26,26,27,27,27,28,28,28,29,29,30,30,30,
31,31,32,32,32,33,33,33,34,34,35,35,36,36,36,37,
37,38,38,38,39,39,40,40,41,41,41,42,42,43,43,44,
44,45,45,46,46,46,47,47,48,48,49,49,50,50,51,51,
52,52,53,53,54,54,55,55,56,56,57,57,58,58,59,59,
60,61,61,62,62,63,63,64,64,65,65,66,67,67,68,68,
69,69,70,70,71,72,72,73,73,74,75,75,76,76,77,77,
78,79,79,80,81,81,82,82,83,84,84,85,85,86,87,87,
88,89,89,90,91,91,92,93,93,94,95,95,96,96,97,98,
99,99,100,101,101,102,103,103,104,105,105,106,107,107,108,109,
110,110,111,112,112,113,114,115,115,116,117,117,118,119,120,120,
121,122,123,123,124,125,126,126,127,128,129,129,130,131,132,133,
133,134,135,136,136,137,138,139,140,140,141,142,143,144,144,145,
146,147,148,148,149,150,151,152,153,153,154,155,156,157,157,158,
159,160,161,162,163,163,164,165,166,167,168,169,169,170,171,172,
173,174,175,176,176,177,178,179,180,181,182,183,184,184,185,186,
187,188,189,190,191,192,193,194,194,195,196,197,198,199,200,201,
202,203,204,205,206,207,208,209,209,210,211,212,213,214,215,216,
217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,
233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,
249,250,251,252,253,254,255,256,257,258,259,260,262,263,264,265,
266,267,268,269,270,271,272,273,274,275,276,277,279,280,281,282,
283,284,285,286,287,288,289,291,292,293,294,295,296,297,298,299,
300,302,303,304,305,306,307,308,309,311,312,313,314,315,316,317,
318,320,321,322,323,324,325,327,328,329,330,331,332,333,335,336,
337,338,339,340,342,343,344,345,346,348,349,350,351,352,353,355,
356,357,358,359,361,362,363,364,365,367,368,369,370,371,373,374,
375,376,378,379,380,381,382,384,385,386,387,389,390,391,392,393,
395,396,397,398,400,401,402,403,405,406,407,408,410,411,412,413,
415,416,417,419,420,421,422,424,425,426,427,429,430,431,433,434,
435,436,438,439,440,442,443,444,445,447,448,449,451,452,453,455,
456,457,459,460,461,462,464,465,466,468,469,470,472,473,474,476,
477,478,480,481,482,484,485,486,488,489,490,492,493,494,496,497,
498,500,501,502,504,505,507,508,509,511,512,513,515,516,517,519,
520,522,523,524,526,527,528,530,531,533,534,535,537,538,539,541,
542,544,545,546,548,549,551,552,553,555,556,558,559,560,562,563,
565,566,567,569,570,572,573,574,576,577,579,580,582,583,584,586,
587,589,590,591,593,594,596,597,599,600,601,603,604,606,607,609,
610,612,613,614,616,617,619,620,622,623,625,626,627,629,630,632,
633,635,636,638,639,641,642,643,645,646,648,649,651,652,654,655,
657,658,660,661,662,664,665,667,668,670,671,673,674,676,677,679,
680,682,683,685,686,688,689,691,692,694,695,697,698,700,701,702,
704,705,707,708,710,711,713,714,716,717,719,720,722,723,725,726,
728,729,731,732,734,736,737,739,740,742,743,745,746,748,749,751,
752,754,755,757,758,760,761,763,764,766,767,769,770,772,773,775,
776,778,780,781,783,784,786,787,789,790,792,793,795,796,798,799,
801,802,804,806,807,809,810,812,813,815,816,818,819,821,822,824,
826,827,829,830,832,833,835,836,838,839,841,843,844,846,847,849,
850,852,853,855,857,858,860,861,863,864,866,867,869,870,872,874,
875,877,878,880,881,883,884,886,888,889,891,892,894,895,897,899,
900,902,903,905,906,908,909,911,913,914,916,917,919,920,922,924,
925,927,928,930,931,933,934,936,938,939,941,942,944,945,947,949,
950,952,953,955,956,958,960,961,963,964,966,967,969,971,972,974,
975,977,978,980,982,983,985,986,988,989,991,993,994,996,997,999,
1000,1002,1004,1005,1007,1008,1010,1011,1013,1015,1016,1018,1019,1021,1022,1023
};
for (i = 0; i < ROAD_TABLE_NUM; i++)
{
roadTable[i] = _roadTable[i];
}
//////////////////////////////////////////////////////////////////////////
int _canyonShiftTab[CANYONSHIFT_NUM] = {17,20,18,19,18,17,18,19};
for (i = 0; i < CANYONSHIFT_NUM; i++)
{
canyonShiftTab[i] = _canyonShiftTab[i];
}
//////////////////////////////////////////////////////////////////////////
int _canyonColours[CANYONCOLOUR_NUM] =
{
0x804020,
0xa05028,
0xC06030,
0xe07038,
0xff8040
};
for (i = 0; i < CANYONCOLOUR_NUM; i++)
{
canyonColours[i] = _canyonColours[i];
}
//////////////////////////////////////////////////////////////////////////
int _track1[TRACK1_NUM] =
{
//type, angle, start, end
BEND, 6, 0x06000, 0x0A000,
BEND, 5, 0x10000, 0x18000,
BEND, 3, 0x1A000, 0x1C000,
BEND, -3, 0x1E000, 0x24000,
BEND, -2, 0x2E000, 0x30000,
BEND, 2, 0x32000, 0x36000,
BEND, 3, 0x38000, 0x3E000,
HILL, 8, 0x07000, 0x0A000,
HILL, -9, 0x0B000, 0x0F99A,
HILL, -4, 0x18000, 0x1E666,
HILL, 6, 0x22CCD, 0x26CCD,
HILL, 3, 0x33333, 0x3999A,
HILL, -7, 0x3CCCD, 0x3E99A,
END_TRACK
};
for (i = 0; i < TRACK1_NUM; i++)
{
track1[i] = _track1[i];
}
//////////////////////////////////////////////////////////////////////////
int _track2[TRACK2_NUM] =
{
//type, angle, start, end
BEND, -2, 0x02000, 0x06000,
BEND, 4, 0x08000, 0x0e000,
BEND, 5, 0x10000, 0x15000,
BEND, -5, 0x18000, 0x1e000,
BEND, 4, 0x28000, 0x30000,
BEND, -3, 0x34000, 0x36000,
BEND, 5, 0x38000, 0x3e000,
HILL, 11, 0x0899A, 0x0B666,
HILL, -9, 0x0C99A, 0x0F333,
HILL, 5, 0x13000, 0x1D000,
HILL, 3, 0x2299A, 0x264CD,
HILL, -6, 0x2A000, 0x32000,
HILL, -4, 0x3799A, 0x3ECCD,
END_TRACK
};
for (i = 0; i < TRACK2_NUM; i++)
{
track2[i] = _track2[i];
}
//////////////////////////////////////////////////////////////////////////
int _track3[TRACK3_NUM] =
{
//type, angle, start, end
BEND, 2, 0x08000, 0x14000,
BEND, -5, 0x18000, 0x1C000,
BEND, -4, 0x20000, 0x28000,
BEND, 4, 0x34000, 0x3A000,
BEND, 5, 0x3E000, 0x42000,
BEND, -3, 0x44000, 0x4E000,
BEND, 6, 0x52000, 0x54000,
BEND, -5, 0x56000, 0x58000,
BEND, -4, 0x5A000, 0x60000,
BEND, 4, 0x68000, 0x6E000,
BEND, 2, 0x72000, 0x76000,
BEND, -5, 0x7A000, 0x7E000,
HILL, 5, 0x0C000, 0x18000,
HILL, 7, 0x1B333, 0x24000,
HILL, 3, 0x28CCD, 0x33333,
HILL, -6, 0x38CCD, 0x4099A,
HILL, 6, 0x46666, 0x50666,
HILL, -8, 0x58000, 0x5E99A,
HILL, 8, 0x62000, 0x6D333,
HILL, 5, 0x72000, 0x7C000,
END_TRACK
};
for (i = 0; i < TRACK3_NUM; i++)
{
track3[i] = _track3[i];
}
//////////////////////////////////////////////////////////////////////////
int _track4[TRACK4_NUM] =
{
//type, angle, start, end
BEND, 5, 0x06000, 0x0E000,
BEND, 3, 0x16000, 0x18000,
BEND, -4, 0x1C000, 0x22000,
BEND, -5, 0x24000, 0x28000,
BEND, -6, 0x32000, 0x37000,
BEND, 6, 0x3C000, 0x40000,
HILL, -6, 0x0B333, 0x12666,
HILL, -7, 0x16CCD, 0x1B333,
HILL, -3, 0x1CCCD, 0x2099A,
HILL, 6, 0x26000, 0x30000,
HILL, 5, 0x31333, 0x36333,
HILL, 5, 0x38000, 0x3C666,
END_TRACK
};
for (i = 0; i < TRACK4_NUM; i++)
{
track4[i] = _track4[i];
}
//////////////////////////////////////////////////////////////////////////
int _track5[TRACK5_NUM] =
{
//type, angle, start, end
BEND, 5, 0x06000, 0x0A000,
BEND, 5, 0x10000, 0x14000,
BEND, 6, 0x1C000, 0x24000,
BEND, 6, 0x2A000, 0x2E000,
BEND, 7, 0x30000, 0x32000,
BEND, -7, 0x36000, 0x38000,
BEND, 6, 0x3A000, 0x3E000,
HILL, -4, 0x01000, 0x07000,
HILL, -4, 0x0B333, 0x14666,
HILL, 2, 0x17000, 0x19333,
HILL, 3, 0x1B000, 0x24000,
HILL, 6, 0x26333, 0x28CCD,
HILL, -5, 0x2D000, 0x31666,
END_TRACK
};
for (i = 0; i < TRACK5_NUM; i++)
{
track5[i] = _track5[i];
}
//////////////////////////////////////////////////////////////////////////
int _track6[TRACK6_NUM] =
{
//type, angle, start, end
BEND, 3, 0x06000, 0x0C000,
BEND, -4, 0x0E000, 0x12000,
BEND, -4, 0x14000, 0x18000,
BEND, 6, 0x1A000, 0x1E000,
BEND, 5, 0x20000, 0x28000,
BEND, -3, 0x34000, 0x38000,
BEND, 4, 0x3A000, 0x40000,
BEND, 2, 0x44000, 0x50000,
BEND, -6, 0x56000, 0x5C000,
BEND, -2, 0x62000, 0x68000,
BEND, 3, 0x6E000, 0x72000,
BEND, -6, 0x76000, 0x78000,
BEND, 5, 0x7A000, 0x7E000,
HILL, -5, 0x06000, 0x10666,
HILL, -7, 0x13666, 0x1A333,
HILL, 3, 0x20666, 0x24000,
HILL, -8, 0x29000, 0x33333,
HILL, 5, 0x36000, 0x3A000,
HILL, -4, 0x3E000, 0x4C000,
HILL, -6, 0x53666, 0x64000,
HILL, 4, 0x6899A, 0x70333,
HILL, -6, 0x75CCD, 0x7C000,
END_TRACK
};
for (i = 0; i < TRACK6_NUM; i++)
{
track6[i] = _track6[i];
}
//////////////////////////////////////////////////////////////////////////
int _track7[TRACK7_NUM] =
{
//type, angle, start, end
BEND, 4, 0x04000, 0x0A000,
BEND, -4, 0x0E000, 0x14000,
BEND, 6, 0x18000, 0x1C000,
BEND, 6, 0x22000, 0x24000,
BEND, -6, 0x28000, 0x2E000,
BEND, 5, 0x32000, 0x36000,
BEND, 2, 0x3A000, 0x3E000,
HILL, -6, 0x0B333, 0x12666,
HILL, -7, 0x16CCD, 0x1B333,
HILL, -3, 0x1CCCD, 0x2099A,
HILL, 6, 0x26000, 0x30000,
HILL, 5, 0x31333, 0x36333,
HILL, 5, 0x38000, 0x3C666,
END_TRACK
};
for (i = 0; i < TRACK7_NUM; i++)
{
track7[i] = _track7[i];
}
//////////////////////////////////////////////////////////////////////////
int _track8[TRACK8_NUM] =
{
//type, angle, start, end
BEND, -6, 0x04000, 0x06000,
BEND, 6, 0x08000, 0x0c000,
BEND, 4, 0x0e000, 0x12000,
BEND, 4, 0x14000, 0x18000,
BEND, -6, 0x1A000, 0x1E000,
BEND, 5, 0x20000, 0x24000,
BEND, 6, 0x28000, 0x2E000,
BEND, -7, 0x32000, 0x34000,
BEND, 3, 0x36000, 0x3E000,
HILL, 8, 0x07000, 0x0A000,
HILL, -9, 0x0B000, 0x0F99A,
HILL, -4, 0x18000, 0x1E666,
HILL, 6, 0x22CCD, 0x26CCD,
HILL, 3, 0x33333, 0x3999A,
HILL, -7, 0x3CCCD, 0x3E99A,
END_TRACK
};
for (i = 0; i < TRACK8_NUM; i++)
{
track8[i] = _track8[i];
}
//////////////////////////////////////////////////////////////////////////
int _canyonTrack[CANYONTRACK_NUM] =
{
//type, angle, start, end
BEND, 4, 0x2000, 0xa000,
HILL, -8, 0xc000, 0xf000,
HILL, 6, 0x10000, 0x14000,
BEND, -3, 0x11000, 0x17000,
HILL, -12, 0x1a000, 0x22000,
BEND, 3, 0x1b800, 0x20000,
BEND, 6, 0x23000, 0x28000,
HILL, 10, 0x29000, 0x2c000,
HILL, 8, 0x2e800, 0x32000,
HILL, -4, 0x33800, 0x3a000,
BEND, 7, 0x38000, 0x3e000,
BEND, 5, 0x41000, 0x45800,
HILL, -4, 0x42000, 0x48000,
BEND, 2, 0x4c000, 0x54000,
HILL, 12, 0x53000, 0x5a000,
BEND, 2, 0x5a000, 0x60000,
BEND, 4, 0x68000, 0x70000,
HILL, 4, 0x72000, 0x78000,
HILL, 6, 0x79800, 0x7f000,
END_TRACK
};
for (i = 0; i < CANYONTRACK_NUM; i++)
{
canyonTrack[i] = _canyonTrack[i];
}
//////////////////////////////////////////////////////////////////////////
int _track1Scenery[TRACK1SCENERY_NUM] =
{
//type, angle, start, end
SCENERY_START_LINE, 0, 0x200, 0,
SCENERY_DORIC, 140, 0xc00, 0,
SCENERY_TELEGRAPHPOLE, -128, 0x2000, 0x8000,
SCENERY_DUCATI, 140, 0x400, 0x1400,
SCENERY_FENCE, -128, 0x8400, 0x8c00,
SCENERY_BARN, -180, 0x8800, 0,
SCENERY_LAMPPOST, 128, 0xa000, 0x18000,
SCENERY_BARN, 160, 0x16800, 0,
SCENERY_TELEGRAPHPOLE, 128, 0x18000, 0x1e000,
SCENERY_JUNCTION, 0, 0x1c400, 0,
SCENERY_LAMPPOST, -128, 0x1f000, 0x2a000,
SCENERY_BRIDGE, 0, 0x2b000, 0,
SCENERY_LAMPPOST, 128, 0x2c000, 0x30000,
SCENERY_FENCE, -128, 0x30000, 0x32000,
SCENERY_BARN, -180, 0x31000, 0,
SCENERY_FENCE, 128, 0x32000, 0x34000,
SCENERY_BARN, 180, 0x33000, 0,
SCENERY_TELEGRAPHPOLE, 128, 0x34000, 0x38000,
SCENERY_LAMPPOST, -128, 0x39000, 0x3f000,
END_TRACK
};
for (i = 0; i < TRACK1SCENERY_NUM; i++)
{
track1Scenery[i] = _track1Scenery[i];
}
//////////////////////////////////////////////////////////////////////////
int _track2Scenery[TRACK2SCENERY_NUM] =
{
//type, angle, start, end
SCENERY_START_LINE, 0, 0x200, 0,
SCENERY_LAMPPOST, 128, 0x800, 0x6800,
SCENERY_JUNCTION, 0, 0x7000, 0,
SCENERY_DUCATI, 140, 0x6c00, 0x7e00,
SCENERY_FENCE, -128, 0x8000, 0xa000,
SCENERY_LAMPPOST, 128, 0xa200, 0x10000,
SCENERY_WARNING_SIGN, -128, 0x8800, 0,
SCENERY_TELEGRAPHPOLE, -128, 0x11000, 0x14000,
SCENERY_HOUSE, -140, 0x14200, 0,
SCENERY_TELEGRAPHPOLE, 128, 0x15000, 0x18000,
SCENERY_JUNCTION2, 0, 0x17000, 0,
SCENERY_HOUSE, 140, 0x18200, 0,
SCENERY_DUCATI, -140, 0x19000, 0x1c000,
SCENERY_LAMPPOST, -140, 0x1c400, 0x20000,
SCENERY_TELEGRAPHPOLE, 128, 0x22000, 0x26800,
SCENERY_LAMPPOST, 128, 0x2ac00, 0x2c000,
SCENERY_BRIDGE, 0, 0x2a000, 0,
SCENERY_JUNCTION2, 0, 0x32000, 0,
SCENERY_DUCATI, 140, 0x33000, 0x38000,
SCENERY_BARN, -180, 0x3a000, 0,
SCENERY_BARN, -180, 0x3a800, 0,
SCENERY_BARN, -180, 0x3b000, 0,
SCENERY_LAMPPOST, 140, 0x3c000, 0x3f800,
END_TRACK
};
for (i = 0; i < TRACK2SCENERY_NUM; i++)
{
track2Scenery[i] = _track2Scenery[i];
}
//////////////////////////////////////////////////////////////////////////
int _track3Scenery[TRACK3SCENERY_NUM] =
{
//type, angle, start, end
SCENERY_START_LINE, 0, 0x200, 0,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -