Remove registration code; allow every map and every weather.

This commit is contained in:
maride 2016-04-02 17:18:39 +02:00
parent 1e03cded49
commit 7db37919cf

View File

@ -11,7 +11,6 @@
#include "environment.h" #include "environment.h"
#include "interfaceutil.h" #include "interfaceutil.h"
#include "mapselection.h" #include "mapselection.h"
#include "reg_tool_3.h"
#include "controls.h" #include "controls.h"
#define kMaxMaps 1024 #define kMaxMaps 1024
@ -40,7 +39,7 @@ int CompareMaps(const void *a,const void *b)
} }
//get a list of available map files //get a list of available map files
void GetAvailableMaps(int *availableMaps,int *mapCount,int demoOnly) void GetAvailableMaps(int *availableMaps,int *mapCount)
{ {
*mapCount=0; *mapCount=0;
for(int i=0;i<gFileTableSize;i++) for(int i=0;i<gFileTableSize;i++)
@ -49,10 +48,7 @@ void GetAvailableMaps(int *availableMaps,int *mapCount,int demoOnly)
if(!_stricmp(extension,kFileTypeMapDefinition)) if(!_stricmp(extension,kFileTypeMapDefinition))
{ {
tMapInfo *mapInfo=(tMapInfo*)FileGetParsedDataPtr(i,kParserTypeMapInfoDesc,sizeof(tMapInfo)); tMapInfo *mapInfo=(tMapInfo*)FileGetParsedDataPtr(i,kParserTypeMapInfoDesc,sizeof(tMapInfo));
int demook=false; if(!mapInfo->hideMap)
if(i==FileGetReference("city2.mapinfo"))demook=true;
if(i==FileGetReference("highspeed.mapinfo"))demook=true;
if(!mapInfo->hideMap&&(demook||!demoOnly))
availableMaps[(*mapCount)++]=i; availableMaps[(*mapCount)++]=i;
} }
qsort(availableMaps,*mapCount,sizeof(tFileRef),CompareMaps); qsort(availableMaps,*mapCount,sizeof(tFileRef),CompareMaps);
@ -67,13 +63,7 @@ void GetAvailableEnvironments(int *availableEnvironments,int *environmentCount,i
if(char *extension=FileGetExtension(i)) if(char *extension=FileGetExtension(i))
if(!_stricmp(extension,kFileTypeEnvironmentDefinition)) if(!_stricmp(extension,kFileTypeEnvironmentDefinition))
{ {
int ok=false; if(!timeTrial)
if(i==FileGetReference("daylight.env"))ok=true;
if(i==FileGetReference("night.env"))ok=true;
if(i==FileGetReference("rain.env"))ok=true;
if(i==FileGetReference("snow.senv"))ok=true;
if(i==FileGetReference("sunset.env"))ok=true;
if(!timeTrial||ok)
availableEnvironments[(*environmentCount)++]=i; availableEnvironments[(*environmentCount)++]=i;
} }
} }
@ -84,7 +74,7 @@ void SelectNextMap(tFileRef *map)
int mapCount; int mapCount;
int selection=0; int selection=0;
GetAvailableMaps(availableMaps,&mapCount,!RT3_IsRegistered()); GetAvailableMaps(availableMaps,&mapCount);
for(int i=0;i<mapCount;i++) for(int i=0;i<mapCount;i++)
if(*map==availableMaps[i]) if(*map==availableMaps[i])
selection=i; selection=i;
@ -101,7 +91,7 @@ void SelectPrevMap(tFileRef *map)
int mapCount; int mapCount;
int selection=0; int selection=0;
GetAvailableMaps(availableMaps,&mapCount,!RT3_IsRegistered()); GetAvailableMaps(availableMaps,&mapCount);
for(int i=0;i<mapCount;i++) for(int i=0;i<mapCount;i++)
if(*map==availableMaps[i]) if(*map==availableMaps[i])
selection=i; selection=i;
@ -118,7 +108,7 @@ int SelectMapByChar(char ch)
{ {
tFileRef availableMaps[kMaxMaps]; tFileRef availableMaps[kMaxMaps];
int mapCount; int mapCount;
GetAvailableMaps(availableMaps,&mapCount,false); GetAvailableMaps(availableMaps,&mapCount);
for(int i=0;i<mapCount;i++) for(int i=0;i<mapCount;i++)
{ {
@ -178,7 +168,7 @@ int InterfaceMapSelection(tGameInfo *gInfo,int (*Callback)(void*),void *userData
ud.Callback=Callback; ud.Callback=Callback;
ud.userData=userData; ud.userData=userData;
GetAvailableMaps(availableMaps,&mapCount,false); GetAvailableMaps(availableMaps,&mapCount);
for(int i=0;i<mapCount;i++) for(int i=0;i<mapCount;i++)
if(gConfig->lastRoad==availableMaps[i]) if(gConfig->lastRoad==availableMaps[i])
mapSelection=i; mapSelection=i;
@ -223,27 +213,15 @@ int InterfaceMapSelection(tGameInfo *gInfo,int (*Callback)(void*),void *userData
if(availableMaps[mapSelection]==FileGetReference("highspeed.mapinfo"))demook=true; if(availableMaps[mapSelection]==FileGetReference("highspeed.mapinfo"))demook=true;
menu.image=mapInfo->image; menu.image=mapInfo->image;
if(demook||RT3_IsRegistered()) menu.imageAlpha=1.0;
{ strcpy(menu.items[kMapSelectionAccept].label,"Accept");
menu.imageAlpha=1.0; menu.items[kMapSelectionAccept].flags=0;
strcpy(menu.items[kMapSelectionAccept].label,"Accept"); if((!mapInfo->loop)||gInfo->numLaps==-1)
menu.items[kMapSelectionAccept].flags=0; menu.items[kMapSelectionLaps].flags|=kInterfaceMenuItemDisabled;
if((!mapInfo->loop)||gInfo->numLaps==-1) else
menu.items[kMapSelectionLaps].flags|=kInterfaceMenuItemDisabled; menu.items[kMapSelectionLaps].flags&=~kInterfaceMenuItemDisabled;
else menu.items[kMapSelectionEnvironment].flags&=~kInterfaceMenuItemDisabled;
menu.items[kMapSelectionLaps].flags&=~kInterfaceMenuItemDisabled; menu.items[kMapSelectionReverse].flags&=~kInterfaceMenuItemDisabled;
menu.items[kMapSelectionEnvironment].flags&=~kInterfaceMenuItemDisabled;
menu.items[kMapSelectionReverse].flags&=~kInterfaceMenuItemDisabled;
}
else
{
menu.imageAlpha=0.5;
strcpy(menu.items[kMapSelectionAccept].label,"\255demo.png\255 Not available in demo!!");
menu.items[kMapSelectionAccept].flags|=kInterfaceMenuItemDisabled;
menu.items[kMapSelectionLaps].flags|=kInterfaceMenuItemDisabled;
menu.items[kMapSelectionEnvironment].flags|=kInterfaceMenuItemDisabled;
menu.items[kMapSelectionReverse].flags|=kInterfaceMenuItemDisabled;
}
sprintf(menu.items[kMapSelectionMap].label,"Selected Map: \255#a\255%s",mapInfo->name); sprintf(menu.items[kMapSelectionMap].label,"Selected Map: \255#a\255%s",mapInfo->name);
sprintf(menu.items[kMapSelectionReverse].label,"Direction: \255#a\255%s",reverse?"Reverse":"Normal"); sprintf(menu.items[kMapSelectionReverse].label,"Direction: \255#a\255%s",reverse?"Reverse":"Normal");
@ -276,14 +254,14 @@ int InterfaceMapSelection(tGameInfo *gInfo,int (*Callback)(void*),void *userData
mapSelection=(mapSelection+1)%mapCount; mapSelection=(mapSelection+1)%mapCount;
mapInfo=(tMapInfo*)FileGetParsedDataPtr(availableMaps[mapSelection],kParserTypeMapInfoDesc,sizeof(tMapInfo)); mapInfo=(tMapInfo*)FileGetParsedDataPtr(availableMaps[mapSelection],kParserTypeMapInfoDesc,sizeof(tMapInfo));
}while(gInfo->numLaps==-1&&!mapInfo->loop); }while(gInfo->numLaps==-1&&!mapInfo->loop);
else if(mapInfo->demoAvailable||RT3_IsRegistered()) else
exit=true; exit=true;
break; break;
case kMapSelectionReverse: case kMapSelectionReverse:
if(sel&(kInterfaceMenuRightArrow|kInterfaceMenuLeftArrow)) if(sel&(kInterfaceMenuRightArrow|kInterfaceMenuLeftArrow))
reverse=!reverse; reverse=!reverse;
else if(mapInfo->demoAvailable||RT3_IsRegistered()) else
exit=true; exit=true;
break; break;
@ -296,7 +274,7 @@ int InterfaceMapSelection(tGameInfo *gInfo,int (*Callback)(void*),void *userData
lapCount++; lapCount++;
if(lapCount>kMaxLaps)lapCount=1; if(lapCount>kMaxLaps)lapCount=1;
} }
else if(mapInfo->demoAvailable||RT3_IsRegistered()) else
exit=true; exit=true;
break; break;
@ -307,7 +285,7 @@ int InterfaceMapSelection(tGameInfo *gInfo,int (*Callback)(void*),void *userData
} }
else if(sel&kInterfaceMenuRightArrow) else if(sel&kInterfaceMenuRightArrow)
environmentSelection=(environmentSelection+1)%environmentCount; environmentSelection=(environmentSelection+1)%environmentCount;
else if(mapInfo->demoAvailable||RT3_IsRegistered()) else
exit=true; exit=true;
break; break;
@ -324,8 +302,7 @@ int InterfaceMapSelection(tGameInfo *gInfo,int (*Callback)(void*),void *userData
*/ */
case kInterfaceMenuOK: case kInterfaceMenuOK:
case kMapSelectionAccept: case kMapSelectionAccept:
if(mapInfo->demoAvailable||RT3_IsRegistered()) exit=true;
exit=true;
break; break;
case kInterfaceMenuEsc: case kInterfaceMenuEsc: