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