mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	moved shmup::loadConfig to legacy too
This commit is contained in:
		
							
								
								
									
										31
									
								
								legacy.cpp
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								legacy.cpp
									
									
									
									
									
								
							| @@ -1,6 +1,37 @@ | |||||||
|  | // old config file format (disabled by default) | ||||||
|  | // Copyright (C) 2017-2019 Zeno Rogue, see 'hyper.cpp' for details | ||||||
|  |  | ||||||
| #if CAP_LEGACY | #if CAP_LEGACY | ||||||
| namespace hr { | namespace hr { | ||||||
|  |  | ||||||
|  | namespace shmup { | ||||||
|  |  | ||||||
|  | void scanchar(FILE *f, char& c) { | ||||||
|  |   int i = c; | ||||||
|  |   int err = fscanf(f, "%d", &i); | ||||||
|  |   if(err == 1) c = i; | ||||||
|  |   } | ||||||
|  |    | ||||||
|  | void loadConfig(FILE *f) { | ||||||
|  |   int xvernum; | ||||||
|  |   int err = fscanf(f, "%d %d", &xvernum, &multi::players); | ||||||
|  |   if(multi::players < 1 || multi::players > MAXPLAYER) | ||||||
|  |     multi::players = 1; | ||||||
|  |   if(err != 2) return; | ||||||
|  |   if(xvernum >= 8990) { int b=alwaysuse; err=fscanf(f, " %d", &b); alwaysuse = b; } | ||||||
|  |   for(int i=0; i<512; i++) scanchar(f, vid.scfg.keyaction[i]); | ||||||
|  |   for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXBUTTON; j++) scanchar(f, vid.scfg.joyaction[i][j]); | ||||||
|  |   for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXAXE; j++) scanchar(f, vid.scfg.axeaction[i][j]); | ||||||
|  |    | ||||||
|  |   if(xvernum >= 9007) | ||||||
|  |     for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXAXE; j++) err = fscanf(f, " %d", &vid.scfg.deadzoneval[i][j]); | ||||||
|  |   for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXHAT; j++) for(int k=0; k<4; k++) | ||||||
|  |     scanchar(f, vid.scfg.hataction[i][j][k]); | ||||||
|  |   for(int i=0; i<(xvernum < 8990 ? 4 : 7); i++) loadcs(f, scs[i], xvernum); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
| void loadcs(FILE *f, charstyle& cs, int xvernum) { | void loadcs(FILE *f, charstyle& cs, int xvernum) { | ||||||
|   int gflags, err =  |   int gflags, err =  | ||||||
|   fscanf(f, "%d%d%x%x%x%x", &gflags, &vid.language, &cs.skincolor, &cs.haircolor, &cs.swordcolor, &cs.dresscolor); |   fscanf(f, "%d%d%x%x%x%x", &gflags, &vid.language, &cs.skincolor, &cs.haircolor, &cs.swordcolor, &cs.dresscolor); | ||||||
|   | |||||||
							
								
								
									
										26
									
								
								shmup.cpp
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								shmup.cpp
									
									
									
									
									
								
							| @@ -636,32 +636,6 @@ void initConfig() { | |||||||
|   for(int i=0; i<7; i++) addsaver(multi::scs[i], "player"+its(i)); |   for(int i=0; i<7; i++) addsaver(multi::scs[i], "player"+its(i)); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| #if CAP_CONFIG |  | ||||||
| void scanchar(FILE *f, char& c) { |  | ||||||
|   int i = c; |  | ||||||
|   int err = fscanf(f, "%d", &i); |  | ||||||
|   if(err == 1) c = i; |  | ||||||
|   } |  | ||||||
|    |  | ||||||
| void loadConfig(FILE *f) { |  | ||||||
|   int xvernum; |  | ||||||
|   int err = fscanf(f, "%d %d", &xvernum, &multi::players); |  | ||||||
|   if(multi::players < 1 || multi::players > MAXPLAYER) |  | ||||||
|     multi::players = 1; |  | ||||||
|   if(err != 2) return; |  | ||||||
|   if(xvernum >= 8990) { int b=alwaysuse; err=fscanf(f, " %d", &b); alwaysuse = b; } |  | ||||||
|   for(int i=0; i<512; i++) scanchar(f, vid.scfg.keyaction[i]); |  | ||||||
|   for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXBUTTON; j++) scanchar(f, vid.scfg.joyaction[i][j]); |  | ||||||
|   for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXAXE; j++) scanchar(f, vid.scfg.axeaction[i][j]); |  | ||||||
|    |  | ||||||
|   if(xvernum >= 9007) |  | ||||||
|     for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXAXE; j++) err = fscanf(f, " %d", &vid.scfg.deadzoneval[i][j]); |  | ||||||
|   for(int i=0; i<MAXJOY; i++) for(int j=0; j<MAXHAT; j++) for(int k=0; k<4; k++) |  | ||||||
|     scanchar(f, vid.scfg.hataction[i][j][k]); |  | ||||||
|   for(int i=0; i<(xvernum < 8990 ? 4 : 7); i++) loadcs(f, scs[i], xvernum); |  | ||||||
|   } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| void handleInput(int delta) { | void handleInput(int delta) { | ||||||
| #if CAP_SDL | #if CAP_SDL | ||||||
|   double d = delta / 500.; |   double d = delta / 500.; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue