Rev 1 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 18 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "racesumm.h" |
1 | #include "racesumm.h" |
2 | #include " |
2 | #include "brender.h" |
3 | #include "crush.h" |
3 | #include "crush.h" |
4 | #include "cutscene.h" |
4 | #include "cutscene.h" |
5 | #include "displays.h" |
5 | #include "displays.h" |
6 | #include "flicplay.h" |
6 | #include "flicplay.h" |
7 | #include "globvars.h" |
7 | #include "globvars.h" |
Line 767... | Line 767... | ||
767 | LOG_TRACE("(%d, %d)", pCurrent_choice, pCurrent_mode); |
767 | LOG_TRACE("(%d, %d)", pCurrent_choice, pCurrent_mode); |
768 | 768 | ||
769 | if (((pCurrent_choice == 0 && pCurrent_mode == 0) || !gDone_initial) && (gWreck_zoomed_in < 0 && gWreck_selected >= 0)) { |
769 | if (((pCurrent_choice == 0 && pCurrent_mode == 0) || !gDone_initial) && (gWreck_zoomed_in < 0 && gWreck_selected >= 0)) { |
770 | sel_actor = BrActorAllocate(BR_ACTOR_MODEL, NULL); |
770 | sel_actor = BrActorAllocate(BR_ACTOR_MODEL, NULL); |
771 | sel_actor->render_style = BR_RSTYLE_BOUNDING_EDGES; |
771 | sel_actor->render_style = BR_RSTYLE_BOUNDING_EDGES; |
772 | sel_actor->render_style = BR_RSTYLE_NONE; // FIXME: remove this line once BR_RSTYLE_BOUNDING_EDGES rener style has been implemente |
- | |
773 | sel_actor->model = gWreck_array[gWreck_selected].actor->model; |
772 | sel_actor->model = gWreck_array[gWreck_selected].actor->model; |
774 | BrActorAdd(gWreck_array[gWreck_selected].actor, sel_actor); |
773 | BrActorAdd(gWreck_array[gWreck_selected].actor, sel_actor); |
775 | } else { |
774 | } else { |
776 | sel_actor = NULL; |
775 | sel_actor = NULL; |
777 | } |
776 | } |
Line 1156... | Line 1155... | ||
1156 | 1155 | ||
1157 | // IDA: void __usercall DrawAnItem(int pX@<EAX>, int pY_index@<EDX>, int pFont_index@<EBX>, char *pText@<ECX>) |
1156 | // IDA: void __usercall DrawAnItem(int pX@<EAX>, int pY_index@<EDX>, int pFont_index@<EBX>, char *pText@<ECX>) |
1158 | // Suffix added to avoid duplicate symbol |
1157 | // Suffix added to avoid duplicate symbol |
1159 | void DrawAnItem__racesumm(int pX, int pY_index, int pFont_index, char* pText) { |
1158 | void DrawAnItem__racesumm(int pX, int pY_index, int pFont_index, char* pText) { |
1160 | LOG_TRACE("(%d, %d, %d, \"%s\")", pX, pY_index, pFont_index, pText); |
1159 | LOG_TRACE("(%d, %d, %d, \"%s\")", pX, pY_index, pFont_index, pText); |
- | 1160 | ||
- | 1161 | TransBrPixelmapText(gBack_screen, |
|
- | 1162 | pX, |
|
- | 1163 | gCurrent_graf_data->net_sum_headings_y + gCurrent_graf_data->net_sum_y_pitch * pY_index, |
|
- | 1164 | pFont_index, |
|
- | 1165 | gFont_7, |
|
1161 |
|
1166 | pText); |
1162 | } |
1167 | } |
1163 | 1168 | ||
1164 | // IDA: void __usercall DrawColumnHeading(int pStr_index@<EAX>, int pX@<EDX>) |
1169 | // IDA: void __usercall DrawColumnHeading(int pStr_index@<EAX>, int pX@<EDX>) |
1165 | // Suffix added to avoid duplicate symbol |
1170 | // Suffix added to avoid duplicate symbol |
1166 | void DrawColumnHeading__racesumm(int pStr_index, int pX) { |
1171 | void DrawColumnHeading__racesumm(int pStr_index, int pX) { |
1167 | LOG_TRACE("(%d, %d)", pStr_index, pX); |
1172 | LOG_TRACE("(%d, %d)", pStr_index, pX); |
- | 1173 | ||
- | 1174 | TransBrPixelmapText(gBack_screen, |
|
- | 1175 | pX, |
|
- | 1176 | gCurrent_graf_data->net_sum_headings_y - gCurrent_graf_data->net_sum_y_pitch, |
|
- | 1177 | 250, |
|
- | 1178 | gFont_7, |
|
- | 1179 | GetMiscString(pStr_index)); |
|
1168 | } |
1180 | } |
1169 | 1181 | ||
1170 | // IDA: int __usercall SortScores@<EAX>(void *pFirst_one@<EAX>, void *pSecond_one@<EDX>) |
1182 | // IDA: int __usercall SortScores@<EAX>(void *pFirst_one@<EAX>, void *pSecond_one@<EDX>) |
1171 | int SortScores(void* pFirst_one, void* pSecond_one) { |
1183 | int SortScores(const void* pFirst_one, const void* pSecond_one) { |
1172 | LOG_TRACE("(%p, %p)", pFirst_one, pSecond_one); |
1184 | LOG_TRACE("(%p, %p)", pFirst_one, pSecond_one); |
- | 1185 | ||
1173 |
|
1186 | return gNet_players[*(int*)pSecond_one].games_score - gNet_players[*(int*)pFirst_one].games_score; |
1174 | } |
1187 | } |
1175 | 1188 | ||
1176 | // IDA: void __cdecl SortGameScores() |
1189 | // IDA: void __cdecl SortGameScores() |
1177 | void SortGameScores(void) { |
1190 | void SortGameScores(void) { |
1178 | LOG_TRACE("()"); |
1191 | LOG_TRACE("()"); |
1179 |
|
1192 | qsort(gPlayer_lookup, gNumber_of_net_players, sizeof(gPlayer_lookup[0]), SortScores); |
1180 | } |
1193 | } |
1181 | 1194 | ||
1182 | // IDA: void __usercall NetSumDraw(int pCurrent_choice@<EAX>, int pCurrent_mode@<EDX>) |
1195 | // IDA: void __usercall NetSumDraw(int pCurrent_choice@<EAX>, int pCurrent_mode@<EDX>) |
1183 | void NetSumDraw(int pCurrent_choice, int pCurrent_mode) { |
1196 | void NetSumDraw(int pCurrent_choice, int pCurrent_mode) { |
1184 |
|
1197 | int i; |
1185 |
|
1198 | char s[256]; |
1186 |
|
1199 | tNet_game_player_info* player; |
1187 | LOG_TRACE("(%d, %d)", pCurrent_choice, pCurrent_mode); |
1200 | LOG_TRACE("(%d, %d)", pCurrent_choice, pCurrent_mode); |
- | 1201 | ||
- | 1202 | DrawColumnHeading__racesumm(kMiscString_PLAYED, gCurrent_graf_data->net_sum_x_3); |
|
- | 1203 | DrawColumnHeading__racesumm(kMiscString_WON, gCurrent_graf_data->net_sum_x_4); |
|
- | 1204 | DrawColumnHeading__racesumm(kMiscString_SCORE, gCurrent_graf_data->net_sum_x_5); |
|
- | 1205 | BrPixelmapLine(gBack_screen, |
|
- | 1206 | gCurrent_graf_data->net_sum_x_1, |
|
- | 1207 | gCurrent_graf_data->net_sum_headings_y + 1 + gFont_7->glyph_y - gCurrent_graf_data->net_sum_y_pitch, |
|
- | 1208 | gBack_screen->width - gCurrent_graf_data->net_sum_x_1, |
|
- | 1209 | gCurrent_graf_data->net_sum_headings_y + 1 + gFont_7->glyph_y - gCurrent_graf_data->net_sum_y_pitch, |
|
- | 1210 | 252); |
|
- | 1211 | ||
- | 1212 | for (i = 0; i < gNumber_of_net_players; i++) { |
|
- | 1213 | player = &gNet_players[gPlayer_lookup[i]]; |
|
- | 1214 | ||
- | 1215 | strcpy(s, player->player_name); |
|
- | 1216 | if (player->host) { |
|
- | 1217 | strcat(s, " -"); |
|
- | 1218 | strcat(s, GetMiscString(kMiscString_HOST)); |
|
1188 |
|
1219 | strcat(s, "-"); |
- | 1220 | } |
|
- | 1221 | TurnOffPaletteConversion(); |
|
- | 1222 | DRPixelmapRectangleMaskedCopy(gBack_screen, |
|
- | 1223 | gCurrent_graf_data->net_sum_x_1, |
|
- | 1224 | gCurrent_graf_data->net_sum_headings_y + 1 + i * gCurrent_graf_data->net_sum_y_pitch, |
|
- | 1225 | gIcons_pix_low_res, /* DOS version uses low res, Windows version uses normal res */ |
|
- | 1226 | 0, |
|
- | 1227 | gCurrent_graf_data->net_head_icon_height * player->car_index, |
|
- | 1228 | gIcons_pix_low_res->width, /* DOS version uses low res, Windows version uses normal res */ |
|
- | 1229 | gCurrent_graf_data->net_head_icon_height); |
|
- | 1230 | TurnOnPaletteConversion(); |
|
- | 1231 | DrawAnItem__racesumm(gCurrent_graf_data->net_sum_x_2, i, 83, s); |
|
- | 1232 | sprintf(s, "%d", player->played); |
|
- | 1233 | DrawAnItem__racesumm(gCurrent_graf_data->net_sum_x_3, i, 83, s); |
|
- | 1234 | sprintf(s, "%d", player->won); |
|
- | 1235 | DrawAnItem__racesumm(gCurrent_graf_data->net_sum_x_4, i, 83, s); |
|
- | 1236 | sprintf(s, "%d", player->games_score); |
|
- | 1237 | DrawAnItem__racesumm(gCurrent_graf_data->net_sum_x_5, i, 83, s); |
|
- | 1238 | } |
|
1189 | } |
1239 | } |
1190 | 1240 | ||
1191 | // IDA: void __cdecl DoNetRaceSummary() |
1241 | // IDA: void __cdecl DoNetRaceSummary() |
1192 | void DoNetRaceSummary(void) { |
1242 | void DoNetRaceSummary(void) { |
1193 |
|
1243 | static tFlicette flicker_on[1] = { { 321, { 219, 112 }, { 172, 362 } } }; |
1194 |
|
1244 | static tFlicette flicker_off[1] = { { 322, { 219, 112 }, { 172, 362 } } }; |
1195 |
|
1245 | static tFlicette push[1] = { { 323, { 219, 112 }, { 172, 362 } } }; |
1196 |
|
1246 | static tMouse_area mouse_areas[1] = { { { 219, 112 }, { 172, 362 }, { 282, 182 }, { 192, 379 }, 0, 0, 0, NULL } }; |
1197 |
|
1247 | static tInterface_spec interface_spec = { |
- | 1248 | 0, // initial_imode |
|
- | 1249 | 63, // first_opening_flic |
|
- | 1250 | 0, // second_opening_flic |
|
- | 1251 | -1, // end_flic_go_ahead |
|
- | 1252 | -1, // end_flic_escaped |
|
- | 1253 | -1, // end_flic_otherwise |
|
- | 1254 | 8, // flic_bunch_to_load |
|
- | 1255 | { -1, 0 }, // move_left_new_mode |
|
- | 1256 | { 0, 0 }, // move_left_delta |
|
- | 1257 | { 0, 0 }, // move_left_min |
|
- | 1258 | { 0, 0 }, // move_left_max |
|
- | 1259 | { NULL, NULL }, // move_left_proc |
|
- | 1260 | { -1, 0 }, // move_right_new_mode |
|
- | 1261 | { 0, 0 }, // move_right_delta |
|
- | 1262 | { 0, 0 }, // move_right_min |
|
- | 1263 | { 0, 0 }, // move_right_max |
|
- | 1264 | { NULL, NULL }, // move_right_proc |
|
- | 1265 | { -1, 0 }, // move_up_new_mode |
|
- | 1266 | { 0, 0 }, // move_up_delta |
|
- | 1267 | { 0, 0 }, // move_up_min |
|
- | 1268 | { 0, 0 }, // move_up_max |
|
- | 1269 | { NULL, NULL }, // move_up_proc |
|
- | 1270 | { -1, 0 }, // move_down_new_mode |
|
- | 1271 | { 0, 0 }, // move_down_delta |
|
- | 1272 | { 0, 0 }, // move_down_min |
|
- | 1273 | { 0, 0 }, // move_down_max |
|
- | 1274 | { NULL, NULL }, // move_down_proc |
|
- | 1275 | { 1, 1 }, // go_ahead_allowed |
|
- | 1276 | { NULL, NULL }, // go_ahead_proc |
|
- | 1277 | { 1, 1 }, // escape_allowed |
|
- | 1278 | { NULL, NULL }, // escape_proc |
|
- | 1279 | NULL, // exit_proc |
|
- | 1280 | &NetSumDraw, // draw_proc |
|
- | 1281 | 10000, // time_out |
|
- | 1282 | NULL, // start_proc1 |
|
- | 1283 | NULL, // start_proc2 |
|
- | 1284 | NULL, // done_proc |
|
- | 1285 | 0, // font_needed |
|
- | 1286 | { 0, 0 }, // typeable |
|
- | 1287 | NULL, // get_original_string |
|
- | 1288 | 0, // escape_code |
|
- | 1289 | 1, // dont_save_or_load |
|
- | 1290 | 1, // number_of_button_flics |
|
- | 1291 | flicker_on, // flicker_on_flics |
|
- | 1292 | flicker_off, // flicker_off_flics |
|
- | 1293 | push, // pushed_flics |
|
1198 |
|
1294 | 1, // number_of_mouse_areas |
1199 |
|
1295 | mouse_areas, // mouse_areas |
1200 |
|
1296 | 0, // number_of_recopy_areas |
- | 1297 | NULL // recopy_areas |
|
- | 1298 | }; |
|
- | 1299 | int i; |
|
- | 1300 | int result; |
|
- | 1301 | tS32 start_time; |
|
1201 | LOG_TRACE("()"); |
1302 | LOG_TRACE("()"); |
- | 1303 | ||
- | 1304 | NetPlayerStatusChanged(ePlayer_status_summary); |
|
- | 1305 | start_time = PDGetTotalTime(); |
|
- | 1306 | while (!gReceived_game_scores && PDGetTotalTime() - start_time < 20000) { |
|
1202 |
|
1307 | NetService(0); |
- | 1308 | } |
|
- | 1309 | if (gReceived_game_scores) { |
|
- | 1310 | for (i = 0; i < gNumber_of_net_players; i++) { |
|
- | 1311 | gPlayer_lookup[i] = i; |
|
- | 1312 | } |
|
- | 1313 | SortGameScores(); |
|
- | 1314 | TurnOnPaletteConversion(); |
|
- | 1315 | DoInterfaceScreen(&interface_spec, 0, 0); |
|
- | 1316 | NetPlayerStatusChanged(ePlayer_status_loading); |
|
- | 1317 | TurnOffPaletteConversion(); |
|
- | 1318 | FadePaletteDown(); |
|
- | 1319 | } |
|
1203 | } |
1320 | } |
1204 | 1321 | ||
1205 | // IDA: tSO_result __usercall DoEndRaceSummary@<EAX>(int *pFirst_summary_done@<EAX>, tRace_result pRace_result@<EDX>) |
1322 | // IDA: tSO_result __usercall DoEndRaceSummary@<EAX>(int *pFirst_summary_done@<EAX>, tRace_result pRace_result@<EDX>) |
1206 | tSO_result DoEndRaceSummary(int* pFirst_summary_done, tRace_result pRace_result) { |
1323 | tSO_result DoEndRaceSummary(int* pFirst_summary_done, tRace_result pRace_result) { |
1207 | tSO_result result; |
1324 | tSO_result result; |