/** Sauvegarde la carte en cours dans le fichier sélectionné */ public void save() { if (fileChooser.getSelectedFile() == null) { return; } String name = fileChooser.getSelectedFile().getName(); EngineZildo.getMapManagement().getCurrentMap().setName(name); masterFrame.getManager().saveAs(name); }
void debug() { int fps = (int) openGLGestion.getFPS(); ortho.drawText(1, 50, "fps=" + fps, new Vector3f(0.0f, 0.0f, 1.0f)); SpriteEntity zildo = spriteDisplay.getZildo(); if (zildo == null) { return; } ortho.drawText(1, 80, "zildo: " + zildo.x, new Vector3f(1.0f, 0.0f, 1.0f)); ortho.drawText(43, 86, "" + zildo.y, new Vector3f(1.0f, 0.0f, 1.0f)); // Debug collision Point camera = mapDisplay.getCamera(); if (EngineZildo.collideManagement != null && Zildo.infoDebugCollision) { for (Collision c : EngineZildo.collideManagement.getTabColli()) { if (c != null) { int rayon = c.cr; int color = 15; Perso damager = c.perso; Vector4f alphaColor = new Vector4f(0.2f, 0.4f, 0.9f, 16.0f); if (damager != null && damager.getInfo() == PersoInfo.ENEMY) { color = 20; } if (c.size == null) { ortho.box( c.cx - rayon - camera.x, c.cy - rayon - camera.y, rayon * 2, rayon * 2, 0, alphaColor); } else { Point center = new Point(c.cx - camera.x, c.cy - camera.y); Rectangle rect = new Rectangle(center, c.size); ortho.box(rect, color, null); } } } // -7, -10 int x = (int) zildo.x - 4; int y = (int) zildo.y - 10; ortho.box(x - 3 - camera.x, y - camera.y, 16, 16, 12, null); } if (Zildo.infoDebugCase) { for (int y = 0; y < 20; y++) { for (int x = 0; x < 20; x++) { int cx = x + camera.x / 16; int cy = y + camera.y / 16; int px = x * 16 - camera.x % 16; int py = y * 16 - camera.y % 16; if (cy < 64 && cx < 64) { Case c = EngineZildo.getMapManagement().getCurrentMap().get_mapcase(cx, cy + 4); int onmap = EngineZildo.getMapManagement().getCurrentMap().readmap(cx, cy); ortho.drawText(px, py + 4, "" + c.getZ(), new Vector3f(0, 1, 0)); ortho.drawText(px, py, "" + onmap, new Vector3f(1, 0, 0)); } } } } }
public ClientEvent renderEvent(ClientEvent p_event) { ClientEvent retEvent = p_event; boolean displayGUI = !p_event.script && !p_event.mapChange; if (p_event.wait != 0) { p_event.wait--; } else { switch (p_event.nature) { case CHANGINGMAP_ASKED: // Changing map : 1/3 we launch the fade out retEvent.effect = p_event.effect; // FilterEffect.BLEND; case FADE_OUT: retEvent.nature = ClientEventNature.FADING_OUT; guiDisplay.fadeOut(retEvent.effect); break; case FADING_OUT: if (guiDisplay.isFadeOver()) { retEvent.nature = ClientEventNature.FADEOUT_OVER; } else { circleOnZildo(); } break; case CLEAR: // Reset fade, hide Zildo and kill the current map filterCommand.fadeEnd(); EngineZildo.getMapManagement().deleteCurrentMap(); EngineZildo.persoManagement.getZildo().setX(-100); ClientEngineZildo.tileEngine.cleanUp(); break; case CHANGINGMAP_LOADED: // Changing map : 2/3 we load the new map and launch the // fade in case FADE_IN: retEvent.nature = ClientEventNature.FADING_IN; guiDisplay.fadeIn(retEvent.effect); break; case FADING_IN: if (guiDisplay.isFadeOver()) { // Changing map : 3/3 we unblock the player filterCommand.active(retEvent.effect.getFilterClass()[0], false, null); filterCommand.active(BilinearFilter.class, true, null); retEvent.nature = ClientEventNature.NOEVENT; retEvent.mapChange = false; } else { // Call Circle filter to focus on Zildo circleOnZildo(); } break; case CHANGINGMAP_SCROLL_ASKED: retEvent.nature = ClientEventNature.CHANGINGMAP_SCROLL_WAIT_MAP; displayGUI = false; break; case CHANGINGMAP_SCROLL_START: if (mapDisplay.getTargetCamera() == null) { mapDisplay.centerCamera(); mapDisplay.shiftForMapScroll(p_event.angle); retEvent.nature = ClientEventNature.CHANGINGMAP_WAITSCRIPT; } displayGUI = false; break; case CHANGINGMAP_SCROLL: displayGUI = false; if (!mapDisplay.isScrolling()) { retEvent.nature = ClientEventNature.CHANGINGMAP_SCROLLOVER; // Show GUI sprites back displayGUI = true; // mapDisplay.setPreviousMap(null); } break; case NOEVENT: if (askedEvent != null) { retEvent.nature = askedEvent.nature; askedEvent = null; } break; default: break; } } // Remove GUI when scripting guiDisplay.setToDisplay_generalGui(displayGUI); return retEvent; }