1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.
This commit is contained in:
parent
c3b032a45a
commit
0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions
|
|
@ -1,72 +0,0 @@
|
|||
#pragma once
|
||||
#include "minigame/chocolate.h"
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace choco::minigame {
|
||||
|
||||
enum class CoffeePhase { Initial, Countdown, Playing, Ending, Aborted, Over };
|
||||
struct CoffeeConfig {
|
||||
std::vector<std::string> recipe;
|
||||
std::vector<uint32_t> matchBonus;
|
||||
uint32_t columns=6,rows=9,gridSpeedMs=5000;
|
||||
uint32_t conveyorCount=5,conveyorTimeMs=1200,gunTimeMs=250;
|
||||
uint32_t countdownMs=3000,gameTimeMs=60000,warningMs=8000,endingMs=1000,missLimit=8;
|
||||
uint32_t collectionTimeMs=250;
|
||||
uint32_t randomSeed=0xC0FFEEu;
|
||||
float speedup=1.1f,maxSpeed=8.f;
|
||||
float gridX=146,gridY=15,cellX=45,cellY=45;
|
||||
};
|
||||
struct CoffeeShot { Point start,target,current;std::string ingredient; };
|
||||
struct CoffeeView {
|
||||
CoffeePhase phase=CoffeePhase::Initial;
|
||||
uint32_t countdownRemainingMs=0,playRemainingMs=0,score=0,misses=0;
|
||||
bool warning=false;
|
||||
std::vector<std::string> grid,conveyor;
|
||||
std::vector<bool> slotAvailable;
|
||||
std::vector<uint32_t> hopper;
|
||||
size_t collecting=0;
|
||||
float gridScale=1.f;
|
||||
std::vector<CoffeeShot> shots;
|
||||
};
|
||||
class CoffeeGame {
|
||||
public:
|
||||
bool configure(CoffeeConfig config,std::string* error=nullptr);
|
||||
void start();
|
||||
void tick(uint32_t elapsedMs);
|
||||
bool fire(Point target);
|
||||
void pause(bool value);
|
||||
void abort();
|
||||
CoffeeView view() const;
|
||||
CoffeePhase phase() const{return phase_;}
|
||||
uint32_t score() const{return score_;}
|
||||
uint32_t misses() const{return misses_;}
|
||||
private:
|
||||
struct Shot {Point target;std::string ingredient;uint32_t age=0;};
|
||||
struct Collection {std::string ingredient;uint32_t remaining=0;};
|
||||
void advance(uint32_t elapsedMs);
|
||||
void resolve(const Shot& shot);
|
||||
void collect(size_t index);
|
||||
void arrive(const std::string& ingredient);
|
||||
void replenish();
|
||||
void shift();
|
||||
uint32_t nextRandom();
|
||||
CoffeeConfig config_;
|
||||
CoffeePhase phase_=CoffeePhase::Initial;
|
||||
bool configured_=false,paused_=false;
|
||||
uint32_t countdown_=0,remaining_=0,ending_=0,conveyorClock_=0;
|
||||
double gridClock_=0;
|
||||
float gridScale_=1.f;
|
||||
uint32_t score_=0,misses_=0;
|
||||
size_t nextIngredient_=0;
|
||||
uint32_t randomState_=0;
|
||||
std::vector<std::string> grid_;
|
||||
std::vector<bool> slotAvailable_;
|
||||
std::vector<uint32_t> hopper_;
|
||||
std::deque<std::string> conveyor_;
|
||||
std::vector<Shot> shots_;
|
||||
std::vector<Collection> collecting_;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue