Still need to fix 0arr, gravity and implement ige
This commit is contained in:
parent
ccb4909021
commit
f0d4d809a3
|
@ -22,7 +22,12 @@ class HandlingHandler{
|
||||||
arrLeft = arr;
|
arrLeft = arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void movementKeyPressed(bool left, bool right, double subframe){
|
@override
|
||||||
|
String toString(){
|
||||||
|
return "das: ${das}f; arr: ${arr}f";
|
||||||
|
}
|
||||||
|
|
||||||
|
int movementKeyPressed(bool left, bool right, double subframe){
|
||||||
if (left) {
|
if (left) {
|
||||||
activeLeft = left;
|
activeLeft = left;
|
||||||
direction = -1;
|
direction = -1;
|
||||||
|
@ -32,6 +37,7 @@ class HandlingHandler{
|
||||||
direction = 1;
|
direction = 1;
|
||||||
}
|
}
|
||||||
dasLeft = das - (1 - subframe);
|
dasLeft = das - (1 - subframe);
|
||||||
|
return direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
int movementKeyReleased(bool left, bool right, double subframe){
|
int movementKeyReleased(bool left, bool right, double subframe){
|
||||||
|
@ -60,7 +66,7 @@ class HandlingHandler{
|
||||||
if (!activeLeft && !activeRight) return 0;
|
if (!activeLeft && !activeRight) return 0;
|
||||||
if (dasLeft > 0.0) {
|
if (dasLeft > 0.0) {
|
||||||
dasLeft -= delta;
|
dasLeft -= delta;
|
||||||
if (dasLeft <= 0.0) {
|
if (dasLeft < 0.0) {
|
||||||
arrLeft += dasLeft;
|
arrLeft += dasLeft;
|
||||||
dasLeft = 0.0;
|
dasLeft = 0.0;
|
||||||
return direction;
|
return direction;
|
||||||
|
@ -69,7 +75,7 @@ class HandlingHandler{
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
arrLeft -= delta;
|
arrLeft -= delta;
|
||||||
if (arrLeft <= 0.0) {
|
if (arrLeft < 0.0) {
|
||||||
arrLeft += arr;
|
arrLeft += arr;
|
||||||
return direction;
|
return direction;
|
||||||
}else {
|
}else {
|
||||||
|
@ -147,7 +153,7 @@ void main() async {
|
||||||
Board board = Board(10, 20, 20);
|
Board board = Board(10, 20, 20);
|
||||||
Tetromino? hold;
|
Tetromino? hold;
|
||||||
int rot = 0;
|
int rot = 0;
|
||||||
Coords coords = Coords(4, 21);
|
Coords coords = Coords(3, 21);
|
||||||
double gravityBucket = 0.00000000000000;
|
double gravityBucket = 0.00000000000000;
|
||||||
|
|
||||||
developer.log("Seed is ${replay.stats[0][0].seed}, first bag is $queue");
|
developer.log("Seed is ${replay.stats[0][0].seed}, first bag is $queue");
|
||||||
|
@ -199,6 +205,7 @@ void main() async {
|
||||||
case EventType.full:
|
case EventType.full:
|
||||||
settings = (nextEvent as EventFull).data.options;
|
settings = (nextEvent as EventFull).data.options;
|
||||||
handling = HandlingHandler(settings!.handling!.das.toDouble(), settings.handling!.arr.toDouble());
|
handling = HandlingHandler(settings!.handling!.das.toDouble(), settings.handling!.arr.toDouble());
|
||||||
|
print(handling);
|
||||||
break;
|
break;
|
||||||
case EventType.keydown:
|
case EventType.keydown:
|
||||||
nextEvent as EventKeyPress;
|
nextEvent as EventKeyPress;
|
||||||
|
@ -214,10 +221,9 @@ void main() async {
|
||||||
rot = (rot+2)%4;
|
rot = (rot+2)%4;
|
||||||
break;
|
break;
|
||||||
case KeyType.moveLeft:
|
case KeyType.moveLeft:
|
||||||
handling!.movementKeyPressed(true, false, nextEvent.data.subframe);
|
|
||||||
break;
|
|
||||||
case KeyType.moveRight:
|
case KeyType.moveRight:
|
||||||
handling!.movementKeyPressed(false, true, nextEvent.data.subframe);
|
int pontencialMovement = handling!.movementKeyPressed(nextEvent.data.key == KeyType.moveLeft, nextEvent.data.key == KeyType.moveRight, nextEvent.data.subframe);
|
||||||
|
if (board.positionIsValid(current, Coords(coords.x+pontencialMovement, coords.y), rot)) coords.x += pontencialMovement;
|
||||||
break;
|
break;
|
||||||
case KeyType.softDrop:
|
case KeyType.softDrop:
|
||||||
handling!.sdfActive = true;
|
handling!.sdfActive = true;
|
||||||
|
@ -226,7 +232,7 @@ void main() async {
|
||||||
coords.y = sonicDrop();
|
coords.y = sonicDrop();
|
||||||
board.writeToBoard(current, coords, rot);
|
board.writeToBoard(current, coords, rot);
|
||||||
current = getNewOne();
|
current = getNewOne();
|
||||||
coords = Coords(4, 21) + spawnPositionFixes[current.index];
|
coords = Coords(3, 21) + spawnPositionFixes[current.index];
|
||||||
//handling!.movementKeyReleased(true, true);
|
//handling!.movementKeyReleased(true, true);
|
||||||
case KeyType.hold:
|
case KeyType.hold:
|
||||||
switch (hold){
|
switch (hold){
|
||||||
|
@ -241,7 +247,7 @@ void main() async {
|
||||||
current = temp;
|
current = temp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
coords = Coords(4, 21) + spawnPositionFixes[current.index];
|
coords = Coords(3, 21) + spawnPositionFixes[current.index];
|
||||||
break;
|
break;
|
||||||
case KeyType.chat:
|
case KeyType.chat:
|
||||||
// TODO: Handle this case.
|
// TODO: Handle this case.
|
||||||
|
@ -257,11 +263,8 @@ void main() async {
|
||||||
nextEvent as EventKeyPress;
|
nextEvent as EventKeyPress;
|
||||||
switch (nextEvent.data.key){
|
switch (nextEvent.data.key){
|
||||||
case KeyType.moveLeft:
|
case KeyType.moveLeft:
|
||||||
int pontencialMovement = handling!.movementKeyReleased(true, false, nextEvent.data.subframe);
|
|
||||||
if (board.positionIsValid(current, Coords(coords.x+pontencialMovement, coords.y), rot)) coords.x += pontencialMovement;
|
|
||||||
break;
|
|
||||||
case KeyType.moveRight:
|
case KeyType.moveRight:
|
||||||
int pontencialMovement = handling!.movementKeyReleased(false, true, nextEvent.data.subframe);
|
int pontencialMovement = handling!.movementKeyReleased(nextEvent.data.key == KeyType.moveLeft, nextEvent.data.key == KeyType.moveRight, nextEvent.data.subframe);
|
||||||
if (board.positionIsValid(current, Coords(coords.x+pontencialMovement, coords.y), rot)) coords.x += pontencialMovement;
|
if (board.positionIsValid(current, Coords(coords.x+pontencialMovement, coords.y), rot)) coords.x += pontencialMovement;
|
||||||
break;
|
break;
|
||||||
case KeyType.softDrop:
|
case KeyType.softDrop:
|
||||||
|
|
|
@ -815,7 +815,7 @@ List<List<List<Coords>>> shapes = [
|
||||||
[Coords(0, 1), Coords(1, 0), Coords(1, 1), Coords(1, 2)]
|
[Coords(0, 1), Coords(1, 0), Coords(1, 1), Coords(1, 2)]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
List<Coords> spawnPositionFixes = [Coords(0, 0), Coords(0, 0), Coords(1, 1), Coords(0, 0), Coords(0, -1), Coords(0, 0), Coords(0, 0)];
|
List<Coords> spawnPositionFixes = [Coords(0, 0), Coords(0, 0), Coords(2, 1), Coords(0, 0), Coords(0, -1), Coords(0, 0), Coords(0, 0)];
|
||||||
|
|
||||||
const Map<String, double> garbage = {
|
const Map<String, double> garbage = {
|
||||||
"single": 0,
|
"single": 0,
|
||||||
|
|
|
@ -288,6 +288,13 @@ class SettingsState extends State<SettingsView> {
|
||||||
subtitle: Text(t.aboutAppText(appName: packageInfo.appName, packageName: packageInfo.packageName, version: packageInfo.version, buildNumber: packageInfo.buildNumber)),
|
subtitle: Text(t.aboutAppText(appName: packageInfo.appName, packageName: packageInfo.packageName, version: packageInfo.version, buildNumber: packageInfo.buildNumber)),
|
||||||
trailing: const Icon(Icons.arrow_right)
|
trailing: const Icon(Icons.arrow_right)
|
||||||
),
|
),
|
||||||
|
Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
TextButton(child: Text("Donate to me"), onPressed: (){},),TextButton(child: Text("Donate to NOT me"), onPressed: (){},),TextButton(child: Text("Donate to someone else"), onPressed: (){},),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue