diff --git a/TODO.txt b/TODO.txt index cf34c0d..80a365b 100644 --- a/TODO.txt +++ b/TODO.txt @@ -3,10 +3,6 @@ - car deglitch idea: deglitch only if the middle joint collided this frame? - some kinda easteregg in menu or smt - make the U-ramp map taller due to new physics -- replay format should probably record game version - - also there should probably be some version system that says version of - physics vs version of everything else; replay could only record physics - version (maybe just two or three chars?) - on 1st map the camera is obscured by the wall at the start, fix it somehow (not the best first impression) - culling is very slow now, it showed that distance bailout can accelerate it @@ -62,12 +58,18 @@ =========== BUGS ================= +- sometimes getting a SLIGHTLY slower time counts as beating it (prolly + conversion fail) - immediately after starting the map countdown seems to be lower - the pinch collision test seems to sometimes stop the car e.g. after falling from bigger height or when running into ramp at high speed (or not?) - FIX =========== HANDLED ============== +- replay format should probably record game version + - also there should probably be some version system that says version of + physics vs version of everything else; replay could only record physics + version (maybe just two or three chars?) - player name (modifiable via resource file) <-- prolly not - address the bug with driving on curved ramp diagonally, try DECREASING number of reshapes diff --git a/data b/data index 6e04051..7a035ce 100644 --- a/data +++ b/data @@ -3,6 +3,8 @@ #Rrep2;testmap;482f70f9 00000843:0173:0081:0029:0111:0039:0071:00a3:0061:0169:0051:00b3:0041:0073:0081:0033:0041:0033:0231:0030:0098:0029:0011:0163:00f1:0053:0081:0033:0051:0023:0031:00f0:0032:0023:0131:00b9:0081:0023:00a1:0119:00e1:00c9:0071:0039:00a1:00d3:0021:01f9:0091:0079:0091:0039:0051:0049:0021:0083:0031:0083:0031:0083:0061:0089:0121:00a0:0058:002c:0048:0061:0013:0150:0052:00c0:00a1:0053:0041:0043:0031:0020:0092:0063:0181:0010:00a2:0013:0071:00e0:0028:00e9:0078:00a9:0043:0032:0123:0042:0080:0038:004c:01a8:0050:0032:0033:0101 #Btestmap; +#Rrrr;00LCtiny1;8ecff5c0 0000531:0011:03a9:0041:0179:0021:0059:0031:0039:0091:0049:0031:0253:0041:0013:0051:0053:0041:0023:0051:0043:0031:0064:0016:0022:0026:01a4:002c:0040:0042:0013:0081:0053:0102:0050:0021:0049:00e1:0043:0091:0049:01a8:0119:0130:0072:0026:0082:0048:0039:0111:0050:0022:0036:0132:0018:0049:0151:0033:0121:00c3:0041:0059:0041:00d0:0048:0050 + #Maaaaa;4321 0 :*B2vJ diff --git a/racing.h b/racing.h index 989a758..1531d8e 100644 --- a/racing.h +++ b/racing.h @@ -17,9 +17,17 @@ because the offset is too big (input didn't change for more than 2^12 frames), there must simply be inserted an extra word that just copies the current input state. - - Replay text format: first there is the name of the map terminated by ';', - then hexadecimal hash of the map follows (exactly 8 characters), then - blank character follows, then achieved time as a series of decimal digits + - Physics engine version: LCR_RACING_VERSION1 and LCR_RACING_VERSION2 define + a two-character version string of this module that determines compatibility + of replays. Whenever a change is made to this module that changes the + behavior of physics, the version string must be changed because replays + will stop being compatible. It's still possible to make other changes to + this module (such as optimizations or comments) without having to change + physics version. + - Replay text format: first there are two characters saying the physics + engine version, then immediately the name of the map terminated by ';', then + hexadecimal hash of the map follows (exactly 8 characters), then blank + character follows, then achieved time as a series of decimal digits expressing the physics frame at which the run finished, then the replay data, i.e. the series of 16 bit words in hexadecimal, each preceded by ':'. The events (but nothing else) may otherwise be preceeded or followed by @@ -30,6 +38,9 @@ typedef int32_t LCR_GameUnit; ///< abstract game unit +#define LCR_RACING_VERSION1 '0' ///< first part of physics eng. version +#define LCR_RACING_VERSION2 '0' ///< second part of physics eng. version + #define LCR_GAME_UNIT 2048 ///< length of map square in LCR_GameUnits #define LCR_RACING_INPUT_FORW 0x01 @@ -174,6 +185,9 @@ void LCR_replayOutputStr(void (*printChar)(char)) const char *s = LCR_currentMap.name; + printChar(LCR_RACING_VERSION1); + printChar(LCR_RACING_VERSION2); + while (*s) { printChar(*s); @@ -225,11 +239,23 @@ void LCR_replayOutputStr(void (*printChar)(char)) int LCR_replayLoadFromStr(char (*nextChar)(void), uint32_t *mapHash, uint16_t *nameHash) { - char c = ' '; + char c; LCR_racing.replay.eventCount = 0; LCR_racing.replay.achievedTime = 0; + // has to be like this to force correct evaluation order: + c = nextChar() == LCR_RACING_VERSION1; + c |= (nextChar() == LCR_RACING_VERSION2) << 1; + + if (c != 3) + { + LCR_LOG1("wrong physics version"); + return 0; + } + + c = ' '; + if (nameHash) *nameHash = _LCR_simpleStrHash(nextChar,';'); else @@ -243,7 +269,10 @@ int LCR_replayLoadFromStr(char (*nextChar)(void), c = nextChar(); if (_LCR_hexDigitVal(c) < 0) + { + LCR_LOG1("wrong hash"); return 0; + } if (mapHash) *mapHash = ((*mapHash) << 4) | _LCR_hexDigitVal(c); @@ -275,7 +304,10 @@ int LCR_replayLoadFromStr(char (*nextChar)(void), break; if (LCR_racing.replay.eventCount >= LCR_SETTING_REPLAY_MAX_SIZE) + { + LCR_LOG1("replay too big"); return 0; + } LCR_racing.replay.events[LCR_racing.replay.eventCount] = e; LCR_racing.replay.eventCount++;