|
From: <cro...@li...> - 2003-07-13 17:49:12
|
Module Name: CFJavaEditor
Committed By: avogl
Date: Sun Jul 13 17:49:11 UTC 2003
Modified Files:
CFJavaEditor/src/cfeditor: ArchObject.java ArchObjectParser.java
ArchObjectStack.java CArchPanel.java CFJavaEditor.java
CMainControl.java CMainMenu.java CMainView.java CMapViewBasic.java
CPickmapPanel.java IGUIConstants.java JFontChooser.java
Log Message:
Enhanced map drawing logic to display big multipart images
correctly, as far as I understand the system.
There's also a new menu command which allows to quickly
open pickmaps in the mapview, for more detailed editing.
--AndreasV
The following files had too many changes to show the context diffs here:
cvs rdiff -r1.6 -r1.7 CFJavaEditor/src/cfeditor/ArchObjectParser.java
cvs rdiff -r1.10 -r1.11 CFJavaEditor/src/cfeditor/ArchObjectStack.java
Start of context diffs
Index: CFJavaEditor/src/cfeditor/ArchObject.java
diff -c CFJavaEditor/src/cfeditor/ArchObject.java:1.7 CFJavaEditor/src/cfeditor/ArchObject.java:1.8
*** CFJavaEditor/src/cfeditor/ArchObject.java:1.7 Sat May 3 11:23:06 2003
--- CFJavaEditor/src/cfeditor/ArchObject.java Sun Jul 13 10:49:10 2003
***************
*** 71,76 ****
--- 71,78 ----
private boolean editflag; // if true, object is in a editor
// for example in the map arch panel
+ private boolean artifacts_flag; // if set, this is not a "real" arch
+ // It will NOT be included in the arch collection
private ArchObject next; // to chain ArchObjects in maps
private ArchObject prev; // same
***************
*** 106,111 ****
--- 108,114 ----
container = inv_prev = inv_next = null;
noface = true; // this sucker has no face
+ artifacts_flag = false; // will be true for arches from the artifacts file
faceName = null; // if there is a face cmd, this is the face name
facenr = -1; // if we have a face AND we have loaded the face, this is his number.
// if faceName!=null and facenr==-1, we haven't loaded the face
***************
*** 338,344 ****
return(tmp_arch);
}
!
public void setPrevInv(ArchObject p)
{
inv_prev = p;
--- 341,354 ----
return(tmp_arch);
}
!
! public void setArtifactFlag(boolean aflag) {
! artifacts_flag = aflag;
! }
! public boolean getArtifactFlag() {
! return(artifacts_flag);
! }
!
public void setPrevInv(ArchObject p)
{
inv_prev = p;
***************
*** 355,361 ****
{
return(inv_next);
}
!
public ArchObject getStartInv()
{
return(inv_start);
--- 365,371 ----
{
return(inv_next);
}
!
public ArchObject getStartInv()
{
return(inv_start);
Index: CFJavaEditor/src/cfeditor/CFJavaEditor.java
diff -c CFJavaEditor/src/cfeditor/CFJavaEditor.java:1.13 CFJavaEditor/src/cfeditor/CFJavaEditor.java:1.14
*** CFJavaEditor/src/cfeditor/CFJavaEditor.java:1.13 Mon Jul 7 02:51:26 2003
--- CFJavaEditor/src/cfeditor/CFJavaEditor.java Sun Jul 13 10:49:11 2003
***************
*** 31,37 ****
* The launcher that launches the whole level editor application.
*
* @author <a href="mailto:mic...@no...">Michael Toennies</a>
! * @version $Revision: 1.13 $
*/
public class CFJavaEditor {
/**
--- 31,37 ----
* The launcher that launches the whole level editor application.
*
* @author <a href="mailto:mic...@no...">Michael Toennies</a>
! * @version $Revision: 1.14 $
*/
public class CFJavaEditor {
/**
Index: CFJavaEditor/src/cfeditor/CMainControl.java
diff -c CFJavaEditor/src/cfeditor/CMainControl.java:1.15 CFJavaEditor/src/cfeditor/CMainControl.java:1.16
*** CFJavaEditor/src/cfeditor/CMainControl.java:1.15 Mon Jul 7 02:51:26 2003
--- CFJavaEditor/src/cfeditor/CMainControl.java Sun Jul 13 10:49:11 2003
***************
*** 233,242 ****
// now collect all arch you can find in the arch path!!
System.gc();
! // Synchronize menus and toolbars
!
! // File f = new File("../maps/MWizard5");
! // openFile( f);
}
/**
* Loading the joinlist from file and attaching all to 'joinlist'.
--- 233,239 ----
// now collect all arch you can find in the arch path!!
System.gc();
! m_view.updateFocus(false); /*MTMT*/
}
/**
* Loading the joinlist from file and attaching all to 'joinlist'.
***************
*** 730,744 ****
if (activePickmap == null) {
showMessage("Cannot close Pickmap", "There are no pickmaps.");
}
! else if (!activePickmap.isLevelChanged()) {
! closeLevel(activePickmap, true);
! }
! else if (askConfirm(
! "Close Pickmap "+activePickmap.getMapFileName() +"?",
! "If you close the pickmap '"+activePickmap.getMapFileName()+"', all\n"+
! "recent changes will be lost. Do you really want to close it?") ) {
! // okay, then do it:
! closeLevel(activePickmap, true); // close the old map
}
}
}
--- 727,749 ----
if (activePickmap == null) {
showMessage("Cannot close Pickmap", "There are no pickmaps.");
}
! else {
! // if pickmap was modified, ask for confirmation:
! if (!activePickmap.isLevelChanged() || askConfirm("Close Pickmap "+activePickmap.getMapFileName() +"?",
! "If you close the pickmap '"+activePickmap.getMapFileName()+"', all recent\n"+
! "changes will be lost. Do you really want to close it?")) {
! File pickmapFile = activePickmap.mapFile;
! // close pickmap
! closeLevel(activePickmap, true);
!
! // also delete pickmap file?
! if (askConfirm("Delete File "+activePickmap.getMapFileName() +"?",
! "The pickmap '"+activePickmap.getMapFileName()+"' has been closed.\n"+
! "Do you also want to remove the pickmap file '"+activePickmap.getMapFileName()+"' from your harddisk?\n"+
! "(Doing so will permanently delete the pickmap.)")) {
! pickmapFile.delete();
! }
! }
}
}
}
***************
*** 791,796 ****
--- 796,836 ----
refreshMenusAndToolbars();
System.gc();
return true;
+ }
+
+ /**
+ * Open active pickmap as normal map for extensive editing
+ */
+ public void openActivePickmapAsMapWanted() {
+ if (!CPickmapPanel.getInstance().isLoadComplete()) {
+ showMessage("Cannot open Pickmap", "Pickmaps aren't loaded.\n"+
+ "Either there are no pickmaps or the loading process is not complete.");
+ }
+ else {
+ if (!getMainView().isPickmapActive()) {
+ showMessage("Cannot open Pickmap", "Pickmaps are currently hidden.\n"+
+ "Please select a pickmap before activating this command.");
+ }
+ else {
+ CMapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap();
+ if (activePickmap == null) {
+ showMessage("Cannot open Pickmap", "There are no pickmaps.");
+ }
+ else {
+ // open pickmap as map
+ File pickmapFile = activePickmap.mapFile;
+ if (!pickmapFile.exists()) {
+ if(askConfirm("Cannot open Pickmap", "The map file for '"+activePickmap.getMapFileName()+"' does not exist.\n"+
+ "Do you want to create the file by saving this pickmap?")) {
+ saveActivePickmapWanted();
+ openFile(pickmapFile);
+ }
+ }
+ else
+ openFile(pickmapFile);
+ }
+ }
+ }
}
/**
Index: CFJavaEditor/src/cfeditor/CMapViewBasic.java
diff -c CFJavaEditor/src/cfeditor/CMapViewBasic.java:1.11 CFJavaEditor/src/cfeditor/CMapViewBasic.java:1.12
*** CFJavaEditor/src/cfeditor/CMapViewBasic.java:1.11 Mon Jul 7 02:51:26 2003
--- CFJavaEditor/src/cfeditor/CMapViewBasic.java Sun Jul 13 10:49:11 2003
***************
*** 696,701 ****
--- 696,704 ----
}
else {
// ---------- draw rectangular map --------------
+ // this vector contains all heads of multi-tiles with oversized images
+ Vector oversizedMultiHeads = new Vector();
+
for (int y = 0; y < m_mapHeight; y++ ) {
for (int x = 0; x < m_mapWidth; x++ ) {
if(m_mapGrid[x][y]==null) {
***************
*** 721,727 ****
main_control.unknownTileIconX.paintIcon(this, grfx, x*32+bOffset,y*32+bOffset);
}
else {
! archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, x*32+bOffset,y*32+bOffset);
}
}
}
--- 724,735 ----
main_control.unknownTileIconX.paintIcon(this, grfx, x*32+bOffset,y*32+bOffset);
}
else {
! // draw object face
! img = archlist.getFace(node.getFaceNr());
! if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32))
! archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, x*32+bOffset,y*32+bOffset);
! else if (node.getRefCount() > 0)
! oversizedMultiHeads.addElement(node); // store oversized arches for later
}
}
}
***************
*** 730,735 ****
--- 738,750 ----
}
}
}
+ // at the end, we have to draw the oversized multipart images on top of the rest
+ for (int i=0; i<oversizedMultiHeads.size(); i++) {
+ node = (ArchObject)(oversizedMultiHeads.elementAt(i));
+ archlist.getFace(node.getFaceNr()).paintIcon(this, grfx, node.getMapX()*32+bOffset, node.getMapY()*32+bOffset);
+ }
+ oversizedMultiHeads = null;
+
// grid lines
if (showMapGrid && !is_snapshot) {
for (int x = 0; x <= m_mapWidth; x++ ) {
***************
*** 780,785 ****
--- 795,801 ----
}
else {
// ---------- draw tile for rectangular view (non-iso) --------------
+ ImageIcon img = null; // tmp image
// first, draw the object's faces:
if(m_mapGrid[x][y]==null) {
***************
*** 805,811 ****
if(node.getFaceNr() == -1) {
main_control.unknownTileIconX.paintIcon(this, tmp_grfx, 0,0);
} else {
! archlist.getFace(node.getFaceNr()).paintIcon(this, tmp_grfx, 0,0);
}
}
}
--- 821,834 ----
if(node.getFaceNr() == -1) {
main_control.unknownTileIconX.paintIcon(this, tmp_grfx, 0,0);
} else {
! img = archlist.getFace(node.getFaceNr());
! if (!node.isMulti() || (img.getIconWidth() == 32 && img.getIconHeight() == 32)
! || node.getRefCount() > 0)
! img.paintIcon(this, tmp_grfx, 0,0);
! else {
! // this is an oversized image and not the head, so it must be shifted
! img.paintIcon(this, tmp_grfx, -32*node.getRefX(), -32*node.getRefY());
! }
}
}
}
Index: CFJavaEditor/src/cfeditor/CPickmapPanel.java
diff -c CFJavaEditor/src/cfeditor/CPickmapPanel.java:1.5 CFJavaEditor/src/cfeditor/CPickmapPanel.java:1.6
*** CFJavaEditor/src/cfeditor/CPickmapPanel.java:1.5 Mon Jul 7 02:51:26 2003
--- CFJavaEditor/src/cfeditor/CPickmapPanel.java Sun Jul 13 10:49:11 2003
***************
*** 109,117 ****
m_control.refreshMenusAndToolbars();
// did we get something?
! if (!m_pickmaps.isEmpty())
loadComplete = true;
updateActivePickmap(); // make sure we know which one is on top
}
--- 109,121 ----
m_control.refreshMenusAndToolbars();
// did we get something?
! if (!m_pickmaps.isEmpty()) {
loadComplete = true;
+ if (IGUIConstants.isoView)
+ m_control.getMainView().movePickmapPanelToFront();
+ }
+
updateActivePickmap(); // make sure we know which one is on top
}
***************
*** 175,181 ****
public boolean addNewPickmap(MapArchObject maparch) {
CMapViewBasic bmapview = null;
! File mapFile = new File(IGUIConstants.PICKMAP_DIR +File.separator+ maparch.getFileName());
if (mapFile.exists()) {
m_control.showMessage("Cannot Create Pickmap", "A pickmap named '"+mapFile+"' already exists.\n"+
"Either remove the existing one or choose a different name.", JOptionPane.ERROR_MESSAGE);
--- 179,186 ----
public boolean addNewPickmap(MapArchObject maparch) {
CMapViewBasic bmapview = null;
! File mapFile = new File((IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder()+File.separator+IGUIConstants.PICKMAP_DIR+File.separator+maparch.getFileName() :
! IGUIConstants.PICKMAP_DIR + File.separator + maparch.getFileName()));
if (mapFile.exists()) {
m_control.showMessage("Cannot Create Pickmap", "A pickmap named '"+mapFile+"' already exists.\n"+
"Either remove the existing one or choose a different name.", JOptionPane.ERROR_MESSAGE);
Index: CFJavaEditor/src/cfeditor/JFontChooser.java
diff -c CFJavaEditor/src/cfeditor/JFontChooser.java:1.9 CFJavaEditor/src/cfeditor/JFontChooser.java:1.10
*** CFJavaEditor/src/cfeditor/JFontChooser.java:1.9 Mon Jul 7 02:51:26 2003
--- CFJavaEditor/src/cfeditor/JFontChooser.java Sun Jul 13 10:49:11 2003
***************
*** 10,16 ****
*
* Valentin Tablan 06/04/2001
*
! * $Id: JFontChooser.java,v 1.9 2003/07/07 09:51:26 avogl Exp $
*
*/
package cfeditor;
--- 10,16 ----
*
* Valentin Tablan 06/04/2001
*
! * $Id: JFontChooser.java,v 1.10 2003/07/13 17:49:11 avogl Exp $
*
*/
package cfeditor;
|