ensiform Posted September 8, 2006 Share Posted September 8, 2006 Would it be possible to post the rewritten code for how to parse the siege files so that the EOF error does not exist and so that it only loads the teams/classes for the current map? Link to comment Share on other sites More sharing options...
RenegadeOfPhunk Posted September 17, 2006 Share Posted September 17, 2006 ensiform, Sorry - forgot about your request to see the changed .siege loading code in MBII. Unfortonately, we have all kinds of changes in there, but I think I've isolated the important parts (but you'll have to be aware that other changes may be mixed in)... Anyway: bg_saga.c BG_SiegeLoadClasses() changed to the following: void BG_SiegeLoadClasses(siegeClassDesc_t *descBuffer) { char filename[MAX_QPATH]; int i, j, k; char chPath[MAX_QPATH]; char chExtension[16]; int iDescCount = 0; bgNumSiegeClasses = 0; strcpy (chPath, "ext_data/mb2/character/"); strcpy (chExtension, ".mbch"); for (j = 0; j < bgNumSiegeTeams; j++) {// Go through registered teams for (i = 0; i < bgSiegeTeams[j].numClasses; i++) {// Go through classes & subclasses for that team & parse //for (k = 0; k < MAX_SIEGE_SUBCLASSES; i++) for (k = 0; k < bgSiegeTeams[j].cNumSubclasses[i]; k++) { if(!bgSiegeTeams[j].classnames[i][k]) { return; } strcpy(filename, chPath); strcat(filename, bgSiegeTeams[j].classnames[i][k]); strcat(filename, chExtension); if (descBuffer) { BG_SiegeParseClassFile(filename, &descBuffer[iDescCount]); } else { BG_SiegeParseClassFile(filename, NULL); } bgSiegeTeams[j].classes[i][k] = &bgSiegeClasses[bgNumSiegeClasses-1]; iDescCount++; } } } } later on in that file, this bit of code: while (success && i <= MAX_SIEGE_CLASSES_ON_ONE_TEAM) { //keep checking for group values named class# up to MAX_SIEGE_CLASSES until we can't find one. strcpy(lookString, va("class%i", i)); success = BG_SiegeGetPairedValue(parseBuf2, lookString, parseBuf); if (!success) { break; } bgSiegeTeams[bgNumSiegeTeams].classes[bgSiegeTeams[bgNumSiegeTeams].numClasses][0] = BG_SiegeFindClassByName(parseBuf); if (!bgSiegeTeams[bgNumSiegeTeams].classes[bgSiegeTeams[bgNumSiegeTeams].numClasses][0]) { Com_Error(ERR_DROP, "Invalid class specified: '%s'", parseBuf); } bgSiegeTeams[bgNumSiegeTeams].cNumSubclasses[bgSiegeTeams[bgNumSiegeTeams].numClasses] = 1; bgSiegeTeams[bgNumSiegeTeams].numClasses++; i++; } ...becomes... while (success && i <= MAX_SIEGE_CLASSES_ON_ONE_TEAM) { //keep checking for group values named class# up to MAX_SIEGE_CLASSES until we can't find one. strcpy(lookString, va("class%i", i)); success = BG_SiegeGetPairedValue(parseBuf2, lookString, parseBuf); if (!success) { break; } //bgSiegeTeams[bgNumSiegeTeams].classes[bgSiegeTeams[bgNumSiegeTeams].numClasses][0] //= BG_SiegeFindClassByName(parseBuf); strcpy(bgSiegeTeams[bgNumSiegeTeams].classnames[bgSiegeTeams[bgNumSiegeTeams].numClasses][0], parseBuf); //if (!bgSiegeTeams[bgNumSiegeTeams].classes[bgSiegeTeams[bgNumSiegeTeams].numClasses][0]) if (!bgSiegeTeams[bgNumSiegeTeams].classnames[bgSiegeTeams[bgNumSiegeTeams].numClasses][0]) { Com_Error(ERR_DROP, "Invalid class specified: '%s'", parseBuf); } bgSiegeTeams[bgNumSiegeTeams].cNumSubclasses[bgSiegeTeams[bgNumSiegeTeams].numClasses] = 1; bgSiegeTeams[bgNumSiegeTeams].numClasses++; i++; } BG_SiegeLoadTeams() becomes... void BG_SiegeLoadTeams(const char* team1name, const char* team2name) { char filename[MAX_QPATH]; char tcPath[MAX_QPATH]; char tcExtension[16]; bgNumSiegeTeams = 0; strcpy (tcPath, "ext_data/mb2/teamconfig/"); strcpy (tcExtension, ".mbtc"); //Team 1 strcpy(filename, tcPath); strcat(filename, team1name); strcat(filename, tcExtension); BG_SiegeParseTeamFile(filename); //Team 2 strcpy(filename, tcPath); strcat(filename, team2name); strcat(filename, tcExtension); BG_SiegeParseTeamFile(filename); } g_saga.c InitSiegeMode (bottom 3 lines added): void InitSiegeMode(void) { vmCvar_t mapname; char levelname[512]; char teamIcon[128]; char goalreq[64]; char teams[2048]; char objective[MAX_SIEGE_INFO_SIZE]; char objecStr[8192]; int len = 0; int i = 0; // int j = 0; int objectiveNumTeam1 = 0; int objectiveNumTeam2 = 0; int iTeam1Score; int iTeam2Score; int iStoredStartTime; fileHandle_t f; [b]char team1name[1024]; char team2name[1024]; char teamloadbuf[2048];[/b] ..and then further down - find this bit: //Load the player class types BG_SiegeLoadClasses(NULL); if (!bgNumSiegeClasses) { //We didn't find any?! G_Error("Couldn't find any player classes for Siege"); } ...and add this code above it: [b]//Load teams needed for this map. if (BG_SiegeGetValueGroup(siege_info, team1, teamloadbuf)) { BG_SiegeGetPairedValue(teamloadbuf, "UseTeam", team1name); } if (BG_SiegeGetValueGroup(siege_info, team2, teamloadbuf)) { BG_SiegeGetPairedValue(teamloadbuf, "UseTeam", team2name); } if (!team1name || !team2name) { //Couldn't find team name G_Error("Couldn't find team config reference in .siege file."); } //Load teams BG_SiegeLoadTeams(team1name, team2name); if (!bgNumSiegeTeams) { //We didn't find any?! G_Error("Couldn't find any player teams for Siege"); }[/b] //Load the player class types BG_SiegeLoadClasses(NULL); if (!bgNumSiegeClasses) { //React same as with teams. G_Error("Couldn't find any player classes for Siege"); } cg_saga.c: CG_InitSiegeMode (bottom 3 lines added): void CG_InitSiegeMode(void) { char levelname[MAX_QPATH]; char btime[1024]; char teams[2048]; char teamInfo[MAX_SIEGE_INFO_SIZE]; int len = 0; int i = 0; int j = 0; siegeClass_t *cl; siegeTeam_t *sTeam; fileHandle_t f; char teamIcon[128]; [b]char team1name[1024]; char team2name[1024]; char teamloadbuf[2048];[/b] ..then further on down - this: //Load the player class types BG_SiegeLoadClasses(NULL); if (!bgNumSiegeClasses) { //We didn't find any?! CG_Error("Couldn't find any player classes for Siege"); } //Now load the teams since we have class data. BG_SiegeLoadTeams(); if (!bgNumSiegeTeams) { //React same as with classes. CG_Error("Couldn't find any player teams for Siege"); } ...becomes this... //Load teams needed for this map. if (BG_SiegeGetValueGroup(siege_info, team1, teamloadbuf)) { BG_SiegeGetPairedValue(teamloadbuf, "UseTeam", team1name); } if (BG_SiegeGetValueGroup(siege_info, team2, teamloadbuf)) { BG_SiegeGetPairedValue(teamloadbuf, "UseTeam", team2name); } if (!team1name || !team2name) { //Couldn't find team name CG_Error("Couldn't find team config reference in .siege file."); } //Load teams BG_SiegeLoadTeams(team1name, team2name); if (!bgNumSiegeTeams) { //We didn't find any?! CG_Error("Couldn't find any player teams for Siege"); } //Load the player class types BG_SiegeLoadClasses(NULL); Hopefully that shoudl at least point you in the right direction Link to comment Share on other sites More sharing options...
ensiform Posted September 17, 2006 Author Share Posted September 17, 2006 could you look up what MAX_SIEGE_CLASSES_ON_ONE_TEAM is defined as and cNumSubclasses, classnames in siegeTeam_t. and other places i would need cNumSubclasses and classnames, it also looks like the classes object in siegeTeam_t is different from base. Link to comment Share on other sites More sharing options...
RenegadeOfPhunk Posted September 18, 2006 Share Posted September 18, 2006 cNumSubclasses isn't to do with what you're after. cNumSubclasses is an MBII specific thing (having several classes attached to one 'slot'). So you'll need to 'discect' that stuff back out of the code. And sure, I'll look up MAX_SIEGE_CLASSES_ON_ONE_TEAM for you when I get home - and I'll specify the changes in the relavent structures... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.