@@ -70,7 +70,6 @@ public class DungeonDemo extends ApplicationAdapter {
70
70
private final ObjectDeque <Coord > nextMovePositions = new ObjectDeque <>(200 );
71
71
private Coord cursor = Coord .get (-1 , -1 );
72
72
private final Vector2 pos = new Vector2 ();
73
- private Runnable post ;
74
73
75
74
public static final int SHOWN_WIDTH = 40 ;
76
75
public static final int SHOWN_HEIGHT = 25 ;
@@ -128,14 +127,6 @@ public void create() {
128
127
129
128
playerGlyph = new GlyphActor (buffer .charAt (buffer .length ()-1 ), "[red orange]" , gg .getFont ());
130
129
gg .addActor (playerGlyph );
131
- post = () -> {
132
- Coord next = Coord .get (Math .round (playerGlyph .getX ()), Math .round (playerGlyph .getY ()));
133
- vision .moveViewer (player , next );
134
- // we can move the player's light now that we know there is no light for an enemy at next.
135
- vision .lighting .moveLight (player , next );
136
- player = next ;
137
- vision .finishChanges ();
138
- };
139
130
140
131
dungeonProcessor = new DungeonProcessor (PLACE_WIDTH , PLACE_HEIGHT , random );
141
132
dungeonProcessor .addWater (DungeonProcessor .ALL , 30 );
@@ -219,7 +210,10 @@ public void move(Direction way){
219
210
220
211
final Coord next = Coord .get (Math .round (playerGlyph .getX () + way .deltaX ), Math .round (playerGlyph .getY () + way .deltaY ));
221
212
if (next .isWithin (PLACE_WIDTH , PLACE_HEIGHT ) && barePlaceMap [next .x ][next .y ] == '.' ) {
222
- playerGlyph .addAction (MoreActions .slideTo (next .x , next .y , 0.2f , post ));
213
+ playerGlyph .addAction (MoreActions .slideTo (next .x , next .y , 0.2f ));
214
+ vision .moveViewer (player , next );
215
+ vision .lighting .moveLight (player , next );
216
+ player = next ;
223
217
}
224
218
else {
225
219
// if(MathUtils.randomBoolean())
@@ -230,10 +224,11 @@ public void move(Direction way){
230
224
// .append(new GridAction.CloudAction(gg, 1.5f, inView, next, 5).useToxicColors()).conclude(post));
231
225
// playerGlyph.addAction(MoreActions.bump(way, 0.3f).append(MoreActions.wiggle(0.125f, 0.2f)));
232
226
playerGlyph .addAction (MoreActions .bump (way , 0.3f ));
233
- gg .burst ((playerGlyph .getX () + next .x ) * 0.5f , (playerGlyph .getY () + next .y ) * 0.5f , 1.5f , 7 , ', ' , 0x992200FF , 0x99220000 , 0f , 120f , 1f );
227
+ gg .burst ((playerGlyph .getX () + next .x ) * 0.5f , (playerGlyph .getY () + next .y ) * 0.5f , 1.5f , 6 , '? ' , 0x992200FF , 0x99220000 , - 30f , 0f , 1f );
234
228
// gg.summon(next.x, next.y, next.x, next.y + 0.5f, '?', 0xFF22CCAA, 0xFF22CC00, 0f, 0f, 1f);
235
229
// gg.addAction(gg.dyeFG(next.x, next.y, 0x992200FF, 1f, Float.POSITIVE_INFINITY, null));
236
230
}
231
+ vision .finishChanges ();
237
232
}
238
233
239
234
public void regenerate (){
@@ -267,7 +262,7 @@ public void regenerate(){
267
262
public void putMap (){
268
263
int playerX = Math .round (playerGlyph .getX ());
269
264
int playerY = Math .round (playerGlyph .getY ());
270
- float change = (float ) Math .min (Math .max (TimeUtils .timeSinceMillis (lastMove ) * 4.0 , 0.0 ), 1000.0 );
265
+ float change = (float ) Math .min (Math .max (TimeUtils .timeSinceMillis (lastMove ) * 4f , 0.0 ), 1000.0 );
271
266
// Makes everything visible, mainly for FPS tests
272
267
// ArrayTools.fill(vision.lighting.resistances, 0f);
273
268
vision .update (change );
@@ -296,46 +291,46 @@ public void putMap(){
296
291
297
292
for (int y = 0 ; y < PLACE_HEIGHT ; y ++) {
298
293
for (int x = 0 ; x < PLACE_WIDTH ; x ++) {
299
- if (vision .inView .contains (x , y )) {
294
+ if (vision .seen .contains (x , y )) {
300
295
{
301
296
switch (vision .prunedPlaceMap [x ][y ]) {
302
297
case '~' :
303
- gg .backgrounds [x ][y ] = toRGBA8888 (lerpColors ( DEEP_OKLAB , vision .backgroundColors [x ][y ], 0.4f + 0.3f * waves .getConfiguredNoise (x , y , time )));
298
+ gg .backgrounds [x ][y ] = toRGBA8888 (lerpColorsBlended ( vision .backgroundColors [x ][y ], DEEP_OKLAB , 0.4f + 0.3f * waves .getConfiguredNoise (x , y , time )));
304
299
gg .put (x , y , vision .prunedPlaceMap [x ][y ], deepText );
305
300
break ;
306
301
case ',' :
307
- gg .backgrounds [x ][y ] = toRGBA8888 (lerpColors ( SHALLOW_OKLAB , vision .backgroundColors [x ][y ], 0.4f + 0.3f * waves .getConfiguredNoise (x , y , time )));
302
+ gg .backgrounds [x ][y ] = toRGBA8888 (lerpColorsBlended ( vision .backgroundColors [x ][y ], SHALLOW_OKLAB , 0.4f + 0.3f * waves .getConfiguredNoise (x , y , time )));
308
303
gg .put (x , y , vision .prunedPlaceMap [x ][y ], shallowText );
309
304
break ;
310
305
case '"' :
311
- gg .backgrounds [x ][y ] = toRGBA8888 (lerpColors ( lerpColors (GRASS_OKLAB , DRY_OKLAB , waves .getConfiguredNoise (x , y ) * 0.5f + 0.5f ), vision . backgroundColors [ x ][ y ] , 0.3f + 0.2f * waves .getConfiguredNoise (x , y , time * 0.7f )));
306
+ gg .backgrounds [x ][y ] = toRGBA8888 (lerpColorsBlended ( vision . backgroundColors [ x ][ y ], lerpColors (GRASS_OKLAB , DRY_OKLAB , waves .getConfiguredNoise (x , y ) * 0.5f + 0.5f ), 0.3f + 0.2f * waves .getConfiguredNoise (x , y , time * 0.7f )));
312
307
gg .put (x , y , vision .prunedPlaceMap [x ][y ], grassText );
313
308
break ;
314
309
case ' ' :
315
310
gg .backgrounds [x ][y ] = 0 ;
316
311
break ;
317
312
default :
318
- gg .backgrounds [x ][y ] = toRGBA8888 (lerpColors ( STONE_OKLAB , vision .backgroundColors [x ][y ], 0.5f ));
313
+ gg .backgrounds [x ][y ] = toRGBA8888 (lerpColorsBlended ( vision .backgroundColors [x ][y ], STONE_OKLAB , 0.5f ));
319
314
gg .put (x , y , vision .prunedPlaceMap [x ][y ], stoneText );
320
315
}
321
316
}
322
- } else if (vision .seen .contains (x , y )) {
323
- switch (vision .prunedPlaceMap [x ][y ]) {
324
- case '~' :
325
- gg .backgrounds [x ][y ] = toRGBA8888 (edit (DEEP_OKLAB , 0f , 0f , 0f , 0f , 0.7f , 0f , 0f , 1f ));
326
- gg .put (x , y , vision .prunedPlaceMap [x ][y ], deepText );
327
- break ;
328
- case ',' :
329
- gg .backgrounds [x ][y ] = toRGBA8888 (edit (SHALLOW_OKLAB , 0f , 0f , 0f , 0f , 0.7f , 0f , 0f , 1f ));
330
- gg .put (x , y , vision .prunedPlaceMap [x ][y ], shallowText );
331
- break ;
332
- case ' ' :
333
- gg .backgrounds [x ][y ] = 0 ;
334
- break ;
335
- default :
336
- gg .backgrounds [x ][y ] = toRGBA8888 (edit (STONE_OKLAB , 0f , 0f , 0f , 0f , 0.7f , 0f , 0f , 1f ));
337
- gg .put (x , y , vision .prunedPlaceMap [x ][y ], stoneText );
338
- }
317
+ // } else if (vision.seen.contains(x, y)) {
318
+ // switch (vision.prunedPlaceMap[x][y]) {
319
+ // case '~':
320
+ // gg.backgrounds[x][y] = toRGBA8888(edit(DEEP_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
321
+ // gg.put(x, y, vision.prunedPlaceMap[x][y], deepText);
322
+ // break;
323
+ // case ',':
324
+ // gg.backgrounds[x][y] = toRGBA8888(edit(SHALLOW_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
325
+ // gg.put(x, y, vision.prunedPlaceMap[x][y], shallowText);
326
+ // break;
327
+ // case ' ':
328
+ // gg.backgrounds[x][y] = 0;
329
+ // break;
330
+ // default:
331
+ // gg.backgrounds[x][y] = toRGBA8888(edit(STONE_OKLAB, 0f, 0f, 0f, 0f, 0.7f, 0f, 0f, 1f));
332
+ // gg.put(x, y, vision.prunedPlaceMap[x][y], stoneText);
333
+ // }
339
334
} else {
340
335
gg .backgrounds [x ][y ] = 0 ;
341
336
}
0 commit comments