~rabbits/hiversaires

e1f26085e4d83bcc3582188e9cb86cecab13d874 — Rezmason 2 years ago 7fee98c
We now track whether the player used the walkthrough in the player prefs. It's ignored in debug builds. Also, debug builds now run the walkthrough 2.5 times faster
4 files changed, 15 insertions(+), 12 deletions(-)

M src/datatypes.h
M src/play.c
M src/walkthrough.c
M src/walkthrough.h
M src/datatypes.h => src/datatypes.h +1 -0
@@ 85,6 85,7 @@ typedef struct {
	Orientation orientation;
	Chapter chapter;

	int usedWalkthrough;
	int completed;
	int clock;
	int energy;

M src/play.c => src/play.c +14 -2
@@ 39,6 39,11 @@ static double _totalTime = 0;
static double resetTime = -1;
static double walkthroughStartTime = -1;
static double walkthroughTime = -1;
#ifdef DEBUG
static double walkthroughDelay = 0.1;
#else
static double walkthroughDelay = 0.25;
#endif

static void
setupAction()


@@ 121,7 126,13 @@ action(int autoDoor)
	}

	if(_state->completed) {
		GUI_ShowCredits(_state->energy > 0 && !Walkthrough_PlayerUsedWalkthrough());
		int showSecret = _state->energy > 0;
#ifndef DEBUG
		if(_state->usedWalkthrough) {
			showSecret = 0;
		}
#endif
		GUI_ShowCredits(showSecret);
	}
}



@@ 401,7 412,8 @@ Play_Update(double totalTime, double deltaTime)
	/*
		We run the walkthrough if it is active.
	*/
	if(!_state->completed && walkthroughTime != -1 && _totalTime - walkthroughTime > 0.25) {
	if(!_state->completed && walkthroughTime != -1 && _totalTime - walkthroughTime > walkthroughDelay) {
		_state->usedWalkthrough = 1;
		Play_ProcessInput(Walkthrough_Next(), 1);
		walkthroughTime = _totalTime;
	}

M src/walkthrough.c => src/walkthrough.c +0 -9
@@ 63,15 63,6 @@ Walkthrough_Reset()
	stepIndex = 0;
}

int
Walkthrough_PlayerUsedWalkthrough()
{
#ifdef DEBUG
	return 0;
#endif
	return stepIndex > 0;
}

InputType
Walkthrough_Next()
{

M src/walkthrough.h => src/walkthrough.h +0 -1
@@ 25,5 25,4 @@ WITH REGARD TO THIS SOFTWARE.
int Walkthrough_Init(char *data);
void Walkthrough_Quit();
void Walkthrough_Reset();
int Walkthrough_PlayerUsedWalkthrough();
InputType Walkthrough_Next();