diff --git a/.gitignore b/.gitignore index f3d6549..95832e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/build/ \ No newline at end of file +/build/ +/dist/ \ No newline at end of file diff --git a/docs/format_map.txt b/docs/format_map.txt new file mode 100644 index 0000000..f9b3c5d --- /dev/null +++ b/docs/format_map.txt @@ -0,0 +1,200 @@ +Every map consists of two NARC archives storing the layout and +textures of the scene: +* .map.tex.lz: Textures +* .map.dat.lz: Layout + +The exact content of these archives is thoroughly described +below. As denoted by the file extension, the archives are LZ10 +compressed. + +* Content of .map.tex.lz: +- Magic "TEX" + - NARC + - NARCs for each tileset + - NCBR texture + - NCLR palette + + +* Content of .map.dat.lz: +- Binary file "MPIF" +- Binary file "TXIF" +- Binary file "LYR" + - NARC container + - NARC files for each layer + - binary files; first uint32 is the data identifier +- Binary file "CTA" + - NARC container + - ~todo~ +- Binary file "PLA" + - NARC container + - ~todo~ + + +--------------------------------------------------------------- + +* MPIF (0x14 bytes) +0x00 uint32 magic +0x04 uint32 width +0x08 uint32 height +0x0C uint32 unknown +0x10 uint32 unknown + + +* TXIF (0x8 bytes + entries * 0x8 bytes) +0x00 uint32 magic +0x04 uint16 textures count +0x06 uint16 unknown +0x08 texture entries (à 0x8 bytes) + 0x00 uint16 unknown + 0x02 uint16 texture ID + 0x04 uint16 unknown + 0x05 uint16 unknown + + +--------------------------------------------------------------- + +* LYR files: + +Type 0x01 - Unknown: +0x00 uint32 identifier + + +Type 0x02 - Tiles +0x00 uint32 identifier +0x04 uint32 data size +0x08 uint32 always 0x14, header size without identifier?? +0x0C uint32 entry size(?) +0x10 uint32 unknown + ~todo~ + + +Type 0x03 - Collision +0x00 uint32 identifier +0x04 uint32 always 0x10, header size without identifier?? +0x08 uint32 entries count (width * height) +0x0C uint32 width +0x10 uint32 height +0x14 entries (à 0x2 bytes) + 0x00 uint16 collision type + + +Type 0x04 - Obstacles: +0x00 uint32 identifier +0x04 uint32 entries count +0x08 entries (à 0xC bytes) + 0x00 uint16 X-Pos + 0x02 uint16 Y-Pos + 0x04 int8 unknown + 0x05 int8 unknown + 0x06 uint16 Obstacle ID + 0x08 int16 upper bytes for 0x06 (?) + 0x0A int8 unknown, maybe uint16 + 0x0B int8 unknown, upper byte for 0x0A (?) + + +Type 0x05 - Unused +0x00 uint32 identifier + ~todo~ + + +Type 0x06 - Overlay collision(?) +0x00 uint32 identifier +0x04 uint32 always 0x10, header size without identifier?? +0x08 uint32 entries count (width * height) +0x0C uint32 width +0x10 uint32 height +0x14 entries (à 0x2 bytes) + 0x00 uint16 collision type + + +Type 0x07 - Trigger: +0x00 uint32 identifier +0x04 uint32 entries count +0x08 entries (à 0xA bytes) + 0x00 uint16 X-Pos + 0x02 uint16 Y-Pos + 0x04 uint16 Width + 0x06 uint16 Height + 0x08 uint16 unknown + + +Type 0x08 - NPC: +0x00 uint32 identifier +0x04 uint32 entries count +0x08 entries (à 0xB bytes) + 0x00 uint16 X-Pos + 0x02 uint16 Y-Pos + 0x04 uint8 Direction + 0x05 bool8 Is active? + 0x06 uint16 NPC ID + 0x08 int8 unknown + 0x09 int8 unknown + 0x0A bool8 unknown + + +Type 0x09 - Pokémon: +0x00 uint32 identifier +0x04 uint32 entries count +0x08 entries (à 0xA bytes) + 0x00 uint16 X-Pos + 0x02 uint16 Y-Pos + 0x04 uint8 Behavior + 0x05 uint8 Appearance + 0x06 uint16 Pokémon ID + 0x08 int8 unknown + 0x09 int8 unknown + + +Type 0x0A - Unknown +0x00 uint32 identifier + ~todo~ + + +Type 0x0B - Unknown +0x00 uint32 identifier + ~todo~ + + +Type 0x0C - Unknown +0x00 uint32 identifier + ~todo~ + + +Type 0x0D - Unknown: +0x00 uint32 identifier +0x04 uint32 entries count +0x08 entries (à 0x12 bytes) + ~todo~ + + +Type 0x0E - Unknown +0x00 uint32 identifier + ~todo~ + + +-------------------------------------------------------------- + +* Direction values +0x00 down +0x01 left +0x02 up +0x03 right +0x04 down(?) +0x05 left(?) +0x06 up(?) +0x07 right(?) +0x08 down(?) +0x09 left(?) +0x0A up(?) +0x0B right(?) + +* Appearance values +0x00 Not active +0x01 Active +0x02 Spawns from Tree + +* Behavior values Qwilfish +0x00 Moving +0x01 Cautious +0x02 Still (Unused) +0x03 Still \ No newline at end of file diff --git a/docs/format_mesg.txt b/docs/format_mesg.txt new file mode 100644 index 0000000..a689e3e --- /dev/null +++ b/docs/format_mesg.txt @@ -0,0 +1,16 @@ +* FORMAT: MESG +* EXTENSION: .meslz +* COMPRESSION: LZ10 +* USE: Stores list of message strings. + +* STRUCTURE: +Every MESG file starts with a header that is 0x18 bytes long: + 0x00 int File size + 0x04 int Number of messages + 0x08 int Unknown (always 0x10) + 0x0C byte[12] Unknown (constant) + +The header is followed by the actual text strings. The messages +are preceeded by an integer denoting the length of the string. +All messages appear to be encoded in UTF-8, although this needs +to be confirmed... diff --git a/docs/list_mons.txt b/docs/list_mons.txt new file mode 100644 index 0000000..58917cb --- /dev/null +++ b/docs/list_mons.txt @@ -0,0 +1,500 @@ +NONE (NONE x0) +Charmander (Burn x1) +Charmeleon (Burn x2) +Squirtle (Soak x1) +Wartortle (Soak x2) +Blastoise (Rain Dance x9) +Weedle (Tackle x1) +Beedrill (Crush x2) +Rattata (Tackle x1) +Raticate (Cut x2) +Spearow (Cut x1) +Fearow (Cut x3) +Pikachu (Recharge x3) +Raichu (Recharge x4) +Sandshrew (Tunnel x1) +Sandslash (Tunnel x1) +Vulpix (Burn x1) +Ninetales (Burn x4) +Jigglypuff (Tackle x1) +Wigglytuff (Tackle x2) +Zubat (Cut x1) +Golbat (Crush x2) +Oddish (Cut x1) +Gloom (Cut x2) +Vileplume (Cut x3) +Mankey (Crush x1) +Primeape (Crush x3) +Growlithe (Burn x2) +Arcanine (Burn x4) +Abra (Tackle x1) +Alakazam (Teleport x9) +Machop (NONE x0) +Machoke (Tackle x2) +Machamp (Crush x3) +Victreebel (Cut x2) +Tentacruel (Crush x2) +Geodude (Crush x1) +Graveler (Crush x2) +Golem (Crush x4) +Ponyta (Burn x1) +Rapidash (Burn x3) +Magnemite (Recharge x2) +Magneton (Recharge x5) +Doduo (Agility x9) +Dodrio (Tackle x2) +Muk (Crush x3) +Gastly (Psy Power x1) +Haunter (Psy Power x2) +Gengar (Psy Power x3) +Drowzee (Crush x2) +Hypno (Psy Power x2) +Voltorb (Electrify x2) +Electrode (Electrify x3) +Koffing (Tackle x1) +Weezing (Tackle x2) +Rhyhorn (Tackle x2) +Rhydon (Tackle x3) +Kangaskhan (Crush x2) +Horsea (Tackle x2) +Seadra (Soak x3) +Staryu (Cut x1) +Starmie (Cut x3) +Mr. Mime (Teleport x9) +Scyther (Cut x3) +Jynx (Teleport x9) +Electabuzz (Flash x9) +Magmar (Burn x2) +Pinsir (Cut x2) +Tauros (Tackle x2) +Eevee (Tackle x1) +Vaporeon (Soak x3) +Jolteon (Electrify x3) +Flareon (Burn x3) +Omanyte (Tackle x2) +Omastar (Soak x3) +Dratini (Tackle x1) +Spinarak (Tackle x1) +Ariados (Tackle x3) +Crobat (Crush x3) +Chinchou (Recharge x2) +Lanturn (Recharge x4) +Pichu (Recharge x1) +Mareep (Electrify x1) +Flaaffy (Electrify x2) +Ampharos (Electrify x3) +Bellossom (Cut x3) +Sudowoodo (Crush x2) +Aipom (Tackle x1) +Yanma (Cut x2) +Espeon (Teleport x9) +Umbreon (Cut x3) +Murkrow (Cut x1) +Misdreavus (NONE x0) +Girafarig (Tackle x2) +Pineco (Tackle x1) +Forretress (Crush x2) +Gligar (Cut x1) +Qwilfish (Soak x1) +Scizor (Cut x4) +Sneasel (NONE x0) +Slugma (Burn x1) +Magcargo (Burn x2) +Swinub (Tackle x1) +Piloswine (Tackle x3) +Corsola (Crush x2) +Delibird (Crush x1) +Mantine (Swim x9) +Skarmory (Demist x9) +Houndour (Tackle x1) +Houndoom (Burn x2) +Tyrogue (Crush x1) +Elekid (Electrify x2) +Magby (Burn x1) +Miltank (Tackle x2) +Larvitar (Crush x1) +Pupitar (Crush x2) +Tyranitar (Crush x4) +Sceptile (Cut x3) +Blaziken (Burn x3) +Seedot (Tackle x1) +Nuzleaf (Tackle x2) +Shiftry (Cut x3) +Taillow (Cut x1) +Swellow (Cut x2) +Wingull (Soak x1) +Pelipper (Soak x3) +Ralts (Tackle x1) +Kirlia (Teleport x9) +Gardevoir (Psy Power x3) +Slakoth (Cut x1) +Ninjask (Cut x2) +Makuhita (Crush x2) +Hariyama (Crush x3) +Nosepass (Crush x2) +Sableye (Cut x2) +Mawile (Crush x2) +Aron (Tackle x1) +Lairon (Tackle x2) +Aggron (Tackle x4) +Roselia (Cut x2) +Numel (Burn x1) +Camerupt (Burn x3) +Torkoal (Magma Flow x9) +Cacnea (Tackle x1) +Cacturne (Crush x2) +Altaria (Cut x2) +Claydol (Crush x3) +Shuppet (Psy Power x1) +Banette (Psy Power x2) +Duskull (Psy Power x1) +Dusclops (Psy Power x3) +Absol (Cut x4) +Snorunt (Crush x1) +Glalie (Crush x3) +Spheal (Tackle x1) +Sealeo (Crush x2) +Walrein (Crush x3) +Huntail (Crush x3) +Gorebyss (Crush x2) +Bagon (Tackle x1) +Shelgon (Tackle x2) +Turtwig (NONE x0) +Grotle (Tackle x2) +Torterra (Tackle x4) +Chimchar (NONE x0) +Monferno (Burn x2) +Infernape (Burn x3) +Piplup (NONE x0) +Prinplup (Cut x2) +Empoleon (River Flow x2) +Starly (NONE x0) +Staravia (Cut x2) +Staraptor (Fly x9) +Bidoof (Crush x1) +Bibarel (Soak x2) +Kricketot (NONE x0) +Kricketune (Cut x2) +Shinx (Electrify x1) +Luxio (Electrify x2) +Luxray (Electrify x3) +Budew (Tackle x1) +Roserade (Cut x3) +Cranidos (NONE x0) +Shieldon (NONE x0) +Bastiodon (Tackle x3) +Mothim (Cut x2) +Combee (Cut x1) +Vespiquen (Crush x3) +Pachirisu (NONE x0) +Buizel (Soak x1) +Floatzel (River Flow x1) +Cherubi (Tackle x1) +Cherrim (Tackle x2) +Shellos (Soak x1) +Gastrodon (Soak x2) +Ambipom (Crush x2) +Drifloon (Airlift x9) +Drifblim (Elevate x9) +Buneary (Crush x1) +Lopunny (Crush x2) +Mismagius (Psy Power x3) +Honchkrow (Cut x3) +Glameow (Cut x1) +Purugly (Tackle x2) +Chingling (Teleport x9) +Stunky (Crush x1) +Skuntank (Stink x9) +Bronzor (Crush x1) +Bronzong (Crush x3) +Bonsly (Tackle x1) +Mime Jr. (NONE x0) +Happiny (Crush x1) +Chatot (Cut x1) +Gible (NONE x0) +Gabite (Cut x3) +Munchlax (NONE x0) +Riolu (Crush x1) +Hippopotas (NONE x0) +Hippowdon (Sand Fill x9) +Skorupi (Crush x1) +Croagunk (NONE x0) +Toxicroak (Crush x2) +Carnivine (Cut x2) +Finneon (Crush x1) +Lumineon (Crush x2) +Mantyke (Tackle x1) +Snover (NONE x0) +Abomasnow (Crush x3) +Weavile (Cut x4) +Lickilicky (Crush x3) +Tangrowth (Tackle x2) +Togekiss (Cut x3) +Leafeon (Cut x3) +Glaceon (Crush x3) +Porygon-Z (Crush x3) +Probopass (Crush x4) +Dummy (NONE x0) +Sharpedo (Crush x4) +Wailmer (Tackle x2) +Duskull (NONE x0) +Riolu (NONE x0) +Lucario (NONE x0) +Wailord (NONE x0) +Toxicroak (Crush x2) +Spiritomb (NONE x0) +Lucario (NONE x0) +Heatran (NONE x0) +Cresselia (NONE x0) +Yanmega (NONE x0) +Gliscor (NONE x0) +Mamoswine (NONE x0) +Rhyperior (NONE x0) +Flygon (Cut x4) +Salamence (Crush x4) +Charizard (Burn x4) +Drapion (NONE x0) +Weavile (Cut x4) +Starly (NONE x0) +Pachirisu (NONE x0) +Munchlax (NONE x0) +Gardevoir (Psy Power x3) +Shiftry (Cut x3) +Honchkrow (Cut x3) +Crobat (Crush x3) +Bronzong (Crush x3) +Alakazam (Teleport x9) +Gabite (Cut x3) +Drifblim (Elevate x9) +Absol (Cut x4) +Abomasnow (Crush x3) +Bellossom (Cut x3) +Claydol (Crush x3) +Primeape (Crush x3) +Blaziken (Burn x3) +Gengar (Psy Power x3) +Fearow (Cut x3) +Swellow (Cut x2) +Kangaskhan (Crush x2) +Aggron (Tackle x4) +Tyranitar (Crush x4) +Tangrowth (Tackle x2) +Eevee (Tackle x1) +Flareon (Burn x3) +Vaporeon (Soak x3) +Jolteon (Electrify x3) +Espeon (Teleport x9) +Umbreon (Cut x3) +Leafeon (Cut x3) +Glaceon (Crush x3) +Ariados (Tackle x3) +Cacturne (Crush x2) +Banette (Psy Power x2) +Houndoom (Burn x2) +Garchomp (Crush x5) +Magmortar (Burn x5) +Electivire (Electrify x3) +Torterra (Tackle x4) +Empoleon (River Flow x2) +Infernape (Burn x3) +Riolu (NONE x0) +Bibarel (Soak x2) +Bidoof (Crush x1) +Pichu (Recharge x1) +Bibarel (Soak x2) +Bibarel (Soak x2) +Bibarel (Soak x2) +Bibarel (Soak x2) +Bibarel (Soak x2) +Bibarel (Soak x2) +Pikachu (Recharge x3) +Bidoof (Crush x1) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +Charizard (Burn x4) +Aerodactyl (Crush x4) +Dragonair (Crush x3) +Kingdra (Crush x4) +Celebi (NONE x0) +Sharpedo (Crush x4) +Flygon (Cut x4) +Salamence (Crush x4) +Rampardos (Tackle x5) +Spiritomb (NONE x0) +Garchomp (Crush x5) +Lucario (NONE x0) +Drapion (NONE x0) +Magnezone (Electrify x3) +Rhyperior (NONE x0) +Electivire (Electrify x3) +Magmortar (Burn x5) +Yanmega (NONE x0) +Gliscor (NONE x0) +Mamoswine (NONE x0) +Gallade (Cut x5) +Dusknoir (Psy Power x3) +Froslass (Crush x4) +Heatran (NONE x0) +Regigigas (NONE x0) +Cresselia (NONE x0) +Darkrai (Dark Power x9) +Darkrai (Dark Power x9) +Lucario (NONE x0) +Heatran (NONE x0) +Cresselia (NONE x0) +Regirock (NONE x0) +Regice (NONE x0) +Registeel (NONE x0) +Dialga (NONE x0) +Palkia (NONE x0) +Shaymin (NONE x0) +Gallade (Cut x5) +Rhyperior (NONE x0) +Magmortar (Burn x5) +Dialga (NONE x0) +Dialga (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) +NONE (NONE x0) \ No newline at end of file diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 6ffd51f..6bb7f93 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,6 +3,7 @@ + file:/C:/Users/Aurum/Documents/GitHub/AlmiaE/src/com/aurum/almia/game/Compression.java file:/C:/Users/Aurum/Documents/GitHub/AlmiaE/src/com/aurum/almia/Main.java diff --git a/src/com/aurum/almia/BitConverter.java b/src/com/aurum/almia/BitConverter.java deleted file mode 100644 index edbe38c..0000000 --- a/src/com/aurum/almia/BitConverter.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2018 Aurum - * - * AlmiaE is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AlmiaE is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.aurum.almia; - -public class BitConverter { - public static int stringToInt(String value) { - return value != null ? Integer.decode(value) : 0; - } - - public static byte[] reverse(byte[] data) { - byte[] ret = new byte[data.length]; - for (int i = 0 ; i < data.length ; i++) - ret[i] = data[data.length - 1 - i]; - return ret; - } - - public static byte toByte(byte[] data, int offset) { - return data[offset]; - } - - public static short toUByte(byte[] data, int offset) { - return (short) (data[offset] & 0xFF); - } - - public static short toShort(byte[] data, ByteOrder endian, int offset) { - byte[] bytes = new byte[Short.BYTES]; - for (int i = 0 ; i < Short.BYTES ; i++) - bytes[i] = data[i+offset]; - bytes = endian == ByteOrder.LITTLE_ENDIAN ? reverse(bytes) : bytes; - return (short) ( - ((bytes[0] & 0xFF) << 8) - | (bytes[1] & 0xFF) - ); - } - - public static int toUShort(byte[] data, ByteOrder endian, int offset) { - return (int) (toShort(data, endian, offset) & 0xFFFF); - } - - public static int toInt(byte[] data, ByteOrder endian, int offset) { - byte[] bytes = new byte[Integer.BYTES]; - for (int i = 0 ; i < Integer.BYTES ; i++) - bytes[i] = data[i+offset]; - bytes = endian == ByteOrder.LITTLE_ENDIAN ? reverse(bytes) : bytes; - return (int) ( - ((bytes[0] & 0xFF) << 24) - | ((bytes[1] & 0xFF) << 16) - | ((bytes[2] & 0xFF) << 8) - | (bytes[3] & 0xFF) - ); - } - - public static long toUInt(byte[] data, ByteOrder endian, int offset) { - return (long) (toInt(data, endian, offset) & 0xFFFFFFFF); - } - - public static long toLong(byte[] data, ByteOrder endian, int offset) { - byte[] bytes = new byte[Long.BYTES]; - for (int i = 0 ; i < Long.BYTES ; i++) - bytes[i] = data[i+offset]; - bytes = endian == ByteOrder.LITTLE_ENDIAN ? reverse(bytes) : bytes; - return (long) ( - ((long) (bytes[0] & 0xFF) << 56) - | ((long) (bytes[1] & 0xFF) << 48) - | ((long) (bytes[2] & 0xFF) << 40) - | ((long) (bytes[3] & 0xFF) << 32) - | ((long) (bytes[4] & 0xFF) << 24) - | ((long) (bytes[5] & 0xFF) << 16) - | ((long) (bytes[6] & 0xFF) << 8) - | (long) (bytes[7] & 0xFF) - ); - } - - public static float toFloat(byte[] data, ByteOrder endian, int offset) { - return Float.intBitsToFloat(toInt(data, endian, offset)); - } - - public static double toDouble(byte[] data, ByteOrder endian, int offset) { - return Double.longBitsToDouble(toLong(data, endian, offset)); - } - - public static char toCharacter(byte[] data, ByteOrder endian, int offset) { - return (char) toShort(data, endian, offset); - } - - public static boolean toBoolean(byte[] data, int offset) { - return data[offset] != 0; - } - - public static byte[] getBytes(short val, ByteOrder endian) { - byte[] bytes = new byte[Short.BYTES]; - bytes[0] = (byte) ((val >> 8) & 0xFF); - bytes[1] = (byte) (val & 0xFF); - return endian == ByteOrder.LITTLE_ENDIAN ? reverse(bytes) : bytes; - } - - public static byte[] getBytes(int val, ByteOrder endian) { - byte[] bytes = new byte[Integer.BYTES]; - bytes[0] = (byte) ((val >> 24) & 0xFF); - bytes[1] = (byte) ((val >> 16) & 0xFF); - bytes[2] = (byte) ((val >> 8) & 0xFF); - bytes[3] = (byte) (val & 0xFF); - return endian == ByteOrder.LITTLE_ENDIAN ? reverse(bytes) : bytes; - } - - public static byte[] getBytes(long val, ByteOrder endian) { - byte[] bytes = new byte[Long.BYTES]; - bytes[0] = (byte) ((val >> 56) & 0xFF); - bytes[1] = (byte) ((val >> 48) & 0xFF); - bytes[2] = (byte) ((val >> 40) & 0xFF); - bytes[3] = (byte) ((val >> 32) & 0xFF); - bytes[4] = (byte) ((val >> 24) & 0xFF); - bytes[5] = (byte) ((val >> 16) & 0xFF); - bytes[6] = (byte) ((val >> 8) & 0xFF); - bytes[7] = (byte) (val & 0xFF); - return endian == ByteOrder.LITTLE_ENDIAN ? reverse(bytes) : bytes; - } - - public static byte[] getBytes(float val, ByteOrder endian) { - return getBytes(Float.floatToIntBits(val), endian); - } - - public static byte[] getBytes(double val, ByteOrder endian) { - return getBytes(Double.doubleToLongBits(val), endian); - } - - public static byte[] getBytes(char val, ByteOrder endian) { - return getBytes((short) val, endian); - } - - public static byte[] getBytes(boolean val) { - return new byte[] { (byte) (val ? 1 : 0) }; - } -} \ No newline at end of file diff --git a/src/com/aurum/almia/ByteOrder.java b/src/com/aurum/almia/ByteOrder.java deleted file mode 100644 index 3e06879..0000000 --- a/src/com/aurum/almia/ByteOrder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2018 Aurum - * - * AlmiaE is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AlmiaE is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.aurum.almia; - -public enum ByteOrder { - BIG_ENDIAN (new byte[] { (byte) 0xFE, (byte) 0xFF }), // Left to right - LITTLE_ENDIAN (new byte[] { (byte) 0xFF, (byte) 0xFE }); // Right to left - - private final byte[] bom; - private ByteOrder(byte[] identifier) { - this.bom = identifier; - } - - /** - * Returns the BOM. - * @return the BOM. - */ - public byte[] getBOM() { - return bom; - } - - /** - * Returns the byte order for the given BOM. - * @param bom the identifier - * @return the byte order for the given BOM. - */ - public static ByteOrder getByteOrder(byte[] bom) { - return (bom == BIG_ENDIAN.bom) ? BIG_ENDIAN : - (bom == LITTLE_ENDIAN.bom) ? LITTLE_ENDIAN : null; - } -} \ No newline at end of file diff --git a/src/com/aurum/almia/Lists.java b/src/com/aurum/almia/Lists.java index ae80810..6df3874 100644 --- a/src/com/aurum/almia/Lists.java +++ b/src/com/aurum/almia/Lists.java @@ -19,29 +19,40 @@ package com.aurum.almia; import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; -public class Lists { - public static List pokemon_name, fieldwaza_name, assist_mes, yakumono_name, obstacles; +public final class Lists { + private Lists() {} + + public static List pokemon_name; + public static List fieldwaza_name; + public static List assist_mes; + public static List yakumono_name; + public static List obstacles; + public static List npcs; public static void init() { - pokemon_name = populate("/res/lists/pokemon_name.txt"); - fieldwaza_name = populate("/res/lists/fieldwaza_name.txt"); - assist_mes = populate("/res/lists/assist_mes.txt"); - yakumono_name = populate("/res/lists/yakumono_name.txt"); - obstacles = populate("/res/lists/obstacles.txt"); + pokemon_name = populate("lists/pokemon_name.txt"); + fieldwaza_name = populate("lists/fieldwaza_name.txt"); + assist_mes = populate("lists/assist_mes.txt"); + yakumono_name = populate("lists/yakumono_name.txt"); + + obstacles = populate("lists/obstacles.txt"); + npcs = populate("lists/npcs.txt"); } private static List populate(String filepath) { - BufferedReader reader = new BufferedReader(new InputStreamReader(Lists.class.getResourceAsStream(filepath))); + BufferedReader reader = new BufferedReader(Resources.loadReader(filepath)); List list = new ArrayList(); String line; + try { while ((line = reader.readLine()) != null) list.add(line.trim()); + + reader.close(); } catch (IOException ex) { System.out.println(ex); diff --git a/src/com/aurum/almia/Main.form b/src/com/aurum/almia/Main.form index 4d48b05..dc1b236 100644 --- a/src/com/aurum/almia/Main.form +++ b/src/com/aurum/almia/Main.form @@ -74,10 +74,10 @@ - + - + diff --git a/src/com/aurum/almia/Main.java b/src/com/aurum/almia/Main.java index 1f3ea8c..8f067c3 100644 --- a/src/com/aurum/almia/Main.java +++ b/src/com/aurum/almia/Main.java @@ -19,42 +19,51 @@ package com.aurum.almia; import com.aurum.almia.game.Game; import com.aurum.almia.game.map.Map; -import com.aurum.almia.swing.MapEditor; -import com.aurum.almia.swing.PokeIDEditor; +import com.aurum.almia.editors.MapEditor; +import com.aurum.almia.editors.PokeIDEditor; import java.awt.Image; -import java.awt.Toolkit; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import java.util.Arrays; +import java.util.Iterator; import java.util.prefs.Preferences; import javax.swing.JFileChooser; +import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -public class Main extends javax.swing.JFrame { - public static String name = "AlmiaE v0.1.1"; - public static Image icon = Toolkit.getDefaultToolkit().createImage(Main.class.getResource("/res/icon.png")); - public static boolean debug = false; +public class Main extends JFrame { + public static final String NAME = "AlmiaE v0.5"; + public static final Image ICON = Resources.loadImage("icon.png"); + private static boolean debug = false; - public static void main(String[] args) throws IOException { - if (args.length > 0) { - debug = args[0].equals("-d"); - } + public static void main(String[] args) { + Iterator argsi = Arrays.stream(args).iterator(); - try { - javax.swing.UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } - catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { - System.err.print(ex); + while(argsi.hasNext()) { + String arg = argsi.next(); + + switch(arg) { + case "-d": debug = true; break; + } } Lists.init(); + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } + catch (Exception ex) { + System.err.print(ex); + } + new Main().setVisible(true); } + public static boolean isDebug() { + return debug; + } + public Main() { initComponents(); } @@ -75,8 +84,8 @@ public class Main extends javax.swing.JFrame { mnuAbout = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle(Main.name); - setIconImage(Main.icon); + setTitle(Main.NAME); + setIconImage(Main.ICON); setResizable(false); btnMapEditor.setText("Edit map"); @@ -210,7 +219,7 @@ public class Main extends javax.swing.JFrame { }//GEN-LAST:event_mnuCloseActionPerformed private void mnuAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAboutActionPerformed - JOptionPane.showMessageDialog(this, "Copyright 2018 SunakazeKun\nhttps://github.com/SunakazeKun/AlmiaE", Main.name, JOptionPane.PLAIN_MESSAGE, null); + JOptionPane.showMessageDialog(this, "Copyright 2018 SunakazeKun\nhttps://github.com/SunakazeKun/AlmiaE", Main.NAME, JOptionPane.PLAIN_MESSAGE, null); }//GEN-LAST:event_mnuAboutActionPerformed private void btnPokemonEditorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPokemonEditorActionPerformed @@ -218,14 +227,13 @@ public class Main extends javax.swing.JFrame { }//GEN-LAST:event_btnPokemonEditorActionPerformed private void btnMapEditorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMapEditorActionPerformed - Object[] maps = getMaps().toArray(); + Object[] maps = Game.current.getMapsList().toArray(); if (maps.length == 0) return; - String mapname = (String) JOptionPane.showInputDialog(this, "Select a map file.", Main.name, JOptionPane.PLAIN_MESSAGE, null, maps, maps[0]); + String mapname = (String) JOptionPane.showInputDialog(this, "Select a map file.", Main.NAME, JOptionPane.PLAIN_MESSAGE, null, maps, maps[0]); if (mapname == null) return; if (mapname.isEmpty()) return; - try { Map map = new Map(Game.current, mapname); new MapEditor(map).setVisible(true); @@ -235,25 +243,6 @@ public class Main extends javax.swing.JFrame { } }//GEN-LAST:event_btnMapEditorActionPerformed - public List getMaps() { - File[] files = new File(Game.current.filesystem.getAbsolutePath() + "/field/map").listFiles(); - List maps = new ArrayList(); - - for (File file : files) { - if (!file.isFile()) { - continue; - } - - String filename = file.getName(); - - if (filename.endsWith(".map.dat.lz")) { - maps.add(filename.replace(".map.dat.lz", "")); - } - } - - return maps; - } - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnMapEditor; private javax.swing.JButton btnPokemonEditor; diff --git a/src/com/aurum/almia/Resources.java b/src/com/aurum/almia/Resources.java new file mode 100644 index 0000000..536f4a6 --- /dev/null +++ b/src/com/aurum/almia/Resources.java @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import javax.imageio.ImageIO; +import javax.swing.Icon; +import javax.swing.ImageIcon; + +public class Resources { + public static InputStream loadStream(String resdir) { + return Resources.class.getResourceAsStream("/res/" + resdir); + } + + public static Reader loadReader(String resdir) { + return new InputStreamReader(loadStream(resdir)); + } + + public static BufferedImage loadImage(String resdir) { + BufferedImage image = null; + InputStream in = loadStream(resdir); + + if (in == null) + return null; + + try { + image = ImageIO.read(in); + in.close(); + } + catch(IOException ex) { + System.out.println(ex); + } + + return image; + } + + public static Icon loadIcon(String resdir) { + return new ImageIcon(loadImage(resdir)); + } + + // Helpers for map object sprites + public static BufferedImage getTargetImg(int target) { + switch(target) { + case 56: target = 55; break; + case 61: + case 62: + case 63: target = 60; break; + case 65: + case 66: + case 67: target = 64; break; + case 69: target = 68; break; + case 71: target = 70; break; + case 73: target = 72; break; + case 79: + case 80: + case 81: + case 82: + case 83: target = 78; break; + } + + return loadImage(String.format("targets/%d.png", target)); + } + + public static BufferedImage getNpcImg(int npc) { + return loadImage(String.format("npcs/%d.png", npc)); + } + + public static BufferedImage getMonImg(int mon, int form) { + return loadImage(String.format("mons/%d_%d.png", mon, form)); + } +} diff --git a/src/com/aurum/almia/Utils.java b/src/com/aurum/almia/Utils.java deleted file mode 100644 index 7cf47a9..0000000 --- a/src/com/aurum/almia/Utils.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2018 Aurum - * - * AlmiaE is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AlmiaE is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.aurum.almia; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; - -public class Utils { - public static ByteBuffer loadFileIntoBuffer(String filepath) throws IOException { - FileInputStream in = new FileInputStream(new File(filepath)); - ByteBuffer buffer = new ByteBuffer(in.available()); - in.read(buffer.getBuffer()); - - return buffer; - } - - public static void saveBytesToFile(byte[] bytes, File file) throws IOException { - if (!(file.exists() && file.isFile())) { - file.getParentFile().mkdirs(); - file.createNewFile(); - } - - try (FileOutputStream out = new FileOutputStream(file)) { - out.write(bytes); - out.flush(); - } - } -} \ No newline at end of file diff --git a/src/com/aurum/almia/editors/CollisionWidget.form b/src/com/aurum/almia/editors/CollisionWidget.form new file mode 100644 index 0000000..7c51966 --- /dev/null +++ b/src/com/aurum/almia/editors/CollisionWidget.form @@ -0,0 +1,48 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/CollisionWidget.java b/src/com/aurum/almia/editors/CollisionWidget.java new file mode 100644 index 0000000..be155e9 --- /dev/null +++ b/src/com/aurum/almia/editors/CollisionWidget.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.game.map.CollisionData; + +public class CollisionWidget extends javax.swing.JPanel { + private CollisionData data; + + public CollisionWidget(CollisionData data) { + this.data = data; + + initComponents(); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + lblUnk0 = new javax.swing.JLabel(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); + + setLayout(new java.awt.GridBagLayout()); + + lblUnk0.setFont(new java.awt.Font("Dialog", 3, 12)); // NOI18N + lblUnk0.setText("--WIP--"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk0, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + add(filler1, gridBagConstraints); + }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.Box.Filler filler1; + private javax.swing.JLabel lblUnk0; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/editors/LocationWidget.form b/src/com/aurum/almia/editors/LocationWidget.form new file mode 100644 index 0000000..2b9645c --- /dev/null +++ b/src/com/aurum/almia/editors/LocationWidget.form @@ -0,0 +1,160 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/LocationWidget.java b/src/com/aurum/almia/editors/LocationWidget.java new file mode 100644 index 0000000..93a7d8c --- /dev/null +++ b/src/com/aurum/almia/editors/LocationWidget.java @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.game.map.LocationData; + +public class LocationWidget extends javax.swing.JPanel { + private LocationData.Entry entry; + + public LocationWidget(LocationData.Entry entry) { + this.entry = entry; + + initComponents(); + + spnPosX.setValue(entry.posX); + spnPosY.setValue(entry.posY); + spnWidth.setValue(entry.width); + spnHeight.setValue(entry.height); + spnUnk8.setValue(entry.unk8); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + lblPosX = new javax.swing.JLabel(); + lblPosY = new javax.swing.JLabel(); + lblWidth = new javax.swing.JLabel(); + lblHeight = new javax.swing.JLabel(); + lblUnk8 = new javax.swing.JLabel(); + spnPosX = new javax.swing.JSpinner(); + spnPosY = new javax.swing.JSpinner(); + spnWidth = new javax.swing.JSpinner(); + spnHeight = new javax.swing.JSpinner(); + spnUnk8 = new javax.swing.JSpinner(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); + + setLayout(new java.awt.GridBagLayout()); + + lblPosX.setText("X Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosX, gridBagConstraints); + + lblPosY.setText("Y Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosY, gridBagConstraints); + + lblWidth.setText("Width"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblWidth, gridBagConstraints); + + lblHeight.setText("Height"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblHeight, gridBagConstraints); + + lblUnk8.setText("short (0x8)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk8, gridBagConstraints); + + spnPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosX.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosXStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosX, gridBagConstraints); + + spnPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosY.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosYStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosY, gridBagConstraints); + + spnWidth.setModel(new javax.swing.SpinnerNumberModel(0, 0, 65535, 1)); + spnWidth.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnWidthStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnWidth, gridBagConstraints); + + spnHeight.setModel(new javax.swing.SpinnerNumberModel(0, 0, 65535, 1)); + spnHeight.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnHeightStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnHeight, gridBagConstraints); + + spnUnk8.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnUnk8.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk8StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk8, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + add(filler1, gridBagConstraints); + }// //GEN-END:initComponents + + private void spnPosXStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosXStateChanged + entry.posX = (short)spnPosX.getValue(); + }//GEN-LAST:event_spnPosXStateChanged + + private void spnPosYStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosYStateChanged + entry.posY = (short)spnPosY.getValue(); + }//GEN-LAST:event_spnPosYStateChanged + + private void spnWidthStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnWidthStateChanged + entry.width = (int)spnWidth.getValue(); + }//GEN-LAST:event_spnWidthStateChanged + + private void spnHeightStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnHeightStateChanged + entry.height = (int)spnHeight.getValue(); + }//GEN-LAST:event_spnHeightStateChanged + + private void spnUnk8StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk8StateChanged + entry.unk8 = (short)spnUnk8.getValue(); + }//GEN-LAST:event_spnUnk8StateChanged + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.Box.Filler filler1; + private javax.swing.JLabel lblHeight; + private javax.swing.JLabel lblPosX; + private javax.swing.JLabel lblPosY; + private javax.swing.JLabel lblUnk8; + private javax.swing.JLabel lblWidth; + private javax.swing.JSpinner spnHeight; + private javax.swing.JSpinner spnPosX; + private javax.swing.JSpinner spnPosY; + private javax.swing.JSpinner spnUnk8; + private javax.swing.JSpinner spnWidth; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/editors/MapEditor.form b/src/com/aurum/almia/editors/MapEditor.form new file mode 100644 index 0000000..0bc27c8 --- /dev/null +++ b/src/com/aurum/almia/editors/MapEditor.form @@ -0,0 +1,150 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/MapEditor.java b/src/com/aurum/almia/editors/MapEditor.java new file mode 100644 index 0000000..00fe8e4 --- /dev/null +++ b/src/com/aurum/almia/editors/MapEditor.java @@ -0,0 +1,534 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.Main; +import com.aurum.almia.Resources; +import com.aurum.almia.game.map.*; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.io.IOException; +import javax.swing.Icon; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.SwingUtilities; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreePath; +import javax.swing.tree.TreeSelectionModel; + +public class MapEditor extends javax.swing.JFrame { + private class MapRenderer extends JPanel implements Runnable { + static final int FPS = 30; + + Thread thread; + boolean isRunning; + + public MapRenderer() { + update(); + } + + public void update() { + setPreferredSize(new Dimension(map.mapInfo.width, map.mapInfo.height)); + repaint(); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + + try { + map.render(g); + } + catch (IOException ex) { + System.out.println(ex); + } + } + + @Override + public void run() { + double timePerTick = 1000000000 / FPS; + double delta = 0; + long now = 0; + long diff = 0; + long last = System.nanoTime(); + long timer = 0; + + while(isRunning) { + now = System.nanoTime(); + diff = now - last; + timer += diff; + delta += diff / timePerTick; + + if (delta >= 1) { + update(); + delta--; + } + + if (timer >= 1000000000) { + timer = 0; + } + + last = now; + } + } + + public synchronized void start() { + if (isRunning) + return; + + isRunning = true; + + thread = new Thread(this); + thread.start(); + } + + public synchronized void stop() { + if (!isRunning) + return; + + isRunning = false; + + try { + thread.join(); + } + catch(InterruptedException ex) { + System.out.println(ex); + } + } + } + + private class ObjTreeCellRenderer extends DefaultTreeCellRenderer { + final Icon ICON_MISC = Resources.loadIcon("mapEditor/node_misc.png"); + final Icon ICON_LOCATION = Resources.loadIcon("mapEditor/node_location.png"); + final Icon ICON_TARGET = Resources.loadIcon("mapEditor/node_target.png"); + final Icon ICON_POKEMON = Resources.loadIcon("mapEditor/node_mon.png"); + final Icon ICON_NPC = Resources.loadIcon("mapEditor/node_npc.png"); + + @Override + public Component getTreeCellRendererComponent(JTree tree, + Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); + + Object val = ((DefaultMutableTreeNode)value).getUserObject(); + + if (val != null) { + if (val instanceof MapInfo) setIcon(ICON_MISC); + else if (val instanceof CollisionData) setIcon(ICON_MISC); + else if (val instanceof TextureInfo) setIcon(ICON_MISC); + else if (val instanceof TextureInfo.Entry) setIcon(ICON_MISC); + else if (val instanceof LocationData) setIcon(ICON_LOCATION); + else if (val instanceof LocationData.Entry) setIcon(ICON_LOCATION); + else if (val instanceof TargetData) setIcon(ICON_TARGET); + else if (val instanceof TargetData.Entry) setIcon(ICON_TARGET); + else if (val instanceof MonData) setIcon(ICON_POKEMON); + else if (val instanceof MonData.Entry) setIcon(ICON_POKEMON); + else if (val instanceof NpcData) setIcon(ICON_NPC); + else if (val instanceof NpcData.Entry) setIcon(ICON_NPC); + } + + return this; + } + } + + private Map map; + private Object selectedData; + + private JPanel editorWidget; + private MapRenderer renderer; + private DefaultTreeModel treeModel; + private DefaultMutableTreeNode treeRoot; + + public MapEditor(Map map) { + this.map = map; + this.selectedData = null; + this.editorWidget = null; + this.renderer = new MapRenderer(); + this.treeModel = null; + this.treeRoot = null; + + initComponents(); + initData(); + } + + public void initData() { + setTitle(String.format("Map Editor: Editing %s", map.name)); + treeModel = (DefaultTreeModel)tree.getModel(); + tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); + scrRender.getViewport().add(renderer); + renderer.start(); + + treeRoot = new DefaultMutableTreeNode(map.name, true); + + // Generic map info blocks + DefaultMutableTreeNode mapInfoNode = new DefaultMutableTreeNode(map.mapInfo, false); + DefaultMutableTreeNode texInfoNode = new DefaultMutableTreeNode(map.texInfo, true); + + for (TextureInfo.Entry entry : map.texInfo.entries) { + texInfoNode.add(new DefaultMutableTreeNode(entry, false)); + } + + treeRoot.add(mapInfoNode); + treeRoot.add(texInfoNode); + + // Layer object blocks + for (Layer layer : map.layers) { + DefaultMutableTreeNode layerNode = new DefaultMutableTreeNode(layer, true); + DefaultMutableTreeNode collisionNode = new DefaultMutableTreeNode(layer.collisionData, false); + DefaultMutableTreeNode collOverlayNode = new DefaultMutableTreeNode(layer.collOverlayData, false); + DefaultMutableTreeNode locationsNode = new DefaultMutableTreeNode(layer.locationData, true); + DefaultMutableTreeNode targetsNode = new DefaultMutableTreeNode(layer.targetData, true); + DefaultMutableTreeNode monsNode = new DefaultMutableTreeNode(layer.monData, true); + DefaultMutableTreeNode npcsNode = new DefaultMutableTreeNode(layer.npcData, true); + + for (LocationData.Entry entry : layer.locationData.entries) + locationsNode.add(new DefaultMutableTreeNode(entry, false)); + + for (TargetData.Entry entry : layer.targetData.entries) + targetsNode.add(new DefaultMutableTreeNode(entry, false)); + + for (MonData.Entry entry : layer.monData.entries) + monsNode.add(new DefaultMutableTreeNode(entry, false)); + + for (NpcData.Entry entry : layer.npcData.entries) + npcsNode.add(new DefaultMutableTreeNode(entry, false)); + + layerNode.add(collisionNode); + layerNode.add(collOverlayNode); + layerNode.add(locationsNode); + layerNode.add(targetsNode); + layerNode.add(monsNode); + layerNode.add(npcsNode); + + treeRoot.add(layerNode); + } + + treeModel.setRoot(treeRoot); + } + + public DefaultMutableTreeNode getSelectedNode() { + return (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); + } + + public Object getSelectedNodeObject() { + DefaultMutableTreeNode node = getSelectedNode(); + return node == null ? null : node.getUserObject(); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + treeMenu = new javax.swing.JPopupMenu(); + mnuAdd = new javax.swing.JMenuItem(); + mnuDelete = new javax.swing.JMenuItem(); + mnuClone = new javax.swing.JMenuItem(); + scrTree = new javax.swing.JScrollPane(); + tree = new javax.swing.JTree(); + scrRender = new javax.swing.JScrollPane(); + scrSettings = new javax.swing.JScrollPane(); + tlb1 = new javax.swing.JToolBar(); + btnSaveAll = new javax.swing.JButton(); + + mnuAdd.setText("Add"); + mnuAdd.setToolTipText(""); + mnuAdd.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mnuAddActionPerformed(evt); + } + }); + treeMenu.add(mnuAdd); + + mnuDelete.setText("Delete"); + mnuDelete.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mnuDeleteActionPerformed(evt); + } + }); + treeMenu.add(mnuDelete); + + mnuClone.setText("Copy"); + mnuClone.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + mnuCloneActionPerformed(evt); + } + }); + treeMenu.add(mnuClone); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Map Editor: Editing "); + setIconImage(Main.ICON); + setMinimumSize(new java.awt.Dimension(800, 600)); + setPreferredSize(new java.awt.Dimension(900, 600)); + addWindowListener(new java.awt.event.WindowAdapter() { + public void windowClosing(java.awt.event.WindowEvent evt) { + formWindowClosing(evt); + } + }); + getContentPane().setLayout(new java.awt.GridBagLayout()); + + javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root"); + tree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1)); + tree.setCellRenderer(new ObjTreeCellRenderer()); + tree.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + treeMouseClicked(evt); + } + }); + tree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { + public void valueChanged(javax.swing.event.TreeSelectionEvent evt) { + treeValueChanged(evt); + } + }); + scrTree.setViewportView(tree); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 0.2; + gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 0); + getContentPane().add(scrTree, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 0.6; + gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0); + getContentPane().add(scrRender, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 0.3; + gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 2); + getContentPane().add(scrSettings, gridBagConstraints); + + tlb1.setFloatable(false); + tlb1.setRollover(true); + + btnSaveAll.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/tl_save.png"))); // NOI18N + btnSaveAll.setText("Save all data"); + btnSaveAll.setFocusable(false); + btnSaveAll.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); + btnSaveAll.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); + btnSaveAll.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSaveAllActionPerformed(evt); + } + }); + tlb1.add(btnSaveAll); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.gridwidth = 3; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 1.0; + getContentPane().add(tlb1, gridBagConstraints); + + pack(); + setLocationRelativeTo(null); + }// //GEN-END:initComponents + + private void btnSaveAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveAllActionPerformed + try { + map.save(); + } + catch (IOException ex) { + System.out.println(ex); + } + }//GEN-LAST:event_btnSaveAllActionPerformed + + private void treeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_treeValueChanged + if (editorWidget != null) { + scrSettings.getViewport().remove(editorWidget); + editorWidget = null; + selectedData = null; + } + + Object userObject = getSelectedNodeObject(); + + if (userObject == null) + return; + + if (userObject instanceof MapInfo) + editorWidget = new MapInfoWidget((MapInfo)userObject); + else if (userObject instanceof TextureInfo.Entry) + editorWidget = new TexInfoWidget((TextureInfo.Entry)userObject); + else if (userObject instanceof MonData.Entry) + editorWidget = new MonWidget((MonData.Entry)userObject); + else if (userObject instanceof NpcData.Entry) + editorWidget = new NpcWidget((NpcData.Entry)userObject); + else if (userObject instanceof LocationData.Entry) + editorWidget = new LocationWidget((LocationData.Entry)userObject); + else if (userObject instanceof TargetData.Entry) + editorWidget = new TargetWidget((TargetData.Entry)userObject); + else if (userObject instanceof CollisionData) + editorWidget = new CollisionWidget((CollisionData)userObject); + + selectedData = userObject; + + if (editorWidget != null) + scrSettings.getViewport().add(editorWidget); + + scrSettings.repaint(); + }//GEN-LAST:event_treeValueChanged + + private void treeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_treeMouseClicked + if (!SwingUtilities.isRightMouseButton(evt)) + return; + + // Find the node + int x = evt.getX(); + int y = evt.getY(); + TreePath path = tree.getPathForLocation(x, y); + if (path == null) + return; + + tree.setSelectionPath(path); + + Object userObject = getSelectedNodeObject(); + + if (userObject == null) + return; + + // Display operations + if (userObject instanceof AbstractData) { + mnuAdd.setEnabled(true); + mnuDelete.setEnabled(false); + mnuClone.setEnabled(false); + treeMenu.show(evt.getComponent(), x, y); + } + else if (userObject instanceof AbstractEntry) { + mnuAdd.setEnabled(false); + mnuDelete.setEnabled(true); + mnuClone.setEnabled(true); + treeMenu.show(evt.getComponent(), x, y); + } + }//GEN-LAST:event_treeMouseClicked + + private void mnuAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuAddActionPerformed + // Get the node and object + DefaultMutableTreeNode selected = getSelectedNode(); + if (selected == null) + return; + AbstractData data = (AbstractData)selected.getUserObject(); + if (data == null) + return; + + // Create the entry + AbstractEntry entry = null; + + if (data instanceof TextureInfo) entry = ((TextureInfo) data).new Entry(); + else if (data instanceof MonData) entry = ((MonData) data).new Entry(); + else if (data instanceof NpcData) entry = ((NpcData) data).new Entry(); + else if (data instanceof LocationData) entry = ((LocationData) data).new Entry(); + else if (data instanceof TargetData) entry = ((TargetData) data).new Entry(); + + // Create the node, and add this and the data + if (entry == null) + return; + + data.entries.add(entry); + + DefaultMutableTreeNode node = new DefaultMutableTreeNode(entry, false); + treeModel.insertNodeInto(node, selected, selected.getChildCount()); + + // Select new node + TreePath path = new TreePath(treeModel.getPathToRoot(node)); + tree.setSelectionPath(path); + tree.scrollPathToVisible(path); + }//GEN-LAST:event_mnuAddActionPerformed + + private void mnuDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuDeleteActionPerformed + // The code here is made for entry nodes only. Any folders or the root + // will not work with this. Of course, they have been taken care of + // earlier already (treeMouseClicked event), so nothing should go wrong + // in theory. + + // Get the node, object and parent + DefaultMutableTreeNode selected = getSelectedNode(); + if (selected == null) + return; + AbstractEntry entry = (AbstractEntry)selected.getUserObject(); + AbstractData data = (AbstractData)((DefaultMutableTreeNode)selected.getParent()).getUserObject(); + + // Delete the node and data + treeModel.removeNodeFromParent(selected); + + if (data == null || entry == null) + return; + + data.entries.remove(entry); + }//GEN-LAST:event_mnuDeleteActionPerformed + + private void mnuCloneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuCloneActionPerformed + // Similar to the node deletion code, as written above. They are used + // in the same context, which is not very suprising... + + // Get the node, object and parent + DefaultMutableTreeNode selected = getSelectedNode(); + if (selected == null) + return; + DefaultMutableTreeNode parent = (DefaultMutableTreeNode)selected.getParent(); + AbstractEntry entry = (AbstractEntry)selected.getUserObject(); + AbstractData data = (AbstractData)parent.getUserObject(); + if (data == null || entry == null) + return; + + // Create the entry and node, and add them as well + AbstractEntry clone = entry.clone(); + if (clone == null) + return; + + data.entries.add(clone); + + DefaultMutableTreeNode node = new DefaultMutableTreeNode(clone, false); + treeModel.insertNodeInto(node, parent, parent.getChildCount()); + + // Select new node + TreePath path = new TreePath(treeModel.getPathToRoot(node)); + tree.setSelectionPath(path); + tree.scrollPathToVisible(path); + }//GEN-LAST:event_mnuCloneActionPerformed + + private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing + renderer.stop(); + }//GEN-LAST:event_formWindowClosing + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton btnSaveAll; + private javax.swing.JMenuItem mnuAdd; + private javax.swing.JMenuItem mnuClone; + private javax.swing.JMenuItem mnuDelete; + private javax.swing.JScrollPane scrRender; + private javax.swing.JScrollPane scrSettings; + private javax.swing.JScrollPane scrTree; + private javax.swing.JToolBar tlb1; + private javax.swing.JTree tree; + private javax.swing.JPopupMenu treeMenu; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/editors/MapInfoWidget.form b/src/com/aurum/almia/editors/MapInfoWidget.form new file mode 100644 index 0000000..de60949 --- /dev/null +++ b/src/com/aurum/almia/editors/MapInfoWidget.form @@ -0,0 +1,135 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/MapInfoWidget.java b/src/com/aurum/almia/editors/MapInfoWidget.java new file mode 100644 index 0000000..60389c9 --- /dev/null +++ b/src/com/aurum/almia/editors/MapInfoWidget.java @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.game.map.MapInfo; + +public class MapInfoWidget extends javax.swing.JPanel { + private MapInfo entry; + + public MapInfoWidget(MapInfo entry) { + this.entry = entry; + + initComponents(); + + spnWidth.setValue(entry.width); + spnHeight.setValue(entry.height); + spnUnk8.setValue(entry.unk8); + spnUnkC.setValue(entry.unkC); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + lblWidth = new javax.swing.JLabel(); + lblHeight = new javax.swing.JLabel(); + lblUnk8 = new javax.swing.JLabel(); + lblUnkC = new javax.swing.JLabel(); + spnWidth = new javax.swing.JSpinner(); + spnHeight = new javax.swing.JSpinner(); + spnUnk8 = new javax.swing.JSpinner(); + spnUnkC = new javax.swing.JSpinner(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); + + setLayout(new java.awt.GridBagLayout()); + + lblWidth.setText("Width"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblWidth, gridBagConstraints); + + lblHeight.setText("Height"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblHeight, gridBagConstraints); + + lblUnk8.setText("unk8"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk8, gridBagConstraints); + + lblUnkC.setText("unkC"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnkC, gridBagConstraints); + + spnWidth.setModel(new javax.swing.SpinnerNumberModel()); + spnWidth.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnWidthStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnWidth, gridBagConstraints); + + spnHeight.setModel(new javax.swing.SpinnerNumberModel()); + spnHeight.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnHeightStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnHeight, gridBagConstraints); + + spnUnk8.setModel(new javax.swing.SpinnerNumberModel()); + spnUnk8.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk8StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk8, gridBagConstraints); + + spnUnkC.setModel(new javax.swing.SpinnerNumberModel()); + spnUnkC.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnkCStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnkC, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + add(filler1, gridBagConstraints); + }// //GEN-END:initComponents + + private void spnWidthStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnWidthStateChanged + entry.width = (int)spnWidth.getValue(); + }//GEN-LAST:event_spnWidthStateChanged + + private void spnHeightStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnHeightStateChanged + entry.height = (int)spnHeight.getValue(); + }//GEN-LAST:event_spnHeightStateChanged + + private void spnUnk8StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk8StateChanged + entry.unk8 = (int)spnUnk8.getValue(); + }//GEN-LAST:event_spnUnk8StateChanged + + private void spnUnkCStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnkCStateChanged + entry.unkC = (int)spnUnkC.getValue(); + }//GEN-LAST:event_spnUnkCStateChanged + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.Box.Filler filler1; + private javax.swing.JLabel lblHeight; + private javax.swing.JLabel lblUnk8; + private javax.swing.JLabel lblUnkC; + private javax.swing.JLabel lblWidth; + private javax.swing.JSpinner spnHeight; + private javax.swing.JSpinner spnUnk8; + private javax.swing.JSpinner spnUnkC; + private javax.swing.JSpinner spnWidth; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/editors/MonWidget.form b/src/com/aurum/almia/editors/MonWidget.form new file mode 100644 index 0000000..1b04dbf --- /dev/null +++ b/src/com/aurum/almia/editors/MonWidget.form @@ -0,0 +1,221 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/MonWidget.java b/src/com/aurum/almia/editors/MonWidget.java new file mode 100644 index 0000000..68ef40c --- /dev/null +++ b/src/com/aurum/almia/editors/MonWidget.java @@ -0,0 +1,285 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.game.map.MonData; + +public class MonWidget extends javax.swing.JPanel { + private MonData.Entry entry; + + public MonWidget(MonData.Entry entry) { + this.entry = entry; + + initComponents(); + + spnPosX.setValue(entry.posX); + spnPosY.setValue(entry.posY); + spnBehavior.setValue(entry.behavior); + cmoAppearance.setSelectedIndex(entry.appearance); + cmoID.setSelectedIndex(entry.monID); + spnUnk8.setValue(entry.unk8); + spnUnk9.setValue(entry.unk9); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + lblPosX = new javax.swing.JLabel(); + lblPosY = new javax.swing.JLabel(); + lblBehavior = new javax.swing.JLabel(); + lblAppearance = new javax.swing.JLabel(); + lblID = new javax.swing.JLabel(); + lblUnk8 = new javax.swing.JLabel(); + lblUnk9 = new javax.swing.JLabel(); + spnPosX = new javax.swing.JSpinner(); + spnPosY = new javax.swing.JSpinner(); + spnBehavior = new javax.swing.JSpinner(); + cmoAppearance = new javax.swing.JComboBox<>(); + cmoID = new javax.swing.JComboBox<>(); + spnUnk8 = new javax.swing.JSpinner(); + spnUnk9 = new javax.swing.JSpinner(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); + + setLayout(new java.awt.GridBagLayout()); + + lblPosX.setText("X Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosX, gridBagConstraints); + + lblPosY.setText("Y Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosY, gridBagConstraints); + + lblBehavior.setText("Behavior"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblBehavior, gridBagConstraints); + + lblAppearance.setText("Appearance"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblAppearance, gridBagConstraints); + + lblID.setText("Pokémon"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblID, gridBagConstraints); + + lblUnk8.setText("byte (0x8)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk8, gridBagConstraints); + + lblUnk9.setText("byte (0x9)"); + lblUnk9.setToolTipText(""); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 6; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk9, gridBagConstraints); + + spnPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosX.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosXStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosX, gridBagConstraints); + + spnPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosY.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosYStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosY, gridBagConstraints); + + spnBehavior.setModel(new javax.swing.SpinnerNumberModel(Short.valueOf((short)0), Short.valueOf((short)0), Short.valueOf((short)255), Short.valueOf((short)1))); + spnBehavior.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnBehaviorStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnBehavior, gridBagConstraints); + + cmoAppearance.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "00: Inactive", "01: Active", "02: Tree" })); + cmoAppearance.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmoAppearanceActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(cmoAppearance, gridBagConstraints); + + cmoID.setModel(new javax.swing.DefaultComboBoxModel(entry.parent.layer.map.game.getPokemonList().toArray())); + cmoID.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmoIDActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(cmoID, gridBagConstraints); + + spnUnk8.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk8.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk8StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 5; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk8, gridBagConstraints); + + spnUnk9.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk9.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk9StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 6; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk9, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 7; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + add(filler1, gridBagConstraints); + }// //GEN-END:initComponents + + private void spnPosXStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosXStateChanged + entry.posX = (short)spnPosX.getValue(); + }//GEN-LAST:event_spnPosXStateChanged + + private void spnPosYStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosYStateChanged + entry.posY = (short)spnPosY.getValue(); + }//GEN-LAST:event_spnPosYStateChanged + + private void spnBehaviorStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnBehaviorStateChanged + entry.behavior = (short)spnBehavior.getValue(); + }//GEN-LAST:event_spnBehaviorStateChanged + + private void cmoAppearanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmoAppearanceActionPerformed + entry.appearance = (short)cmoAppearance.getSelectedIndex(); + }//GEN-LAST:event_cmoAppearanceActionPerformed + + private void cmoIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmoIDActionPerformed + entry.monID = cmoID.getSelectedIndex(); + }//GEN-LAST:event_cmoIDActionPerformed + + private void spnUnk8StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk8StateChanged + entry.unk8 = (byte)spnUnk8.getValue(); + }//GEN-LAST:event_spnUnk8StateChanged + + private void spnUnk9StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk9StateChanged + entry.unk9 = (byte)spnUnk9.getValue(); + }//GEN-LAST:event_spnUnk9StateChanged + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox cmoAppearance; + private javax.swing.JComboBox cmoID; + private javax.swing.Box.Filler filler1; + private javax.swing.JLabel lblAppearance; + private javax.swing.JLabel lblBehavior; + private javax.swing.JLabel lblID; + private javax.swing.JLabel lblPosX; + private javax.swing.JLabel lblPosY; + private javax.swing.JLabel lblUnk8; + private javax.swing.JLabel lblUnk9; + private javax.swing.JSpinner spnBehavior; + private javax.swing.JSpinner spnPosX; + private javax.swing.JSpinner spnPosY; + private javax.swing.JSpinner spnUnk8; + private javax.swing.JSpinner spnUnk9; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/editors/NpcWidget.form b/src/com/aurum/almia/editors/NpcWidget.form new file mode 100644 index 0000000..6338e18 --- /dev/null +++ b/src/com/aurum/almia/editors/NpcWidget.form @@ -0,0 +1,230 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/NpcWidget.java b/src/com/aurum/almia/editors/NpcWidget.java new file mode 100644 index 0000000..8fcdcc6 --- /dev/null +++ b/src/com/aurum/almia/editors/NpcWidget.java @@ -0,0 +1,293 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.game.map.NpcData; + +public class NpcWidget extends javax.swing.JPanel { + private NpcData.Entry entry; + + public NpcWidget(NpcData.Entry entry) { + this.entry = entry; + + initComponents(); + + spnPosX.setValue(entry.posX); + spnPosY.setValue(entry.posY); + cmoDirection.setSelectedIndex(entry.direction); + chkIsVisible.setSelected(entry.isVisible); + cmoNpc.setSelectedIndex(entry.npcID); + spnUnk8.setValue(entry.unk8); + spnUnk9.setValue(entry.unk9); + chkUnkA.setSelected(entry.unkA); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + lblPosX = new javax.swing.JLabel(); + lblPosY = new javax.swing.JLabel(); + lblDirection = new javax.swing.JLabel(); + lblNpc = new javax.swing.JLabel(); + lblUnk8 = new javax.swing.JLabel(); + lblUnk9 = new javax.swing.JLabel(); + spnPosX = new javax.swing.JSpinner(); + spnPosY = new javax.swing.JSpinner(); + cmoDirection = new javax.swing.JComboBox<>(); + cmoNpc = new javax.swing.JComboBox<>(); + chkIsVisible = new javax.swing.JCheckBox(); + spnUnk9 = new javax.swing.JSpinner(); + spnUnk8 = new javax.swing.JSpinner(); + chkUnkA = new javax.swing.JCheckBox(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); + + setLayout(new java.awt.GridBagLayout()); + + lblPosX.setText("X Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosX, gridBagConstraints); + + lblPosY.setText("Y Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosY, gridBagConstraints); + + lblDirection.setText("Direction"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblDirection, gridBagConstraints); + + lblNpc.setText("Sprite"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblNpc, gridBagConstraints); + + lblUnk8.setText("byte (0x8)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk8, gridBagConstraints); + + lblUnk9.setText("byte (0x9)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 6; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk9, gridBagConstraints); + + spnPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosX.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosXStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosX, gridBagConstraints); + + spnPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosY.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosYStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosY, gridBagConstraints); + + cmoDirection.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "00: Down", "01: Left", "02: Up", "03: Right", "04: Down(?)", "05: Left(?)", "06: Up(?)", "07: Right(?)", "08: Down(?)", "09: Left(?)", "0A: Up(?)", "0B: Right(?)" })); + cmoDirection.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmoDirectionActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(cmoDirection, gridBagConstraints); + + cmoNpc.setModel(new javax.swing.DefaultComboBoxModel(entry.parent.layer.map.game.getNpcList().toArray())); + cmoNpc.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmoNpcActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(cmoNpc, gridBagConstraints); + + chkIsVisible.setText("Is visible?"); + chkIsVisible.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + chkIsVisibleActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(chkIsVisible, gridBagConstraints); + + spnUnk9.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk9.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk9StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 6; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk9, gridBagConstraints); + + spnUnk8.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk8.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk8StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 5; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk8, gridBagConstraints); + + chkUnkA.setText("bool (0xA)"); + chkUnkA.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + chkUnkAStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 7; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(chkUnkA, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 8; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + add(filler1, gridBagConstraints); + }// //GEN-END:initComponents + + private void spnPosXStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosXStateChanged + entry.posX = (short)spnPosX.getValue(); + }//GEN-LAST:event_spnPosXStateChanged + + private void spnPosYStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosYStateChanged + entry.posY = (short)spnPosY.getValue(); + }//GEN-LAST:event_spnPosYStateChanged + + private void cmoDirectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmoDirectionActionPerformed + entry.direction = (byte)cmoDirection.getSelectedIndex(); + }//GEN-LAST:event_cmoDirectionActionPerformed + + private void chkIsVisibleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkIsVisibleActionPerformed + entry.isVisible = chkIsVisible.isSelected(); + }//GEN-LAST:event_chkIsVisibleActionPerformed + + private void spnUnk8StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk8StateChanged + entry.unk8 = (byte)spnUnk8.getValue(); + }//GEN-LAST:event_spnUnk8StateChanged + + private void spnUnk9StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk9StateChanged + entry.unk9 = (byte)spnUnk9.getValue(); + }//GEN-LAST:event_spnUnk9StateChanged + + private void chkUnkAStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_chkUnkAStateChanged + entry.unkA = chkUnkA.isSelected(); + }//GEN-LAST:event_chkUnkAStateChanged + + private void cmoNpcActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmoNpcActionPerformed + entry.npcID = cmoNpc.getSelectedIndex(); + }//GEN-LAST:event_cmoNpcActionPerformed + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JCheckBox chkIsVisible; + private javax.swing.JCheckBox chkUnkA; + private javax.swing.JComboBox cmoDirection; + private javax.swing.JComboBox cmoNpc; + private javax.swing.Box.Filler filler1; + private javax.swing.JLabel lblDirection; + private javax.swing.JLabel lblNpc; + private javax.swing.JLabel lblPosX; + private javax.swing.JLabel lblPosY; + private javax.swing.JLabel lblUnk8; + private javax.swing.JLabel lblUnk9; + private javax.swing.JSpinner spnPosX; + private javax.swing.JSpinner spnPosY; + private javax.swing.JSpinner spnUnk8; + private javax.swing.JSpinner spnUnk9; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/swing/PokeIDEditor.form b/src/com/aurum/almia/editors/PokeIDEditor.form similarity index 99% rename from src/com/aurum/almia/swing/PokeIDEditor.form rename to src/com/aurum/almia/editors/PokeIDEditor.form index cf8acf2..6637540 100644 --- a/src/com/aurum/almia/swing/PokeIDEditor.form +++ b/src/com/aurum/almia/editors/PokeIDEditor.form @@ -3,9 +3,9 @@
- + - + diff --git a/src/com/aurum/almia/swing/PokeIDEditor.java b/src/com/aurum/almia/editors/PokeIDEditor.java similarity index 88% rename from src/com/aurum/almia/swing/PokeIDEditor.java rename to src/com/aurum/almia/editors/PokeIDEditor.java index 051f819..8183b4b 100644 --- a/src/com/aurum/almia/swing/PokeIDEditor.java +++ b/src/com/aurum/almia/editors/PokeIDEditor.java @@ -15,10 +15,11 @@ * along with this program. If not, see . */ -package com.aurum.almia.swing; +package com.aurum.almia.editors; import com.aurum.almia.Lists; import com.aurum.almia.Main; +import com.aurum.almia.Resources; import com.aurum.almia.game.param.PokeID; import java.io.IOException; import javax.swing.DefaultComboBoxModel; @@ -27,49 +28,68 @@ import javax.swing.ImageIcon; import javax.swing.JFrame; public class PokeIDEditor extends JFrame { - public PokeID mons; - - protected DefaultListModel model; + private PokeID data; + private PokeID.Entry selected; + private DefaultListModel model; public PokeIDEditor(PokeID mons) { initComponents(); - this.mons = mons; + this.data = mons; + this.selected = null; + this.model = new DefaultListModel(); initGUI(); - for (PokeID.Entry mon : mons.entries) { + for (PokeID.Entry mon : mons.entries) model.addElement(mon.toString()); - } } protected void initGUI() { - model = new DefaultListModel(); - - setTitle("PokeID Editor"); - + enableComponents(false); list.setModel(model); - Object[] assist = Lists.assist_mes.toArray(); cmoType.setModel(new DefaultComboBoxModel(assist)); + cmoAssist.setModel(new DefaultComboBoxModel(assist)); cmoAssist.addActionListener((java.awt.event.ActionEvent evt) -> { - lblAssist.setIcon(new ImageIcon(getClass().getResource("/res/assist/" + cmoAssist.getSelectedIndex() + ".png"))); + lblAssist.setIcon(new ImageIcon(Resources.loadImage(String.format("assist/%d.png", cmoAssist.getSelectedIndex())))); }); cmoAssist.setSelectedIndex(0); + cmoField.setModel(new DefaultComboBoxModel(Lists.fieldwaza_name.toArray())); cmoField.addActionListener((java.awt.event.ActionEvent evt) -> { - lblField.setIcon(new ImageIcon(getClass().getResource("/res/field/" + cmoField.getSelectedIndex() + ".png"))); + lblField.setIcon(new ImageIcon(Resources.loadImage(String.format("field/%d.png", cmoField.getSelectedIndex())))); }); cmoField.setSelectedIndex(0); + cmoPokemon.setModel(new DefaultComboBoxModel(Lists.pokemon_name.toArray())); } + public void enableComponents(boolean b) { + cmoPokemon.setEnabled(b); + spnForm.setEnabled(b); + cmoType.setEnabled(b); + cmoAssist.setEnabled(b); + cmoField.setEnabled(b); + spnFieldLevel.setEnabled(b); + spnShadowWidth.setEnabled(b); + spnShadowHeight.setEnabled(b); + spnUnk8.setEnabled(b); + spnUnkA.setEnabled(b); + spnUnkE.setEnabled(b); + spnUnkF.setEnabled(b); + spnUnk14.setEnabled(b); + spnUnk16.setEnabled(b); + btnSave.setEnabled(b); + btnRemove.setEnabled(b); + } + public void saveAll() { try { - mons.save(); + data.save(); } catch (IOException ex) { System.out.println(ex); @@ -121,8 +141,8 @@ public class PokeIDEditor extends JFrame { btnRemove = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("Map Editor: Editing "); - setIconImage(Main.icon); + setTitle("Pokémon Editor"); + setIconImage(Main.ICON); setResizable(false); toolbar.setFloatable(false); @@ -495,69 +515,71 @@ public class PokeIDEditor extends JFrame { int index = list.getSelectedIndex(); if (index < 0) { + enableComponents(false); return; } - PokeID.Entry mon = mons.entries.get(index); + selected = data.entries.get(index); - cmoPokemon.setSelectedIndex(mon.nameID); - spnForm.setValue(mon.formID); - cmoType.setSelectedIndex(mon.typeID); - cmoAssist.setSelectedIndex(mon.assistID); - cmoField.setSelectedIndex(mon.fieldID); - spnFieldLevel.setValue(mon.fieldLevel); - spnShadowWidth.setValue(mon.shadowWidth); - spnShadowHeight.setValue(mon.shadowHeight); - spnUnk8.setValue(mon.unk8); - spnUnkA.setValue(mon.unkA); - spnUnkE.setValue(mon.unkE); - spnUnkF.setValue(mon.unkF); - spnUnk14.setValue(mon.unk14); - spnUnk16.setValue(mon.unk16); + cmoPokemon.setSelectedIndex(selected.nameID); + spnForm.setValue(selected.formID); + cmoType.setSelectedIndex(selected.typeID); + cmoAssist.setSelectedIndex(selected.assistID); + cmoField.setSelectedIndex(selected.fieldID); + spnFieldLevel.setValue(selected.fieldLevel); + spnShadowWidth.setValue(selected.shadowWidth); + spnShadowHeight.setValue(selected.shadowHeight); + spnUnk8.setValue(selected.unk8); + spnUnkA.setValue(selected.unkA); + spnUnkE.setValue(selected.unkE); + spnUnkF.setValue(selected.unkF); + spnUnk14.setValue(selected.unk14); + spnUnk16.setValue(selected.unk16); + + enableComponents(true); }//GEN-LAST:event_listValueChanged private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed - int index = list.getSelectedIndex(); - - if (index < 0) { + if (selected == null) return; - } - PokeID.Entry mon = mons.entries.get(index); + selected.nameID = cmoPokemon.getSelectedIndex(); + selected.formID = (short) spnForm.getValue(); + selected.typeID = (short) cmoType.getSelectedIndex(); + selected.assistID = (short) cmoAssist.getSelectedIndex(); + selected.fieldID = (short) cmoField.getSelectedIndex(); + selected.fieldLevel = (short) spnFieldLevel.getValue(); + selected.shadowWidth = (short) spnShadowWidth.getValue(); + selected.shadowHeight = (short) spnShadowHeight.getValue(); + selected.unk8 = (int) spnUnk8.getValue(); + selected.unkA = (int) spnUnkA.getValue(); + selected.unkE = (byte) spnUnkE.getValue(); + selected.unkF = (byte) spnUnkF.getValue(); + selected.unk14 = (int) spnUnk14.getValue(); + selected.unk16 = (int) spnUnk16.getValue(); - mon.nameID = cmoPokemon.getSelectedIndex(); - mon.formID = (short) spnForm.getValue(); - mon.typeID = (short) cmoType.getSelectedIndex(); - mon.assistID = (short) cmoAssist.getSelectedIndex(); - mon.fieldID = (short) cmoField.getSelectedIndex(); - mon.fieldLevel = (short) spnFieldLevel.getValue(); - mon.shadowWidth = (short) spnShadowWidth.getValue(); - mon.shadowHeight = (short) spnShadowHeight.getValue(); - mon.unk8 = (int) spnUnk8.getValue(); - mon.unkA = (int) spnUnkA.getValue(); - mon.unkE = (byte) spnUnkE.getValue(); - mon.unkF = (byte) spnUnkF.getValue(); - mon.unk14 = (int) spnUnk14.getValue(); - mon.unk16 = (int) spnUnk16.getValue(); - - model.setElementAt(mon.toString(), index); + model.setElementAt(selected.toString(), list.getSelectedIndex()); }//GEN-LAST:event_btnSaveActionPerformed private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed - PokeID.Entry mon = mons.new Entry(); + PokeID.Entry mon = data.new Entry(); - mons.entries.add(mon); + data.entries.add(mon); model.addElement(mon.toString()); + + int index = data.entries.size() - 1; + + if (index < 0) + return; + + list.setSelectedIndex(index); + list.ensureIndexIsVisible(index); }//GEN-LAST:event_btnAddActionPerformed private void btnRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveActionPerformed int index = list.getSelectedIndex(); - if (index < 0) { - return; - } - - mons.entries.remove(index); + data.entries.remove(index); model.remove(index); }//GEN-LAST:event_btnRemoveActionPerformed diff --git a/src/com/aurum/almia/editors/TargetWidget.form b/src/com/aurum/almia/editors/TargetWidget.form new file mode 100644 index 0000000..47a3a1f --- /dev/null +++ b/src/com/aurum/almia/editors/TargetWidget.form @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/TargetWidget.java b/src/com/aurum/almia/editors/TargetWidget.java new file mode 100644 index 0000000..438ccc7 --- /dev/null +++ b/src/com/aurum/almia/editors/TargetWidget.java @@ -0,0 +1,353 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.game.map.TargetData; + +public class TargetWidget extends javax.swing.JPanel { + private TargetData.Entry entry; + + public TargetWidget(TargetData.Entry entry) { + this.entry = entry; + + initComponents(); + + spnPosX.setValue(entry.posX); + spnPosY.setValue(entry.posY); + spnUnk4.setValue(entry.unk4); + spnUnk5.setValue(entry.unk5); + cmoID.setSelectedIndex(entry.obstacleID); + spnUnk8.setValue(entry.unk8); + spnUnk9.setValue(entry.unk9); + spnUnkA.setValue(entry.unkA); + spnUnkB.setValue(entry.unkB); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + lblPosX = new javax.swing.JLabel(); + lblPosY = new javax.swing.JLabel(); + lblUnk4 = new javax.swing.JLabel(); + lblUnk5 = new javax.swing.JLabel(); + lblID = new javax.swing.JLabel(); + lblUnk8 = new javax.swing.JLabel(); + lblUnk9 = new javax.swing.JLabel(); + lblUnkA = new javax.swing.JLabel(); + lblUnkB = new javax.swing.JLabel(); + spnPosX = new javax.swing.JSpinner(); + spnPosY = new javax.swing.JSpinner(); + spnUnk4 = new javax.swing.JSpinner(); + spnUnk5 = new javax.swing.JSpinner(); + cmoID = new javax.swing.JComboBox<>(); + spnUnk8 = new javax.swing.JSpinner(); + spnUnk9 = new javax.swing.JSpinner(); + spnUnkA = new javax.swing.JSpinner(); + spnUnkB = new javax.swing.JSpinner(); + filler = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); + + setLayout(new java.awt.GridBagLayout()); + + lblPosX.setText("X Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosX, gridBagConstraints); + + lblPosY.setText("Y Position"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblPosY, gridBagConstraints); + + lblUnk4.setText("byte (0x4)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk4, gridBagConstraints); + + lblUnk5.setText("byte (0x5)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk5, gridBagConstraints); + + lblID.setText("Obstacle"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblID, gridBagConstraints); + + lblUnk8.setText("byte (0x8)"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 5; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk8, gridBagConstraints); + + lblUnk9.setText("byte (0x9)"); + lblUnk9.setToolTipText(""); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 6; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk9, gridBagConstraints); + + lblUnkA.setText("byte (0xA)"); + lblUnkA.setToolTipText(""); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 7; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnkA, gridBagConstraints); + + lblUnkB.setText("byte (0xB)"); + lblUnkB.setToolTipText(""); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 8; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnkB, gridBagConstraints); + + spnPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosX.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosXStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosX, gridBagConstraints); + + spnPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnPosY.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnPosYStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnPosY, gridBagConstraints); + + spnUnk4.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk4.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk4StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk4, gridBagConstraints); + + spnUnk5.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk5.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk5StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk5, gridBagConstraints); + + cmoID.setModel(new javax.swing.DefaultComboBoxModel(entry.parent.layer.map.game.getTargetList().toArray())); + cmoID.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + cmoIDActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 4; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(cmoID, gridBagConstraints); + + spnUnk8.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk8.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk8StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 5; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk8, gridBagConstraints); + + spnUnk9.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnk9.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk9StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 6; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk9, gridBagConstraints); + + spnUnkA.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnkA.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnkAStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 7; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnkA, gridBagConstraints); + + spnUnkB.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); + spnUnkB.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnkBStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 8; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnkB, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 9; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + add(filler, gridBagConstraints); + }// //GEN-END:initComponents + + private void spnPosXStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosXStateChanged + entry.posX = (short)spnPosX.getValue(); + }//GEN-LAST:event_spnPosXStateChanged + + private void spnPosYStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnPosYStateChanged + entry.posY = (short)spnPosY.getValue(); + }//GEN-LAST:event_spnPosYStateChanged + + private void spnUnk4StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk4StateChanged + entry.unk4 = (byte)spnUnk4.getValue(); + }//GEN-LAST:event_spnUnk4StateChanged + + private void spnUnk5StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk5StateChanged + entry.unk5 = (byte)spnUnk5.getValue(); + }//GEN-LAST:event_spnUnk5StateChanged + + private void cmoIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmoIDActionPerformed + entry.obstacleID = cmoID.getSelectedIndex(); + }//GEN-LAST:event_cmoIDActionPerformed + + private void spnUnk8StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk8StateChanged + entry.unk8 = (byte)spnUnk8.getValue(); + }//GEN-LAST:event_spnUnk8StateChanged + + private void spnUnk9StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk9StateChanged + entry.unk9 = (byte)spnUnk9.getValue(); + }//GEN-LAST:event_spnUnk9StateChanged + + private void spnUnkAStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnkAStateChanged + entry.unkA = (byte)spnUnkA.getValue(); + }//GEN-LAST:event_spnUnkAStateChanged + + private void spnUnkBStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnkBStateChanged + entry.unkB = (byte)spnUnkB.getValue(); + }//GEN-LAST:event_spnUnkBStateChanged + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JComboBox cmoID; + private javax.swing.Box.Filler filler; + private javax.swing.JLabel lblID; + private javax.swing.JLabel lblPosX; + private javax.swing.JLabel lblPosY; + private javax.swing.JLabel lblUnk4; + private javax.swing.JLabel lblUnk5; + private javax.swing.JLabel lblUnk8; + private javax.swing.JLabel lblUnk9; + private javax.swing.JLabel lblUnkA; + private javax.swing.JLabel lblUnkB; + private javax.swing.JSpinner spnPosX; + private javax.swing.JSpinner spnPosY; + private javax.swing.JSpinner spnUnk4; + private javax.swing.JSpinner spnUnk5; + private javax.swing.JSpinner spnUnk8; + private javax.swing.JSpinner spnUnk9; + private javax.swing.JSpinner spnUnkA; + private javax.swing.JSpinner spnUnkB; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/editors/TexInfoWidget.form b/src/com/aurum/almia/editors/TexInfoWidget.form new file mode 100644 index 0000000..0b788ac --- /dev/null +++ b/src/com/aurum/almia/editors/TexInfoWidget.form @@ -0,0 +1,135 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/com/aurum/almia/editors/TexInfoWidget.java b/src/com/aurum/almia/editors/TexInfoWidget.java new file mode 100644 index 0000000..753c06c --- /dev/null +++ b/src/com/aurum/almia/editors/TexInfoWidget.java @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.editors; + +import com.aurum.almia.game.map.TextureInfo; + +public class TexInfoWidget extends javax.swing.JPanel { + private TextureInfo.Entry entry; + + public TexInfoWidget(TextureInfo.Entry entry) { + this.entry = entry; + + initComponents(); + + spnUnk0.setValue(entry.unk0); + spnTextureID.setValue(entry.textureID); + spnUnk4.setValue(entry.unk4); + spnUnk6.setValue(entry.unk6); + } + + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + lblUnk0 = new javax.swing.JLabel(); + lblID = new javax.swing.JLabel(); + lblUnk4 = new javax.swing.JLabel(); + lblUnk6 = new javax.swing.JLabel(); + spnUnk0 = new javax.swing.JSpinner(); + spnTextureID = new javax.swing.JSpinner(); + spnUnk4 = new javax.swing.JSpinner(); + spnUnk6 = new javax.swing.JSpinner(); + filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); + + setLayout(new java.awt.GridBagLayout()); + + lblUnk0.setText("unk0"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk0, gridBagConstraints); + + lblID.setText("Texture ID"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblID, gridBagConstraints); + + lblUnk4.setText("unk4"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk4, gridBagConstraints); + + lblUnk6.setText("unk6"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(lblUnk6, gridBagConstraints); + + spnUnk0.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnUnk0.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk0StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk0, gridBagConstraints); + + spnTextureID.setModel(new javax.swing.SpinnerNumberModel(0, 0, 65535, 1)); + spnTextureID.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnTextureIDStateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 1; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnTextureID, gridBagConstraints); + + spnUnk4.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnUnk4.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk4StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk4, gridBagConstraints); + + spnUnk6.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); + spnUnk6.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + spnUnk6StateChanged(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 3; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.weightx = 0.5; + gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); + add(spnUnk6, gridBagConstraints); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 4; + gridBagConstraints.gridwidth = 2; + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + add(filler1, gridBagConstraints); + }// //GEN-END:initComponents + + private void spnUnk0StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk0StateChanged + entry.unk0 = (short)spnUnk0.getValue(); + }//GEN-LAST:event_spnUnk0StateChanged + + private void spnTextureIDStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnTextureIDStateChanged + entry.textureID = (int)spnTextureID.getValue(); + }//GEN-LAST:event_spnTextureIDStateChanged + + private void spnUnk4StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk4StateChanged + entry.unk4 = (short)spnUnk4.getValue(); + }//GEN-LAST:event_spnUnk4StateChanged + + private void spnUnk6StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnUnk6StateChanged + entry.unk6 = (short)spnUnk6.getValue(); + }//GEN-LAST:event_spnUnk6StateChanged + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.Box.Filler filler1; + private javax.swing.JLabel lblID; + private javax.swing.JLabel lblUnk0; + private javax.swing.JLabel lblUnk4; + private javax.swing.JLabel lblUnk6; + private javax.swing.JSpinner spnTextureID; + private javax.swing.JSpinner spnUnk0; + private javax.swing.JSpinner spnUnk4; + private javax.swing.JSpinner spnUnk6; + // End of variables declaration//GEN-END:variables +} \ No newline at end of file diff --git a/src/com/aurum/almia/game/Compression.java b/src/com/aurum/almia/game/Compression.java new file mode 100644 index 0000000..5821d19 --- /dev/null +++ b/src/com/aurum/almia/game/Compression.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.game; + +import com.aurum.almia.util.BitConverter; +import java.nio.ByteOrder; + +public final class Compression { + public static final int LZ10 = 0x10; + public static final int LZ11 = 0x11; + + public static byte[] decompress(byte[] compressed, ByteOrder endian) { + switch(compressed[0] & 0xFF) { + case LZ10: return decompressLZ10(compressed, endian); + case LZ11: return decompressLZ11(compressed, endian); + default: return compressed; + } + } + + public static byte[] decompressLZ10(byte[] compressed, ByteOrder endian) { + int decompressedSize = BitConverter.toUnsignedInt24(compressed, endian, 1); + int compressedStart = 4; + + if (decompressedSize == 0) { + decompressedSize = BitConverter.toInt(compressed, endian, 4); + compressedStart = 8; + } + + byte[] decompressed = new byte[decompressedSize]; + int curIn = compressedStart; + int curOut = 0; + + while (curOut < decompressed.length) { + byte flags = compressed[curIn++]; + + for (int fi = 0 ; fi < 8 && curIn < compressed.length ; fi++) { + if ((flags & (0x80 >> fi)) != 0) { + int token = compressed[curIn++] & 0xFF; + int lenCopy = (token >> 4) + 3; + int disp = ((token & 0xF) << 8) | (compressed[curIn++] & 0xFF); + int offCopy = curOut - disp - 1; + + for (int i = 0 ; i < lenCopy ; i++) + decompressed[curOut++] = decompressed[offCopy + i]; + } + else + decompressed[curOut++] = compressed[curIn++]; + } + } + + return decompressed; + } + + public static byte[] decompressLZ11(byte[] compressed, ByteOrder endian) { + int decompressedSize = BitConverter.toUnsignedInt24(compressed, endian, 1); + int compressedStart = 4; + + if (decompressedSize == 0) { + decompressedSize = BitConverter.toInt(compressed, endian, 4); + compressedStart = 8; + } + + byte[] decompressed = new byte[decompressedSize]; + int curIn = compressedStart; + int curOut = 0; + + while (curOut < decompressed.length) { + byte flags = compressed[curIn++]; + + for (int fi = 0 ; fi < 8 && curIn < compressed.length ; fi++) { + if ((flags & (0x80 >> fi)) != 0) { + int token = compressed[curIn++] & 0xFF; + int token2, token3; + int lenCopy; + int disp; + int offCopy; + + switch(token >> 4) { + case 0: + token2 = compressed[curIn++] & 0xFF; + + lenCopy = (((token & 0xF) << 4) | (token2 >> 4)) + 0x11; + disp = ((token2 & 0xF) << 8) | (compressed[curIn++] & 0xFF); + break; + case 1: + token2 = compressed[curIn++] & 0xFF; + token3 = compressed[curIn++] & 0xFF; + + lenCopy = (((token & 0xF) << 12) | (token2 << 4) | (token3 >> 4)) + 0x111; + disp = ((token3 & 0xF) << 8) | (compressed[curIn++] & 0xFF); + break; + default: + lenCopy = (token >> 4) + 0x1; + disp = ((token & 0xF) << 8) | (compressed[curIn++] & 0xFF); + } + + offCopy = curOut + disp + 1; + + for (int i = 0 ; i < lenCopy ; i++) + decompressed[curOut++] = decompressed[offCopy + i]; + } + else + decompressed[curOut++] = compressed[curIn++]; + } + } + + return decompressed; + } +} \ No newline at end of file diff --git a/src/com/aurum/almia/game/Game.java b/src/com/aurum/almia/game/Game.java index 8dba5fe..7544e66 100644 --- a/src/com/aurum/almia/game/Game.java +++ b/src/com/aurum/almia/game/Game.java @@ -17,22 +17,24 @@ package com.aurum.almia.game; +import com.aurum.almia.Lists; import com.aurum.almia.game.param.BattlePokemon; import com.aurum.almia.game.param.PokeID; -import com.aurum.almia.Utils; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; public class Game { public static Game current; - //-------------------------------------------------------------------------- - public File filesystem; public PokeID monDataBase; public BattlePokemon monDataBattle; - //-------------------------------------------------------------------------- + public Game(String fsdir) { + this(new File(fsdir)); + } public Game(File fs) { this.filesystem = fs; @@ -40,25 +42,65 @@ public class Game { this.monDataBattle = null; } - public Game(String fsdir) { - this(new File(fsdir)); - } - @Override public String toString() { return filesystem.getAbsolutePath(); } - public String getPath() { - return filesystem.getAbsolutePath(); + public String getFilePath(String file) { + return String.format("%s/%s", toString(), file); } - public String getFullPath(String file) { - return String.format("%s/%s", getPath(), file); + public File getFile(String file) { + return new File(getFilePath(file)); } public void init() throws IOException { - monDataBase = new PokeID(this, Utils.loadFileIntoBuffer(getFullPath("param/PokeID.bin"))); - monDataBattle = new BattlePokemon(this, Utils.loadFileIntoBuffer(getFullPath("param/BattlePokemon.bin"))); + monDataBase = new PokeID(this); + //monDataBattle = new BattlePokemon(this); + } + + public List getMapsList() { + File[] files = getFile("field/map").listFiles(); + List list = new ArrayList(); + + for (File file : files) { + if (!file.isFile()) + continue; + + String filename = file.getName(); + + if (filename.endsWith(".map.dat.lz")) + list.add(filename.replace(".map.dat.lz", "")); + } + + return list; + } + + public List getPokemonList() { + List list = new ArrayList(); + + for (int i = 0 ; i < monDataBase.entries.size() ; i++) + list.add(String.format("%03X: %s", i, monDataBase.entries.get(i).toShortString())); + + return list; + } + + public List getTargetList() { + List list = new ArrayList(); + + for (int i = 0 ; i < Lists.obstacles.size() ; i++) + list.add(String.format("%02X: %s", i, Lists.obstacles.get(i))); + + return list; + } + + public List getNpcList() { + List list = new ArrayList(); + + for (int i = 0 ; i < Lists.npcs.size() ; i++) + list.add(String.format("%02X: %s", i, Lists.npcs.get(i))); + + return list; } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/NARC.java b/src/com/aurum/almia/game/NARC.java deleted file mode 100644 index 8ccd4e0..0000000 --- a/src/com/aurum/almia/game/NARC.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2018 Aurum - * - * AlmiaE is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AlmiaE is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.aurum.almia.game; - -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import java.util.ArrayList; -import java.util.List; - -public class NARC { - public static final int NARC_MAGIC = 0x4E415243; - public static final int FATB_MAGIC = 0x46415442; - public static final int FNTB_MAGIC = 0x464E5442; - public static final int FIMG_MAGIC = 0x46494D47; - - //-------------------------------------------------------------------------- - - private class FatbEntry { - public int startOffset; - public int endOffset; - } - - public class FimgEntry { - public String name; - public byte[] data; - - public FimgEntry() { - this.name = "Unnamed"; - this.data = null; - } - } - - //-------------------------------------------------------------------------- - - public List files; - - //-------------------------------------------------------------------------- - - public NARC() { - this.files = new ArrayList(); - } - - public NARC(ByteBuffer buf) { - this(); - - buf.setEndianness(ByteOrder.BIG_ENDIAN); - - - int fileMagic = buf.readInt(); - if (fileMagic != NARC_MAGIC) { - throw new IllegalArgumentException("NARC: No NARC data found."); - } - short endianMark = buf.readShort(); - if ((endianMark & 0xFFFF) == 0xFEFF) { - buf.setEndianness(ByteOrder.LITTLE_ENDIAN); - } - short unkConst = buf.readShort(); - int totalSize = buf.readInt(); - if (buf.size() != totalSize) { - System.out.println("NARC: Warning! Stored size does not equal actual buffer size!"); - } - int headerSize = buf.readShort(); - int numSections = buf.readShort(); - - - int fatbPos = buf.position(); - int fatbMagic = buf.readInt(); - int fatbSize = buf.readInt(); - int fatbFiles = buf.readInt(); - FatbEntry[] fatbEntries = new FatbEntry[fatbFiles]; - for (int i = 0 ; i < fatbEntries.length ; i++) { - FatbEntry e = new FatbEntry(); - e.startOffset = buf.readInt(); - e.endOffset = buf.readInt(); - fatbEntries[i] = e; - } - - - // this needs revision, really... - int fntbPos = buf.position(); - int fntbMagic = buf.readInt(); - int fntbSize = buf.readInt(); - buf.skip(fntbSize - 0x8); - - - int fimgPos = buf.position(); - int fimgMagic = buf.readInt(); - int fimgSize = buf.readInt(); - - for (int i = 0 ; i < fatbFiles ; i++) { - FimgEntry e = new FimgEntry(); - FatbEntry fatb = fatbEntries[i]; - - buf.seek(fimgPos + 0x8 + fatb.startOffset); - e.data = buf.readBytes(fatb.endOffset - fatb.startOffset); - - files.add(e); - } - } - - public byte[] pack() { - int headerSize = 0x10; - int fatbSize = 0xC + files.size() * 0x8; - int fntbSize = 0x10; - int fimgSize = 0x8; - - for (FimgEntry file : files) { - fimgSize += file.data.length; - } - - int totalsize = headerSize + fatbSize + fntbSize + fimgSize; - - - ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.BIG_ENDIAN); - - - buf.writeInt(NARC_MAGIC); - buf.writeShort((short)0xFEFF); - buf.setEndianness(ByteOrder.LITTLE_ENDIAN); - buf.writeShort((short)0x0100); - buf.writeInt(totalsize); - buf.writeShort((short)headerSize); - buf.writeShort((short)0x3); - - - int fatbPos = buf.position(); - buf.writeInt(FATB_MAGIC); - buf.writeInt(fatbSize); - buf.writeInt(files.size()); - buf.skip(files.size() * 0x8); - - - int fntbPos = buf.position(); - buf.writeInt(FNTB_MAGIC); - buf.writeInt(fntbSize); - buf.writeInt(0x4); - buf.writeInt(0x10000); - - - int fimgPos = buf.position(); - buf.writeInt(FIMG_MAGIC); - buf.writeInt(fimgSize); - - for (int i = 0 ; i < files.size() ; i++) { - FimgEntry file = files.get(i); - - int inFimgPos = buf.position(); - int startPos = inFimgPos - fimgPos - 0x8; - int endPos = startPos + file.data.length; - buf.seek(fatbPos + 0xC + i * 0x8); - buf.writeInt(startPos); - buf.writeInt(endPos); - buf.seek(inFimgPos); - buf.writeBytes(file.data); - } - - return buf.getBuffer(); - } - - public void addFile(byte[] data) { - FimgEntry file = new FimgEntry(); - - file.data = data; - files.add(file); - } -} \ No newline at end of file diff --git a/src/com/aurum/almia/game/Narc.java b/src/com/aurum/almia/game/Narc.java new file mode 100644 index 0000000..273d8e6 --- /dev/null +++ b/src/com/aurum/almia/game/Narc.java @@ -0,0 +1,181 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.game; + +import com.aurum.almia.util.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; + +public class Narc { + public static final String NARC_MAGIC = "NARC"; + public static final String FATB_MAGIC = "BTAF"; + public static final String FNTB_MAGIC = "BTNF"; + public static final String FIMG_MAGIC = "GMIF"; + + private class FatbEntry { + int startOffset; + int endOffset; + } + + public static class NarcFile { + public String name; + public byte[] data; + + public NarcFile() { + this.name = "Unnamed"; + this.data = null; + } + } + + public List files; + + public Narc() { + this.files = new ArrayList(); + } + + public Narc(byte[] raw) { + this(); + + raw = Compression.decompress(raw, ByteOrder.LITTLE_ENDIAN); + ByteBuffer buf = new ByteBuffer(raw, ByteOrder.LITTLE_ENDIAN); + + int curSectionPos; + int curSectionSize; + + // NARC header + curSectionPos = buf.position(); + + if (!buf.readMagic().equals(NARC_MAGIC)) + throw new IllegalArgumentException("No valid NARC data found!"); + + buf.skip(0x8); // shitty bom, unk6, fileSize + curSectionSize = buf.readShort(); + buf.skip(0x2); // numSections + + buf.seek(curSectionPos + curSectionSize); + + // FATB section + curSectionPos = buf.position(); + buf.skip(0x4); // fatbMagic + curSectionSize = buf.readInt(); + int numFiles = buf.readInt(); + FatbEntry[] fileEntries = new FatbEntry[numFiles]; + + for (int i = 0 ; i < numFiles ; i++) { + FatbEntry e = new FatbEntry(); + e.startOffset = buf.readInt(); + e.endOffset = buf.readInt(); + + fileEntries[i] = e; + } + + buf.seek(curSectionPos + curSectionSize); + + // FNTB section + // needs to be revised... + curSectionPos = buf.position(); + buf.skip(0x4); // fntbMagic + curSectionSize = buf.readInt(); + buf.skip(0x8); + + buf.seek(curSectionPos + curSectionSize); + + // FIMG section + curSectionPos = buf.position(); + buf.skip(0x4); // fimgMagic + curSectionSize = buf.readInt(); + + for (int i = 0 ; i < numFiles ; i++) { + NarcFile file = new NarcFile(); + FatbEntry fatb = fileEntries[i]; + + buf.seek(curSectionPos + 0x8 + fatb.startOffset); + file.data = buf.readBytes(fatb.endOffset - fatb.startOffset); + + files.add(file); + } + } + + public byte[] pack() { + // Calculate (approximate) file size, and create the buffer + int headerSize = 0x10; + int fatbSize = 0xC + files.size() * 0x8; + int fntbSize = 0x10; + int fimgSize = 0x8; + + for (NarcFile file : files) + fimgSize += file.data.length; + + int totalSize = headerSize + fatbSize + fntbSize + fimgSize; + ByteBuffer buf = new ByteBuffer(totalSize, ByteOrder.LITTLE_ENDIAN); + + // NARC header + buf.writeMagic(NARC_MAGIC); + buf.writeByte((byte)0xFE); // BOM... that does not represent LE + buf.writeByte((byte)0xFF); + buf.writeShort((short)0x0100); // unknown constant + buf.writeInt(totalSize); + buf.writeShort((short)headerSize); + buf.writeShort((short)0x0003); // numSections + + // FATB section + buf.writeMagic(FATB_MAGIC); + buf.writeInt(fatbSize); + buf.writeInt(files.size()); + int fatbEntriesPos = buf.position(); + buf.skip(files.size() * 0x8); + + // FNTB section + // needs revision... + buf.writeMagic(FNTB_MAGIC); + buf.writeInt(fntbSize); + buf.writeInt(0x00000004); + buf.writeInt(0x00010000); + + // FIMG section + buf.writeMagic(FIMG_MAGIC); + buf.writeInt(fimgSize); + int fimgEntriesPos = buf.position(); + + for (int i = 0 ; i < files.size() ; i++) { + NarcFile file = files.get(i); + int inFimgPos = buf.position(); + int startPos = inFimgPos - fimgEntriesPos; + int endPos = startPos + file.data.length; + + // Write FATB entry + buf.seek(fatbEntriesPos + i * 0x8); + buf.writeInt(startPos); + buf.writeInt(endPos); + + // Write FIMG entry + buf.seek(inFimgPos); + buf.writeBytes(file.data); + } + + return buf.getBuffer(); + } + + public void addFile(byte[] data) { + NarcFile file = new NarcFile(); + + file.data = data; + files.add(file); + } +} \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/AbstractData.java b/src/com/aurum/almia/game/map/AbstractData.java new file mode 100644 index 0000000..21c2a22 --- /dev/null +++ b/src/com/aurum/almia/game/map/AbstractData.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.game.map; + +import java.awt.Graphics; +import java.util.List; + +public abstract class AbstractData { + public final Layer layer; + public List entries; + + public AbstractData(Layer layer) { + this.layer = layer; + this.entries = null; + } + + public abstract byte[] pack(); + public abstract int getIdentifier(); + public abstract void render(Graphics g); +} \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/AbstractEntry.java b/src/com/aurum/almia/game/map/AbstractEntry.java new file mode 100644 index 0000000..ebec4c9 --- /dev/null +++ b/src/com/aurum/almia/game/map/AbstractEntry.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.game.map; + +import java.awt.Graphics; + +public abstract class AbstractEntry implements Cloneable { + public final D parent; + + public AbstractEntry(D parent) { + this.parent = parent; + } + + public AbstractEntry clone() { + try { + return (AbstractEntry)super.clone(); + } + catch(CloneNotSupportedException ex) {} + + return null; + } + + public void render(Graphics g) {} +} \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/CollOverlayData.java b/src/com/aurum/almia/game/map/CollOverlayData.java new file mode 100644 index 0000000..8f0ddce --- /dev/null +++ b/src/com/aurum/almia/game/map/CollOverlayData.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.game.map; + +import com.aurum.almia.util.ByteBuffer; + +public class CollOverlayData extends CollisionData { + public CollOverlayData(Layer layer) { + super(layer); + } + + public CollOverlayData(Layer layer, ByteBuffer buf) { + super(layer, buf); + } + + @Override + public String toString() { + return "Collision Overlay"; + } + + @Override + public int getIdentifier() { + return Layer.MDATA_COLL_OVERLAY; + } +} \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/CollisionData.java b/src/com/aurum/almia/game/map/CollisionData.java new file mode 100644 index 0000000..71b281e --- /dev/null +++ b/src/com/aurum/almia/game/map/CollisionData.java @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.game.map; + +import com.aurum.almia.util.RenderHelper; +import com.aurum.almia.util.ByteBuffer; +import java.awt.Color; +import java.awt.Graphics; +import java.nio.ByteOrder; + +public class CollisionData extends AbstractData { + public static final int HEADER_SIZE = 0x14; + public static final int ENTRY_SIZE = 0x2; + + public int width; + public int height; + public int[][] entries; + + public CollisionData(Layer layer) { + super(layer); + + this.width = 0; + this.height = 0; + this.entries = null; + } + + public CollisionData(Layer layer, ByteBuffer buf) { + this(layer); + + buf.setEndianness(ByteOrder.LITTLE_ENDIAN); + + int headerSize = buf.readInt(); + int entriesCount = buf.readInt(); + this.width = buf.readInt(); + this.height = buf.readInt(); + this.entries = new int[height][width]; + + if (width * height != entriesCount) + System.out.println("CollisionData: Warning! Calculated entry count does not equal written count."); + + for (int y = 0; y < height ; y++) { + for (int x = 0; x < width ; x++) { + entries[y][x] = buf.readUnsignedShort(); + } + } + } + + @Override + public String toString() { + return "Collision"; + } + + @Override + public byte[] pack() { + int entriesCount = width * height; + int totalsize = HEADER_SIZE + entriesCount * ENTRY_SIZE; + + ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.LITTLE_ENDIAN); + + buf.writeInt(getIdentifier()); + buf.writeInt(HEADER_SIZE - 0x4); // header size without identifier + buf.writeInt(entriesCount); + buf.writeInt(width); + buf.writeInt(height); + + for (int y = 0; y < height ; y++) { + for (int x = 0; x < width ; x++) + buf.writeUnsignedShort(entries[y][x]); + } + + return buf.getBuffer(); + } + + @Override + public int getIdentifier() { + return Layer.MDATA_COLLISION; + } + + @Override + public void render(Graphics g) { + for (int y = 0 ; y < height ; y++) { + for (int x = 0 ; x < width ; x++) + RenderHelper.drawBox( + g, x * 16, + y * 16, 16, 16, + Color.GRAY, + new Color(Integer.rotateLeft(0x595A9556, entries[y][x])), + false + ); + } + } +} \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/Layer.java b/src/com/aurum/almia/game/map/Layer.java index 920fb33..e4500ce 100644 --- a/src/com/aurum/almia/game/map/Layer.java +++ b/src/com/aurum/almia/game/map/Layer.java @@ -1,57 +1,80 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import com.aurum.almia.game.NARC; -import com.aurum.almia.game.NARC.FimgEntry; +import com.aurum.almia.util.ByteBuffer; +import com.aurum.almia.game.Narc; +import com.aurum.almia.game.Narc.NarcFile; +import java.awt.Graphics; +import java.nio.ByteOrder; import java.util.ArrayList; import java.util.List; public class Layer { - public static final int MDATA_01 = 0x01; - public static final int MDATA_02 = 0x02; - public static final int MDATA_COLLISION = 0x03; - public static final int MDATA_TARGET = 0x04; - public static final int MDATA_UNKNOWN = 0x05; // unused - public static final int MDATA_06 = 0x06; - public static final int MDATA_WARP = 0x07; - public static final int MDATA_NPC = 0x08; - public static final int MDATA_MON = 0x09; - public static final int MDATA_0A = 0x0A; - public static final int MDATA_0B = 0x0B; - public static final int MDATA_0C = 0x0C; - public static final int MDATA_0D = 0x0D; - public static final int MDATA_0E = 0x0E; + public static final int MDATA_01 = 0x01; + public static final int MDATA_TILES = 0x02; + public static final int MDATA_COLLISION = 0x03; + public static final int MDATA_TARGET = 0x04; + public static final int MDATA_UNKNOWN = 0x05; // unused + public static final int MDATA_COLL_OVERLAY = 0x06; + public static final int MDATA_LOCATION = 0x07; + public static final int MDATA_NPC = 0x08; + public static final int MDATA_MON = 0x09; + public static final int MDATA_0A = 0x0A; + public static final int MDATA_0B = 0x0B; + public static final int MDATA_0C = 0x0C; + public static final int MDATA_0D = 0x0D; + public static final int MDATA_0E = 0x0E; - public Map map; + public final Map map; public List lyrUnk; + public CollisionData collisionData; public TargetData targetData; - public WarpData warpData; + public CollOverlayData collOverlayData; + public LocationData locationData; public NpcData npcData; public MonData monData; public Layer(Map map) { this.map = map; this.lyrUnk = new ArrayList(); + this.collisionData = new CollisionData(this); this.targetData = new TargetData(this); - this.warpData = new WarpData(this); + this.collOverlayData = new CollOverlayData(this); + this.locationData = new LocationData(this); this.npcData = new NpcData(this); this.monData = new MonData(this); } - public Layer(Map map, NARC narc) { + public Layer(Map map, Narc narc) { this(map); ByteBuffer buf; - for (FimgEntry file : narc.files) { + for (NarcFile file : narc.files) { buf = new ByteBuffer(file.data, ByteOrder.LITTLE_ENDIAN); - int identifier = buf.readInt(); switch(identifier) { + case MDATA_COLLISION: collisionData = new CollisionData(this, buf); break; case MDATA_TARGET: targetData = new TargetData(this, buf); break; - case MDATA_WARP: warpData = new WarpData(this, buf); break; + case MDATA_COLL_OVERLAY: collOverlayData = new CollOverlayData(this, buf); break; + case MDATA_LOCATION: locationData = new LocationData(this, buf); break; case MDATA_NPC: npcData = new NpcData(this, buf); break; case MDATA_MON: monData = new MonData(this, buf); break; default: System.out.println(String.format("Unknown map format %02X, %d", identifier, buf.size())); lyrUnk.add(buf.getBuffer()); @@ -59,18 +82,33 @@ public class Layer { } } + @Override + public String toString() { + return "Layer"; + } + public byte[] pack() { - NARC narc = new NARC(); + Narc narc = new Narc(); - for (byte[] unk : lyrUnk) { + for (byte[] unk : lyrUnk) narc.addFile(unk); - } + narc.addFile(collisionData.pack()); narc.addFile(targetData.pack()); - narc.addFile(warpData.pack()); + narc.addFile(collOverlayData.pack()); + narc.addFile(locationData.pack()); narc.addFile(npcData.pack()); narc.addFile(monData.pack()); return narc.pack(); } + + public void render(Graphics g) { + //collisionData.render(g); + //collOverlayData.render(g); + locationData.render(g); + targetData.render(g); + npcData.render(g); + monData.render(g); + } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/WarpData.java b/src/com/aurum/almia/game/map/LocationData.java similarity index 58% rename from src/com/aurum/almia/game/map/WarpData.java rename to src/com/aurum/almia/game/map/LocationData.java index bec9779..4352d00 100644 --- a/src/com/aurum/almia/game/map/WarpData.java +++ b/src/com/aurum/almia/game/map/LocationData.java @@ -17,52 +17,56 @@ package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import static com.aurum.almia.game.map.Layer.*; +import com.aurum.almia.util.ByteBuffer; +import java.nio.ByteOrder; +import com.aurum.almia.util.RenderHelper; +import java.awt.Color; +import java.awt.Graphics; import java.util.ArrayList; -import java.util.List; -public class WarpData { +public class LocationData extends AbstractData { public static final int HEADER_SIZE = 0x8; public static final int ENTRY_SIZE = 0xA; - //-------------------------------------------------------------------------- - - public class Entry implements Cloneable { + public class Entry extends AbstractEntry { public short posX; public short posY; - public short unk4; - public short unk6; + public int width; + public int height; public short unk8; public Entry() { + super(LocationData.this); + this.posX = 0; this.posY = 0; - this.unk4 = 0; - this.unk6 = 0; + this.width = 16; + this.height = 16; this.unk8 = 0; } @Override public String toString() { - return String.format("%d, %d", posX, posY); + return String.format("(%d, %d)", posX, posY); + } + + @Override + public void render(Graphics g) { + RenderHelper.drawBox( + g, posX, posY, width, height, + Color.BLACK, new Color(0f, 0f, 1f, 0.5f), + false + ); } } - //-------------------------------------------------------------------------- - - public Layer layer; - public List entries; - - //-------------------------------------------------------------------------- - - public WarpData(Layer layer) { - this.layer = layer; + public LocationData(Layer layer) { + super(layer); + this.entries = new ArrayList(); } - public WarpData(Layer layer, ByteBuffer buf) { + public LocationData(Layer layer, ByteBuffer buf) { this(layer); buf.setEndianness(ByteOrder.LITTLE_ENDIAN); @@ -74,30 +78,47 @@ public class WarpData { e.posX = buf.readShort(); e.posY = buf.readShort(); - e.unk4 = buf.readShort(); - e.unk6 = buf.readShort(); + e.width = buf.readUnsignedShort(); + e.height = buf.readUnsignedShort(); e.unk8 = buf.readShort(); entries.add(e); } } + @Override + public String toString() { + return "Locations"; + } + + @Override public byte[] pack() { int totalsize = HEADER_SIZE + entries.size() * ENTRY_SIZE; ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.LITTLE_ENDIAN); - buf.writeInt(MDATA_WARP); + buf.writeInt(getIdentifier()); buf.writeInt(entries.size()); for (Entry e : entries) { buf.writeShort(e.posX); buf.writeShort(e.posY); - buf.writeShort(e.unk4); - buf.writeShort(e.unk6); + buf.writeUnsignedShort(e.width); + buf.writeUnsignedShort(e.height); buf.writeShort(e.unk8); } return buf.getBuffer(); } + + @Override + public int getIdentifier() { + return Layer.MDATA_LOCATION; + } + + @Override + public void render(Graphics g) { + for (Entry entry : entries) + entry.render(g); + } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/Map.java b/src/com/aurum/almia/game/map/Map.java index c80f1f4..83ce560 100644 --- a/src/com/aurum/almia/game/map/Map.java +++ b/src/com/aurum/almia/game/map/Map.java @@ -17,25 +17,24 @@ package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import com.aurum.almia.Utils; +import com.aurum.almia.util.ByteBuffer; +import java.nio.ByteOrder; import com.aurum.almia.game.Game; -import com.aurum.almia.game.NARC; -import com.aurum.almia.game.NARC.FimgEntry; -import java.io.File; +import com.aurum.almia.game.Narc; +import com.aurum.almia.game.Narc.NarcFile; +import com.aurum.almia.util.IOHelper; +import java.awt.Color; +import java.awt.Graphics; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Map { - public static final int MAP_MPIF = 0x4D504946; - public static final int MAP_TXIF = 0x54584946; - public static final int MAP_LYR = 0x4C595200; - public static final int MAP_CTA = 0x43544100; - public static final int MAP_PLA = 0x504C4100; - - //-------------------------------------------------------------------------- + public static final String MAP_MPIF = "MPIF"; + public static final String MAP_TXIF = "TXIF"; + public static final String MAP_LYR = "LYR\0"; + public static final String MAP_CTA = "CTA\0"; + public static final String MAP_PLA = "PLA\0"; public Game game; public String name; @@ -51,81 +50,82 @@ public class Map { this.mapInfo = new MapInfo(this); this.texInfo = new TextureInfo(this); this.layers = new ArrayList(); + this.cta = null; + this.pla = null; - ByteBuffer buf = Utils.loadFileIntoBuffer(game.getFullPath(String.format("field/map/%s.map.dat.lz", name))); - NARC root = new NARC(buf); - buf.clear(); + Narc root = new Narc(IOHelper.read(game.getFile(String.format("field/map/%s.map.dat.lz", name)))); - for (FimgEntry file : root.files) { - buf = new ByteBuffer(file.data, ByteOrder.BIG_ENDIAN); - - int dataMagic = buf.readInt(); - - buf.setEndianness(ByteOrder.LITTLE_ENDIAN); + for (NarcFile file : root.files) { + ByteBuffer buf = new ByteBuffer(file.data, ByteOrder.LITTLE_ENDIAN); + String dataMagic = buf.readMagic(); switch(dataMagic) { case MAP_MPIF: mapInfo = new MapInfo(this, buf); break; case MAP_TXIF: texInfo = new TextureInfo(this, buf); break; - case MAP_CTA: cta = buf.readRemaining(); break; - case MAP_PLA: pla = buf.readRemaining(); break; + case MAP_CTA: cta = file.data; break; + case MAP_PLA: pla = file.data; break; case MAP_LYR: { - NARC lyr = new NARC(new ByteBuffer(buf.readRemaining())); + Narc lyr = new Narc(buf.readRemaining()); - for (FimgEntry lyrfile : lyr.files) { - layers.add(new Layer(this, new NARC(new ByteBuffer(lyrfile.data)))); - } + for (NarcFile lyrfile : lyr.files) + layers.add(new Layer(this, new Narc(lyrfile.data))); } break; } } } public byte[] pack() { - NARC root = new NARC(); + Narc root = new Narc(); root.addFile(mapInfo.pack()); root.addFile(texInfo.pack()); - NARC lyr = new NARC(); + Narc lyr = new Narc(); - for (Layer layer : layers) { + for (Layer layer : layers) lyr.addFile(layer.pack()); - } byte[] lyrData = lyr.pack(); ByteBuffer lyrBuf = new ByteBuffer(0x4 + lyrData.length); - lyrBuf.writeInt(MAP_LYR); + lyrBuf.writeMagic(MAP_LYR); lyrBuf.writeBytes(lyrData); root.addFile(lyrBuf.getBuffer()); - lyrBuf.clear(); + if (cta != null) + root.addFile(cta); - if (cta != null) { - ByteBuffer ctaBuf = new ByteBuffer(0x4 + cta.length); - - ctaBuf.writeInt(MAP_CTA); - ctaBuf.writeBytes(cta); - - root.addFile(ctaBuf.getBuffer()); - } - - - if (pla != null) { - ByteBuffer plaBuf = new ByteBuffer(0x4 + pla.length); - - plaBuf.writeInt(MAP_PLA); - plaBuf.writeBytes(pla); - - root.addFile(plaBuf.getBuffer()); - } + if (pla != null) + root.addFile(pla); return root.pack(); } public void save() throws IOException { - Utils.saveBytesToFile(pack(), new File(game.getFullPath(String.format("field/map/%s.map.dat.lz", name)))); + IOHelper.write(pack(), game.getFile(String.format("field/map/%s.map.dat.lz", name))); + } + + public void render(Graphics g) throws IOException { + g.setColor(Color.white); + g.fillRect(0, 0, mapInfo.width, mapInfo.height); + + // Draw grid + int gridlX = (mapInfo.width + 16) / 16; + int gridlY = (mapInfo.height + 16) / 16; + + g.setColor(Color.lightGray); + + for (int i = 0 ; i < gridlX ; i++) + g.drawLine(i * 16, 0, i * 16, mapInfo.height - 1); + + for (int i = 0 ; i < gridlY ; i++) + g.drawLine(0, i * 16, mapInfo.width - 1, i * 16); + + // Draw layers + for (Layer layer : layers) + layer.render(g); } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/MapInfo.java b/src/com/aurum/almia/game/map/MapInfo.java index 3657cc5..db4cc0b 100644 --- a/src/com/aurum/almia/game/map/MapInfo.java +++ b/src/com/aurum/almia/game/map/MapInfo.java @@ -1,21 +1,16 @@ package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import static com.aurum.almia.game.map.Map.*; +import com.aurum.almia.util.ByteBuffer; +import java.nio.ByteOrder; public class MapInfo { public static final int FILE_SIZE = 0x14; - //-------------------------------------------------------------------------- - - public Map map; + public final Map map; public int width; public int height; public int unk8; public int unkC; - - //-------------------------------------------------------------------------- public MapInfo(Map map) { this.map = map; @@ -34,10 +29,15 @@ public class MapInfo { this.unkC = buf.readInt(); } + @Override + public String toString() { + return "Map Info"; + } + public byte[] pack() { ByteBuffer buf = new ByteBuffer(FILE_SIZE); - buf.writeInt(MAP_MPIF); + buf.writeMagic(Map.MAP_MPIF); buf.setEndianness(ByteOrder.LITTLE_ENDIAN); buf.writeInt(width); buf.writeInt(height); diff --git a/src/com/aurum/almia/game/map/MonData.java b/src/com/aurum/almia/game/map/MonData.java index 71e28eb..d23e4f9 100644 --- a/src/com/aurum/almia/game/map/MonData.java +++ b/src/com/aurum/almia/game/map/MonData.java @@ -17,32 +17,36 @@ package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import static com.aurum.almia.game.map.Layer.*; +import com.aurum.almia.util.ByteBuffer; +import java.nio.ByteOrder; +import com.aurum.almia.util.RenderHelper; +import com.aurum.almia.Resources; +import com.aurum.almia.game.param.PokeID; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.image.BufferedImage; import java.util.ArrayList; -import java.util.List; -public class MonData { +public class MonData extends AbstractData { public static final int HEADER_SIZE = 0x8; public static final int ENTRY_SIZE = 0xA; - //-------------------------------------------------------------------------- - - public class Entry implements Cloneable { + public class Entry extends AbstractEntry { public short posX; public short posY; - public short behavior; // unsigned byte - public byte enabled; // possibly boolean - public int monID; // unsigned short + public short behavior; // unsigned byte + public short appearance; // unsigned byte + public int monID; // unsigned short public byte unk8; public byte unk9; public Entry() { + super(MonData.this); + this.posX = 0; this.posY = 0; this.behavior = 0; - this.enabled = 1; + this.appearance = 1; this.monID = 0; this.unk8 = 0; this.unk9 = 0; @@ -50,19 +54,30 @@ public class MonData { @Override public String toString() { - return String.format("%03X: %s", monID, layer.map.game.monDataBase.entries.get(monID).toShortString()); + return layer.map.game.getPokemonList().get(monID); + } + + @Override + public void render(Graphics g) { + PokeID.Entry monid = layer.map.game.monDataBase.entries.get(monID); + BufferedImage img = Resources.getMonImg(monid.nameID, monid.formID); + int x = posX - 48; + int y = posY - 48; + + if (img == null) + RenderHelper.drawBox( + g, posX, posY, 16, 16, + Color.BLACK, new Color(1f, 0f, 0f, 0.5f), + true + ); + else + g.drawImage(img, x, y, null); } } - //-------------------------------------------------------------------------- - - public Layer layer; - public List entries; - - //-------------------------------------------------------------------------- - public MonData(Layer layer) { - this.layer = layer; + super(layer); + this.entries = new ArrayList(); } @@ -79,7 +94,7 @@ public class MonData { e.posX = buf.readShort(); e.posY = buf.readShort(); e.behavior = buf.readUnsignedByte(); - e.enabled = buf.readByte(); + e.appearance = buf.readUnsignedByte(); e.monID = buf.readUnsignedShort(); e.unk8 = buf.readByte(); e.unk9 = buf.readByte(); @@ -88,19 +103,25 @@ public class MonData { } } + @Override + public String toString() { + return "Pokémon"; + } + + @Override public byte[] pack() { int totalsize = HEADER_SIZE + entries.size() * ENTRY_SIZE; ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.LITTLE_ENDIAN); - buf.writeInt(MDATA_MON); + buf.writeInt(getIdentifier()); buf.writeInt(entries.size()); for (Entry e : entries) { buf.writeShort(e.posX); buf.writeShort(e.posY); buf.writeUnsignedByte(e.behavior); - buf.writeByte(e.enabled); + buf.writeUnsignedByte(e.appearance); buf.writeUnsignedShort(e.monID); buf.writeByte(e.unk8); buf.writeByte(e.unk9); @@ -108,4 +129,15 @@ public class MonData { return buf.getBuffer(); } + + @Override + public int getIdentifier() { + return Layer.MDATA_MON; + } + + @Override + public void render(Graphics g) { + for (Entry entry : entries) + entry.render(g); + } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/NpcData.java b/src/com/aurum/almia/game/map/NpcData.java index 983ceee..1737bc3 100644 --- a/src/com/aurum/almia/game/map/NpcData.java +++ b/src/com/aurum/almia/game/map/NpcData.java @@ -17,19 +17,20 @@ package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import static com.aurum.almia.game.map.Layer.*; +import com.aurum.almia.util.ByteBuffer; +import java.nio.ByteOrder; +import com.aurum.almia.util.RenderHelper; +import com.aurum.almia.Resources; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.image.BufferedImage; import java.util.ArrayList; -import java.util.List; -public class NpcData { +public class NpcData extends AbstractData { public static final int HEADER_SIZE = 0x8; public static final int ENTRY_SIZE = 0xB; - //-------------------------------------------------------------------------- - - public class Entry implements Cloneable { + public class Entry extends AbstractEntry { public short posX; public short posY; public short direction; // unsigned byte @@ -40,6 +41,8 @@ public class NpcData { public boolean unkA; public Entry() { + super(NpcData.this); + this.posX = 0; this.posY = 0; this.direction = 0; @@ -52,19 +55,30 @@ public class NpcData { @Override public String toString() { - return String.format("%03X", npcID); + return layer.map.game.getNpcList().get(npcID); + } + + @Override + public void render(Graphics g) { + BufferedImage img = Resources.getNpcImg(npcID); + + if (img == null) + RenderHelper.drawBox( + g, posX, posY, 16, 16, + Color.BLACK, new Color(1f, 1f, 0f, 0.5f), + true + ); + else { + img = img.getSubimage((img.getWidth() / 4) * (direction % 0x3), 0, img.getWidth() / 4, img.getHeight()); + + g.drawImage(img, posX - (img.getWidth() / 2), posY - (img.getHeight() / 2), null); + } } } - //-------------------------------------------------------------------------- - - public Layer layer; - public List entries; - - //-------------------------------------------------------------------------- - public NpcData(Layer layer) { - this.layer = layer; + super(layer); + this.entries = new ArrayList(); } @@ -91,12 +105,18 @@ public class NpcData { } } + @Override + public String toString() { + return "NPCs"; + } + + @Override public byte[] pack() { int totalsize = HEADER_SIZE + entries.size() * ENTRY_SIZE; ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.LITTLE_ENDIAN); - buf.writeInt(MDATA_NPC); + buf.writeInt(getIdentifier()); buf.writeInt(entries.size()); for (Entry e : entries) { @@ -112,4 +132,15 @@ public class NpcData { return buf.getBuffer(); } + + @Override + public int getIdentifier() { + return Layer.MDATA_NPC; + } + + @Override + public void render(Graphics g) { + for (Entry entry : entries) + entry.render(g); + } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/TargetData.java b/src/com/aurum/almia/game/map/TargetData.java index 5585486..76d0cbb 100644 --- a/src/com/aurum/almia/game/map/TargetData.java +++ b/src/com/aurum/almia/game/map/TargetData.java @@ -17,20 +17,20 @@ package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import com.aurum.almia.Lists; -import static com.aurum.almia.game.map.Layer.MDATA_TARGET; +import com.aurum.almia.util.ByteBuffer; +import java.nio.ByteOrder; +import com.aurum.almia.util.RenderHelper; +import com.aurum.almia.Resources; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.image.BufferedImage; import java.util.ArrayList; -import java.util.List; -public class TargetData { +public class TargetData extends AbstractData { public static final int HEADER_SIZE = 0x8; public static final int ENTRY_SIZE = 0xC; - //-------------------------------------------------------------------------- - - public class Entry implements Cloneable { + public class Entry extends AbstractEntry { public short posX; public short posY; public byte unk4; @@ -42,6 +42,8 @@ public class TargetData { public byte unkB; public Entry() { + super(TargetData.this); + this.posX = 0; this.posY = 0; this.unk4 = 0; @@ -55,19 +57,27 @@ public class TargetData { @Override public String toString() { - return String.format("%03X: %s", obstacleID, Lists.obstacles.get(obstacleID)); + return layer.map.game.getTargetList().get(obstacleID); + } + + @Override + public void render(Graphics g) { + BufferedImage img = Resources.getTargetImg(obstacleID); + + if (img == null) + RenderHelper.drawBox( + g, posX, posY, 16, 16, + Color.BLACK, new Color(0f, 1f, 0f, 0.5f), + true + ); + else + g.drawImage(img, posX - (img.getWidth() / 2), posY - (img.getHeight() / 2), null); } } - //-------------------------------------------------------------------------- - - public Layer layer; - public List entries; - - //-------------------------------------------------------------------------- - public TargetData(Layer layer) { - this.layer = layer; + super(layer); + this.entries = new ArrayList(); } @@ -95,12 +105,18 @@ public class TargetData { } } + @Override + public String toString() { + return "Targets"; + } + + @Override public byte[] pack() { int totalsize = HEADER_SIZE + entries.size() * ENTRY_SIZE; ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.LITTLE_ENDIAN); - buf.writeInt(MDATA_TARGET); + buf.writeInt(getIdentifier()); buf.writeInt(entries.size()); for (Entry e : entries) { @@ -117,4 +133,15 @@ public class TargetData { return buf.getBuffer(); } + + @Override + public int getIdentifier() { + return Layer.MDATA_TARGET; + } + + @Override + public void render(Graphics g) { + for (Entry entry : entries) + entry.render(g); + } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/map/TextureInfo.java b/src/com/aurum/almia/game/map/TextureInfo.java index cbc0384..f39da84 100644 --- a/src/com/aurum/almia/game/map/TextureInfo.java +++ b/src/com/aurum/almia/game/map/TextureInfo.java @@ -1,24 +1,40 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package com.aurum.almia.game.map; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import static com.aurum.almia.game.map.Map.*; +import com.aurum.almia.util.ByteBuffer; +import java.awt.Graphics; +import java.nio.ByteOrder; import java.util.ArrayList; -import java.util.List; -public class TextureInfo { +public class TextureInfo extends AbstractData { public static final int HEADER_SIZE = 0x8; public static final int ENTRY_SIZE = 0x8; - //-------------------------------------------------------------------------- - - public class Entry { + public class Entry extends AbstractEntry { public short unk0; public int textureID; // unsigned short public short unk4; public short unk6; public Entry() { + super(TextureInfo.this); + this.unk0 = 1; this.textureID = 0; this.unk4 = 0; @@ -31,15 +47,12 @@ public class TextureInfo { } } - //-------------------------------------------------------------------------- - - public Map map; - public List entries; + public final Map map; public short unk2; - //-------------------------------------------------------------------------- - public TextureInfo(Map map) { + super(null); + this.map = map; this.entries = new ArrayList(); this.unk2 = 0; @@ -49,7 +62,7 @@ public class TextureInfo { this(map); int numEntries = buf.readUnsignedShort(); - unk2 = buf.readShort(); + this.unk2 = buf.readShort(); for (int i = 0 ; i < numEntries ; i++) { Entry e = new Entry(); @@ -58,15 +71,21 @@ public class TextureInfo { e.textureID = buf.readUnsignedShort(); e.unk4 = buf.readShort(); e.unk6 = buf.readShort(); - + entries.add(e); } } + @Override + public String toString() { + return "Texture Info"; + } + + @Override public byte[] pack() { ByteBuffer buf = new ByteBuffer(HEADER_SIZE + entries.size() * ENTRY_SIZE); - buf.writeInt(MAP_TXIF); + buf.writeMagic(Map.MAP_TXIF); buf.setEndianness(ByteOrder.LITTLE_ENDIAN); buf.writeUnsignedShort(entries.size()); buf.writeShort(unk2); @@ -80,4 +99,12 @@ public class TextureInfo { return buf.getBuffer(); } + + @Override + public int getIdentifier() { + return -1; + } + + @Override + public void render(Graphics g) {} } \ No newline at end of file diff --git a/src/com/aurum/almia/game/param/BattlePokemon.java b/src/com/aurum/almia/game/param/BattlePokemon.java index feab309..b8db814 100644 --- a/src/com/aurum/almia/game/param/BattlePokemon.java +++ b/src/com/aurum/almia/game/param/BattlePokemon.java @@ -17,20 +17,26 @@ package com.aurum.almia.game.param; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; -import com.aurum.almia.Utils; +import com.aurum.almia.util.ByteBuffer; import com.aurum.almia.game.Game; -import java.io.File; +import com.aurum.almia.util.IOHelper; import java.io.IOException; +import java.nio.ByteOrder; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class BattlePokemon { public static final int HEADER_SIZE = 0x10; public static final int ENTRY_SIZE = 0x18; - - //-------------------------------------------------------------------------- + private static final byte[] UNIQUE = { + (byte)0x07, (byte)0x01, (byte)0x03, (byte)0x03, + (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x01, + (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x03, + (byte)0x01, (byte)0x02, (byte)0x02, (byte)0x02, + (byte)0x02, (byte)0x02, (byte)0x02, (byte)0x02, + (byte)0x01, (byte)0x01 + }; public static class Entry implements Cloneable { public byte[] unk0; @@ -41,41 +47,34 @@ public class BattlePokemon { @Override public String toString() { - return super.toString(); + return Arrays.toString(unk0); } } - //-------------------------------------------------------------------------- - public Game game; public List entries; - public byte[] unique; public int unkC; - //-------------------------------------------------------------------------- - - public BattlePokemon(Game game) { + public BattlePokemon(Game game) throws IOException { this.game = game; this.entries = new ArrayList(); - this.unique = new byte[0x0]; - this.unkC = 0x0; - } - - public BattlePokemon(Game game, ByteBuffer buf) { - this(game); + ByteBuffer buf = ByteBuffer.read(game.getFile("param/BattlePokemon.bin")); buf.setEndianness(ByteOrder.LITTLE_ENDIAN); - int totalsize = buf.readInt(); - if (buf.size() != totalsize) { + int totalSize = buf.readInt(); + if (buf.size() != totalSize) System.out.println("BattlePokemon: Warning! Stored size does not equal actual buffer size!"); - } - int uniquesize = buf.readInt(); - int datasize = buf.readInt(); - unkC = buf.readInt(); - unique = buf.readBytes(uniquesize); - int entriesCount = datasize / ENTRY_SIZE; + int uniqueSize = buf.readInt(); + int dataSize = buf.readInt(); + this.unkC = buf.readInt(); + + byte[] unique = buf.readBytes(uniqueSize); + if (!Arrays.equals(unique, UNIQUE)) + System.out.println("PokeID: Warning! Are you sure this is PokeID data?"); + + int entriesCount = dataSize / ENTRY_SIZE; for (int i = 0 ; i < entriesCount ; i++) { Entry e = new Entry(); @@ -87,24 +86,23 @@ public class BattlePokemon { } public byte[] pack() { - int datasize = entries.size() * ENTRY_SIZE; - int totalsize = HEADER_SIZE + unique.length + datasize; + int dataSize = entries.size() * ENTRY_SIZE; + int totalSize = HEADER_SIZE + UNIQUE.length + dataSize; - ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.LITTLE_ENDIAN); - buf.writeInt(totalsize); - buf.writeInt(unique.length); - buf.writeInt(datasize); + ByteBuffer buf = new ByteBuffer(totalSize, ByteOrder.LITTLE_ENDIAN); + buf.writeInt(totalSize); + buf.writeInt(UNIQUE.length); + buf.writeInt(dataSize); buf.writeInt(unkC); - buf.writeBytes(unique); + buf.writeBytes(UNIQUE); - for (Entry e : entries) { + for (Entry e : entries) buf.writeBytes(e.unk0); - } return buf.getBuffer(); } public void save() throws IOException { - Utils.saveBytesToFile(pack(), new File(game.getFullPath("param/BattlePokemon.bin"))); + IOHelper.write(pack(), game.getFile("param/BattlePokemon.bin")); } } \ No newline at end of file diff --git a/src/com/aurum/almia/game/param/PokeID.java b/src/com/aurum/almia/game/param/PokeID.java index 87da3d2..110b3de 100644 --- a/src/com/aurum/almia/game/param/PokeID.java +++ b/src/com/aurum/almia/game/param/PokeID.java @@ -17,21 +17,27 @@ package com.aurum.almia.game.param; -import com.aurum.almia.ByteBuffer; -import com.aurum.almia.ByteOrder; +import com.aurum.almia.util.ByteBuffer; import com.aurum.almia.Lists; -import com.aurum.almia.Utils; import com.aurum.almia.game.Game; -import java.io.File; +import com.aurum.almia.util.IOHelper; import java.io.IOException; +import java.nio.ByteOrder; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class PokeID { public static final int HEADER_SIZE = 0x10; public static final int ENTRY_SIZE = 0x1C; - - //-------------------------------------------------------------------------- + private static final byte[] UNIQUE = { + (byte)0x07, (byte)0x03, (byte)0x01, (byte)0x07, + (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, + (byte)0x02, (byte)0x02, (byte)0x01, (byte)0x02, + (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, + (byte)0x02, (byte)0x01, (byte)0x01, (byte)0x02, + (byte)0x02, (byte)0x03, (byte)0x03, (byte)0x05 + }; public class Entry implements Cloneable { public int nameID; // unsigned short @@ -40,17 +46,17 @@ public class PokeID { public short assistID; // unsigned byte public short fieldID; // unsigned byte public short fieldLevel; // unsigned byte - public byte unk7; + public byte unk7; // always 0 public int unk8; // unsigned short public int unkA; // unsigned short public short shadowWidth; // unsigned byte public short shadowHeight; // unsigned byte public byte unkE; public byte unkF; - public int unk10; + public int unk10; // always 0 public int unk14; // unsigned short public int unk16; // unsigned short - public int unk18; + public int unk18; // 0, 1 or 100 public Entry() { this.nameID = 0; @@ -74,7 +80,13 @@ public class PokeID { @Override public String toString() { - return String.format("%s (%s, %s x%d)", Lists.pokemon_name.get(nameID), Lists.assist_mes.get(assistID), Lists.fieldwaza_name.get(fieldID), fieldLevel); + return String.format( + "%s (%s, %s x%d)", + Lists.pokemon_name.get(nameID), + Lists.assist_mes.get(assistID), + Lists.fieldwaza_name.get(fieldID), + fieldLevel + ); } public String toShortString() { @@ -82,37 +94,30 @@ public class PokeID { } } - //-------------------------------------------------------------------------- - public Game game; public List entries; - public byte[] unique; public int unkC; - //-------------------------------------------------------------------------- - - public PokeID(Game game) { + public PokeID(Game game) throws IOException { this.game = game; this.entries = new ArrayList(); - this.unique = new byte[0x0]; - this.unkC = 0x0; - } - - public PokeID(Game game, ByteBuffer buf) { - this(game); + ByteBuffer buf = ByteBuffer.read(game.getFile("param/PokeID.bin")); buf.setEndianness(ByteOrder.LITTLE_ENDIAN); - int totalsize = buf.readInt(); - if (buf.size() != totalsize) { + int totalSize = buf.readInt(); + if (buf.size() != totalSize) System.out.println("PokeID: Warning! Stored size does not equal actual buffer size!"); - } - int uniquesize = buf.readInt(); - int datasize = buf.readInt(); - unkC = buf.readInt(); - unique = buf.readBytes(uniquesize); - int entriesCount = datasize / ENTRY_SIZE; + int uniqueSize = buf.readInt(); + int dataSize = buf.readInt(); + this.unkC = buf.readInt(); + + byte[] unique = buf.readBytes(uniqueSize); + if (!Arrays.equals(unique, UNIQUE)) + System.out.println("PokeID: Warning! Are you sure this is PokeID data?"); + + int entriesCount = dataSize / ENTRY_SIZE; for (int i = 0 ; i < entriesCount ; i++) { Entry e = new Entry(); @@ -140,15 +145,16 @@ public class PokeID { } public byte[] pack() { - int datasize = entries.size() * ENTRY_SIZE; - int totalsize = HEADER_SIZE + unique.length + datasize; + int dataSize = entries.size() * ENTRY_SIZE; + int totalSize = HEADER_SIZE + UNIQUE.length + dataSize; - ByteBuffer buf = new ByteBuffer(totalsize, ByteOrder.LITTLE_ENDIAN); - buf.writeInt(totalsize); - buf.writeInt(unique.length); - buf.writeInt(datasize); + ByteBuffer buf = new ByteBuffer(totalSize, ByteOrder.LITTLE_ENDIAN); + + buf.writeInt(totalSize); + buf.writeInt(UNIQUE.length); + buf.writeInt(dataSize); buf.writeInt(unkC); - buf.writeBytes(unique); + buf.writeBytes(UNIQUE); for (Entry e : entries) { buf.writeUnsignedShort(e.nameID); @@ -174,6 +180,6 @@ public class PokeID { } public void save() throws IOException { - Utils.saveBytesToFile(pack(), new File(game.getFullPath("param/PokeID.bin"))); + IOHelper.write(pack(), game.getFile("param/PokeID.bin")); } } \ No newline at end of file diff --git a/src/com/aurum/almia/swing/MapEditor.form b/src/com/aurum/almia/swing/MapEditor.form deleted file mode 100644 index 2fe5ce5..0000000 --- a/src/com/aurum/almia/swing/MapEditor.form +++ /dev/null @@ -1,1694 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/com/aurum/almia/swing/MapEditor.java b/src/com/aurum/almia/swing/MapEditor.java deleted file mode 100644 index beb1375..0000000 --- a/src/com/aurum/almia/swing/MapEditor.java +++ /dev/null @@ -1,1968 +0,0 @@ -/* - * Copyright (C) 2018 Aurum - * - * AlmiaE is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * AlmiaE is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.aurum.almia.swing; - -import com.aurum.almia.Lists; -import com.aurum.almia.Main; -import com.aurum.almia.game.map.Layer; -import com.aurum.almia.game.map.Map; -import com.aurum.almia.game.map.MapInfo; -import com.aurum.almia.game.map.MonData; -import com.aurum.almia.game.map.NpcData; -import com.aurum.almia.game.map.TargetData; -import com.aurum.almia.game.map.TextureInfo; -import com.aurum.almia.game.map.WarpData; -import java.io.IOException; -import javax.swing.DefaultListModel; -import javax.swing.JFrame; -import javax.swing.SpinnerNumberModel; - -public class MapEditor extends JFrame { - public Map map; - - protected DefaultListModel modelTexInfo; - protected DefaultListModel modelWarps; - protected DefaultListModel modelMons; - protected DefaultListModel modelTargets; - protected DefaultListModel modelNpcs; - - public MapEditor(Map map) { - initComponents(); - - this.map = map; - - initGUI(); - initData(); - } - - protected void initGUI() { - modelTexInfo = new DefaultListModel(); - modelWarps = new DefaultListModel(); - modelMons = new DefaultListModel(); - modelTargets = new DefaultListModel(); - modelNpcs = new DefaultListModel(); - - setTitle(String.format("Map Editor: Editing %s", map.name)); - updateLayers(); - - listTexInfo.setModel(modelTexInfo); - listWarps.setModel(modelWarps); - listMons.setModel(modelMons); - listTargets.setModel(modelTargets); - listNpcs.setModel(modelNpcs); - - for (int i = 0 ; i < map.game.monDataBase.entries.size() ; i++) { - cmoMonDataMon.addItem(String.format("%03X: %s", i, map.game.monDataBase.entries.get(i).toShortString())); - } - - for (int i = 0 ; i < Lists.yakumono_name.size() ; i++) { - cmoTargetID.addItem(String.format("%03X: %s", i, Lists.obstacles.get(i))); - } - } - - protected void initData() { - spnMapInfoWidth.setValue(map.mapInfo.width); - spnMapInfoHeight.setValue(map.mapInfo.height); - spnMapInfoUnk8.setValue(map.mapInfo.unk8); - spnMapInfoUnkC.setValue(map.mapInfo.unkC); - spnTexInfoUnk2.setValue(map.texInfo.unk2); - - reloadTexInfoUI(); - reloadLayer(); - } - - protected void reloadLayer() { - modelWarps.clear(); - - for (WarpData.Entry warp : getCurLayer().warpData.entries) { - modelWarps.addElement(warp.toString()); - } - - reloadWarpUI(); - - - modelMons.clear(); - - for (MonData.Entry mon : getCurLayer().monData.entries) { - modelMons.addElement(mon.toString()); - } - - reloadMonUI(); - - - modelTargets.clear(); - - for (TargetData.Entry target : getCurLayer().targetData.entries) { - modelTargets.addElement(target.toString()); - } - - reloadTargetUI(); - - - modelNpcs.clear(); - - for (NpcData.Entry npc : getCurLayer().npcData.entries) { - modelNpcs.addElement(npc.toString()); - } - - reloadNpcUI(); - } - - protected void reloadTexInfoUI() { - modelTexInfo.clear(); - - for (int i = 0 ; i < map.texInfo.entries.size() ; i++) { - modelTexInfo.addElement(String.format("Texture Info No. %d", i)); - } - - boolean b = map.texInfo.entries.size() > 0; - listTexInfo.setEnabled(b); - spnTexInfoUnk0.setEnabled(b); - spnTexInfoTextureID.setEnabled(b); - spnTexInfoUnk4.setEnabled(b); - spnTexInfoUnk6.setEnabled(b); - } - - protected void reloadWarpUI() { - boolean b = getCurLayer().warpData.entries.size() > 0; - listWarps.setEnabled(b); - spnWarpPosX.setEnabled(b); - spnWarpPosY.setEnabled(b); - spnWarpUnk4.setEnabled(b); - spnWarpUnk6.setEnabled(b); - spnWarpUnk8.setEnabled(b); - } - - protected void reloadMonUI() { - boolean b = getCurLayer().monData.entries.size() > 0; - listMons.setEnabled(b); - spnMonDataPosX.setEnabled(b); - spnMonDataPosY.setEnabled(b); - spnMonDataBehavior.setEnabled(b); - spnMonDataUnk5.setEnabled(b); - cmoMonDataMon.setEnabled(b); - spnMonDataUnk8.setEnabled(b); - spnMonDataUnk9a.setEnabled(b); - } - - protected void reloadTargetUI() { - boolean b = getCurLayer().targetData.entries.size() > 0; - listTargets.setEnabled(b); - spnTargetPosX.setEnabled(b); - spnTargetPosY.setEnabled(b); - spnTargetUnk4.setEnabled(b); - spnTargetUnk5.setEnabled(b); - cmoTargetID.setEnabled(b); - spnTargetUnk8.setEnabled(b); - spnTargetUnk9.setEnabled(b); - spnTargetUnkA.setEnabled(b); - spnTargetUnkB.setEnabled(b); - } - - protected void reloadNpcUI() { - boolean b = getCurLayer().npcData.entries.size() > 0; - listNpcs.setEnabled(b); - spnNpcPosX.setEnabled(b); - spnNpcPosY.setEnabled(b); - cmoNpcDirection.setEnabled(b); - chkNpcIsVisible.setEnabled(b); - spnNpcID.setEnabled(b); - spnNpcUnk8.setEnabled(b); - spnNpcUnk9.setEnabled(b); - chkNpcUnkA.setEnabled(b); - } - - public void saveAll() { - MapInfo mapinfo = map.mapInfo; - mapinfo.width = (int)spnMapInfoWidth.getValue(); - mapinfo.height = (int)spnMapInfoHeight.getValue(); - mapinfo.unk8 = (int)spnMapInfoUnk8.getValue(); - mapinfo.unkC = (int)spnMapInfoUnkC.getValue(); - - map.texInfo.unk2 = (short)spnTexInfoUnk2.getValue(); - - try { - map.save(); - } - catch (IOException ex) { - System.out.println(ex); - } - } - - protected Layer getCurLayer() { - return map.layers.get((int)spnSelectedLayer.getValue()); - } - - protected void updateLayers() { - int numLayers = map.layers.size(); - - if (numLayers > 0) { - spnSelectedLayer.setValue(0); - ((SpinnerNumberModel)spnSelectedLayer.getModel()).setMaximum(numLayers - 1); - } - else { - spnSelectedLayer.setValue(-1); - ((SpinnerNumberModel)spnSelectedLayer.getModel()).setMinimum(-1); - ((SpinnerNumberModel)spnSelectedLayer.getModel()).setMaximum(-1); - } - - } - - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - java.awt.GridBagConstraints gridBagConstraints; - - toolbar = new javax.swing.JToolBar(); - saveAllButton = new javax.swing.JButton(); - jSeparator2 = new javax.swing.JToolBar.Separator(); - lblSelectedLayer = new javax.swing.JLabel(); - spnSelectedLayer = new javax.swing.JSpinner(); - jSeparator3 = new javax.swing.JToolBar.Separator(); - btnLayerAdd = new javax.swing.JButton(); - jSeparator4 = new javax.swing.JToolBar.Separator(); - btnLayerDelete = new javax.swing.JButton(); - filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)); - tabPane = new javax.swing.JTabbedPane(); - pneMapInfo = new javax.swing.JPanel(); - lblMapInfoWidth = new javax.swing.JLabel(); - lblMapInfoHeight = new javax.swing.JLabel(); - lblMapInfoUnk8 = new javax.swing.JLabel(); - lblMapInfoUnkC = new javax.swing.JLabel(); - spnMapInfoWidth = new javax.swing.JSpinner(); - spnMapInfoHeight = new javax.swing.JSpinner(); - spnMapInfoUnk8 = new javax.swing.JSpinner(); - spnMapInfoUnkC = new javax.swing.JSpinner(); - jSeparator1 = new javax.swing.JSeparator(); - lblTexInfoUnk2 = new javax.swing.JLabel(); - spnTexInfoUnk2 = new javax.swing.JSpinner(); - pneTexInfo = new javax.swing.JPanel(); - scrTexInfo = new javax.swing.JScrollPane(); - listTexInfo = new javax.swing.JList<>(); - pneTexInfoSettings = new javax.swing.JPanel(); - lblTexInfoUnk0 = new javax.swing.JLabel(); - lblTexInfoID = new javax.swing.JLabel(); - lblTexInfoUnk4 = new javax.swing.JLabel(); - lblTexInfoUnk6 = new javax.swing.JLabel(); - spnTexInfoUnk0 = new javax.swing.JSpinner(); - spnTexInfoTextureID = new javax.swing.JSpinner(); - spnTexInfoUnk4 = new javax.swing.JSpinner(); - spnTexInfoUnk6 = new javax.swing.JSpinner(); - filler3 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); - btnTexInfoSave = new javax.swing.JButton(); - btnTexInfoAdd = new javax.swing.JButton(); - btnTexInfoRemove = new javax.swing.JButton(); - pneWarps = new javax.swing.JPanel(); - scrWarps = new javax.swing.JScrollPane(); - listWarps = new javax.swing.JList<>(); - pneWarpSettings = new javax.swing.JPanel(); - lblWarpPosX = new javax.swing.JLabel(); - lblWarpPosY = new javax.swing.JLabel(); - lblWarpUnk4 = new javax.swing.JLabel(); - lblWarpUnk6 = new javax.swing.JLabel(); - lblWarpUnk8 = new javax.swing.JLabel(); - spnWarpPosX = new javax.swing.JSpinner(); - spnWarpPosY = new javax.swing.JSpinner(); - spnWarpUnk4 = new javax.swing.JSpinner(); - spnWarpUnk6 = new javax.swing.JSpinner(); - spnWarpUnk8 = new javax.swing.JSpinner(); - fillerWarp = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); - btnWarpSave = new javax.swing.JButton(); - btnWarpAdd = new javax.swing.JButton(); - btnWarpRemove = new javax.swing.JButton(); - pneTargets = new javax.swing.JPanel(); - scrTargets = new javax.swing.JScrollPane(); - listTargets = new javax.swing.JList<>(); - pneTargetSettings = new javax.swing.JPanel(); - lblTargetPosX = new javax.swing.JLabel(); - lblTargetPosY = new javax.swing.JLabel(); - lblTargetUnk4 = new javax.swing.JLabel(); - lblTargetUnk5 = new javax.swing.JLabel(); - lblTargetID = new javax.swing.JLabel(); - lblTargetUnk8 = new javax.swing.JLabel(); - lblTargetUnk9 = new javax.swing.JLabel(); - lblTargetUnkA = new javax.swing.JLabel(); - lblTargetUnkB = new javax.swing.JLabel(); - spnTargetPosX = new javax.swing.JSpinner(); - spnTargetPosY = new javax.swing.JSpinner(); - spnTargetUnk4 = new javax.swing.JSpinner(); - spnTargetUnk5 = new javax.swing.JSpinner(); - cmoTargetID = new javax.swing.JComboBox<>(); - spnTargetUnk8 = new javax.swing.JSpinner(); - spnTargetUnk9 = new javax.swing.JSpinner(); - spnTargetUnkA = new javax.swing.JSpinner(); - spnTargetUnkB = new javax.swing.JSpinner(); - fillerTarget = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); - btnTargetSave = new javax.swing.JButton(); - btnTargetAdd = new javax.swing.JButton(); - btnTargetRemove = new javax.swing.JButton(); - pneMons = new javax.swing.JPanel(); - scrMons = new javax.swing.JScrollPane(); - listMons = new javax.swing.JList<>(); - pneMonSettings = new javax.swing.JPanel(); - lblMonDataPosX = new javax.swing.JLabel(); - lblMonDataPosY = new javax.swing.JLabel(); - lblMonDataBehavior = new javax.swing.JLabel(); - lblMonDataUnk5 = new javax.swing.JLabel(); - lblMonDataMon = new javax.swing.JLabel(); - lblMonDataUnk8 = new javax.swing.JLabel(); - lblMonDataUnk9a = new javax.swing.JLabel(); - spnMonDataPosX = new javax.swing.JSpinner(); - spnMonDataPosY = new javax.swing.JSpinner(); - spnMonDataBehavior = new javax.swing.JSpinner(); - spnMonDataUnk5 = new javax.swing.JSpinner(); - cmoMonDataMon = new javax.swing.JComboBox<>(); - spnMonDataUnk8 = new javax.swing.JSpinner(); - spnMonDataUnk9a = new javax.swing.JSpinner(); - filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); - btnMonSave = new javax.swing.JButton(); - btnMonAdd = new javax.swing.JButton(); - btnMonRemove = new javax.swing.JButton(); - pneNpcs = new javax.swing.JPanel(); - scrNpcs = new javax.swing.JScrollPane(); - listNpcs = new javax.swing.JList<>(); - pneNpcSettings = new javax.swing.JPanel(); - lblNpcPosX = new javax.swing.JLabel(); - lblNpcPosY = new javax.swing.JLabel(); - lblNpcDirection = new javax.swing.JLabel(); - lblNpcNpc = new javax.swing.JLabel(); - lblNpcUnk8 = new javax.swing.JLabel(); - lblNpcUnk9 = new javax.swing.JLabel(); - spnNpcPosX = new javax.swing.JSpinner(); - spnNpcPosY = new javax.swing.JSpinner(); - cmoNpcDirection = new javax.swing.JComboBox<>(); - chkNpcIsVisible = new javax.swing.JCheckBox(); - spnNpcID = new javax.swing.JSpinner(); - spnNpcUnk8 = new javax.swing.JSpinner(); - spnNpcUnk9 = new javax.swing.JSpinner(); - chkNpcUnkA = new javax.swing.JCheckBox(); - fillerNpc = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767)); - btnNpcSave = new javax.swing.JButton(); - btnNpcAdd = new javax.swing.JButton(); - btnNpcRemove = new javax.swing.JButton(); - warningLabel = new javax.swing.JLabel(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("Map Editor: Editing "); - setIconImage(Main.icon); - setResizable(false); - - toolbar.setFloatable(false); - toolbar.setRollover(true); - - saveAllButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/tl_save.png"))); // NOI18N - saveAllButton.setText("Save all data"); - saveAllButton.setFocusable(false); - saveAllButton.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); - saveAllButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - saveAllButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - saveAllButtonActionPerformed(evt); - } - }); - toolbar.add(saveAllButton); - toolbar.add(jSeparator2); - - lblSelectedLayer.setText("Selected layer: "); - toolbar.add(lblSelectedLayer); - - spnSelectedLayer.setModel(new javax.swing.SpinnerNumberModel(0, 0, 0, 1)); - spnSelectedLayer.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { - spnSelectedLayerStateChanged(evt); - } - }); - toolbar.add(spnSelectedLayer); - toolbar.add(jSeparator3); - - btnLayerAdd.setText("Add"); - btnLayerAdd.setFocusable(false); - btnLayerAdd.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnLayerAdd.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnLayerAdd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnLayerAddActionPerformed(evt); - } - }); - toolbar.add(btnLayerAdd); - toolbar.add(jSeparator4); - - btnLayerDelete.setText("Delete"); - btnLayerDelete.setFocusable(false); - btnLayerDelete.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - btnLayerDelete.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); - btnLayerDelete.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnLayerDeleteActionPerformed(evt); - } - }); - toolbar.add(btnLayerDelete); - toolbar.add(filler1); - - lblMapInfoWidth.setText("Map width"); - - lblMapInfoHeight.setText("Map height"); - - lblMapInfoUnk8.setText("int (0x8)"); - - lblMapInfoUnkC.setText("int (0xC)"); - - spnMapInfoWidth.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - - spnMapInfoHeight.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - - spnMapInfoUnk8.setModel(new javax.swing.SpinnerNumberModel()); - - spnMapInfoUnkC.setModel(new javax.swing.SpinnerNumberModel()); - - lblTexInfoUnk2.setText("short (TXIF 0x2)"); - - spnTexInfoUnk2.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - - javax.swing.GroupLayout pneMapInfoLayout = new javax.swing.GroupLayout(pneMapInfo); - pneMapInfo.setLayout(pneMapInfoLayout); - pneMapInfoLayout.setHorizontalGroup( - pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jSeparator1) - .addGroup(pneMapInfoLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneMapInfoLayout.createSequentialGroup() - .addComponent(lblMapInfoWidth) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(spnMapInfoWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pneMapInfoLayout.createSequentialGroup() - .addComponent(lblMapInfoUnkC) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(spnMapInfoUnkC, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pneMapInfoLayout.createSequentialGroup() - .addComponent(lblMapInfoHeight) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(spnMapInfoHeight, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pneMapInfoLayout.createSequentialGroup() - .addComponent(lblMapInfoUnk8) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(spnMapInfoUnk8, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(pneMapInfoLayout.createSequentialGroup() - .addComponent(lblTexInfoUnk2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 357, Short.MAX_VALUE) - .addComponent(spnTexInfoUnk2, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap()) - ); - pneMapInfoLayout.setVerticalGroup( - pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneMapInfoLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lblMapInfoWidth) - .addComponent(spnMapInfoWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lblMapInfoHeight) - .addComponent(spnMapInfoHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lblMapInfoUnk8) - .addComponent(spnMapInfoUnk8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lblMapInfoUnkC) - .addComponent(spnMapInfoUnkC, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneMapInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(lblTexInfoUnk2) - .addComponent(spnTexInfoUnk2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(255, Short.MAX_VALUE)) - ); - - tabPane.addTab("Map Info", pneMapInfo); - - listTexInfo.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - listTexInfo.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - listTexInfoValueChanged(evt); - } - }); - scrTexInfo.setViewportView(listTexInfo); - - pneTexInfoSettings.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); - pneTexInfoSettings.setLayout(new java.awt.GridBagLayout()); - - lblTexInfoUnk0.setText("unk0"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(lblTexInfoUnk0, gridBagConstraints); - - lblTexInfoID.setText("Texture ID"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(lblTexInfoID, gridBagConstraints); - - lblTexInfoUnk4.setText("unk4"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(lblTexInfoUnk4, gridBagConstraints); - - lblTexInfoUnk6.setText("unk6"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(lblTexInfoUnk6, gridBagConstraints); - - spnTexInfoUnk0.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(spnTexInfoUnk0, gridBagConstraints); - - spnTexInfoTextureID.setModel(new javax.swing.SpinnerNumberModel(0, 0, 65535, 1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(spnTexInfoTextureID, gridBagConstraints); - - spnTexInfoUnk4.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(spnTexInfoUnk4, gridBagConstraints); - - spnTexInfoUnk6.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTexInfoSettings.add(spnTexInfoUnk6, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.weighty = 1.0; - pneTexInfoSettings.add(filler3, gridBagConstraints); - - btnTexInfoSave.setText("Save"); - btnTexInfoSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnTexInfoSaveActionPerformed(evt); - } - }); - - btnTexInfoAdd.setText("Add"); - btnTexInfoAdd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnTexInfoAddActionPerformed(evt); - } - }); - - btnTexInfoRemove.setText("Remove"); - btnTexInfoRemove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnTexInfoRemoveActionPerformed(evt); - } - }); - - javax.swing.GroupLayout pneTexInfoLayout = new javax.swing.GroupLayout(pneTexInfo); - pneTexInfo.setLayout(pneTexInfoLayout); - pneTexInfoLayout.setHorizontalGroup( - pneTexInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneTexInfoLayout.createSequentialGroup() - .addContainerGap() - .addComponent(scrTexInfo, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneTexInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pneTexInfoSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(pneTexInfoLayout.createSequentialGroup() - .addComponent(btnTexInfoSave) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnTexInfoAdd) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnTexInfoRemove) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()) - ); - pneTexInfoLayout.setVerticalGroup( - pneTexInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pneTexInfoLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pneTexInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(scrTexInfo) - .addGroup(pneTexInfoLayout.createSequentialGroup() - .addComponent(pneTexInfoSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneTexInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnTexInfoSave) - .addComponent(btnTexInfoAdd) - .addComponent(btnTexInfoRemove)))) - .addContainerGap()) - ); - - tabPane.addTab("Texture Info", pneTexInfo); - - listWarps.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - listWarps.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - listWarpsValueChanged(evt); - } - }); - scrWarps.setViewportView(listWarps); - - pneWarpSettings.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); - pneWarpSettings.setLayout(new java.awt.GridBagLayout()); - - lblWarpPosX.setText("X Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(lblWarpPosX, gridBagConstraints); - - lblWarpPosY.setText("Y Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(lblWarpPosY, gridBagConstraints); - - lblWarpUnk4.setText("short (0x4)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(lblWarpUnk4, gridBagConstraints); - - lblWarpUnk6.setText("short (0x6)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(lblWarpUnk6, gridBagConstraints); - - lblWarpUnk8.setText("short (0x8)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(lblWarpUnk8, gridBagConstraints); - - spnWarpPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(spnWarpPosX, gridBagConstraints); - - spnWarpPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(spnWarpPosY, gridBagConstraints); - - spnWarpUnk4.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(spnWarpUnk4, gridBagConstraints); - - spnWarpUnk6.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(spnWarpUnk6, gridBagConstraints); - - spnWarpUnk8.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneWarpSettings.add(spnWarpUnk8, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.weighty = 1.0; - pneWarpSettings.add(fillerWarp, gridBagConstraints); - - btnWarpSave.setText("Save"); - btnWarpSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnWarpSaveActionPerformed(evt); - } - }); - - btnWarpAdd.setText("Add"); - btnWarpAdd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnWarpAddActionPerformed(evt); - } - }); - - btnWarpRemove.setText("Remove"); - btnWarpRemove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnWarpRemoveActionPerformed(evt); - } - }); - - javax.swing.GroupLayout pneWarpsLayout = new javax.swing.GroupLayout(pneWarps); - pneWarps.setLayout(pneWarpsLayout); - pneWarpsLayout.setHorizontalGroup( - pneWarpsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneWarpsLayout.createSequentialGroup() - .addContainerGap() - .addComponent(scrWarps, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneWarpsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pneWarpSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(pneWarpsLayout.createSequentialGroup() - .addComponent(btnWarpSave) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnWarpAdd) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnWarpRemove) - .addGap(0, 112, Short.MAX_VALUE))) - .addContainerGap()) - ); - pneWarpsLayout.setVerticalGroup( - pneWarpsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneWarpsLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pneWarpsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneWarpsLayout.createSequentialGroup() - .addComponent(pneWarpSettings, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneWarpsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnWarpSave) - .addComponent(btnWarpAdd) - .addComponent(btnWarpRemove))) - .addComponent(scrWarps)) - .addContainerGap()) - ); - - tabPane.addTab("Warps", new javax.swing.ImageIcon(getClass().getResource("/res/tp_warp.png")), pneWarps); // NOI18N - - listTargets.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - listTargets.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - listTargetsValueChanged(evt); - } - }); - scrTargets.setViewportView(listTargets); - - pneTargetSettings.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); - pneTargetSettings.setLayout(new java.awt.GridBagLayout()); - - lblTargetPosX.setText("X Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetPosX, gridBagConstraints); - - lblTargetPosY.setText("Y Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetPosY, gridBagConstraints); - - lblTargetUnk4.setText("byte (0x4)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetUnk4, gridBagConstraints); - - lblTargetUnk5.setText("byte (0x5)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetUnk5, gridBagConstraints); - - lblTargetID.setText("Obstacle"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetID, gridBagConstraints); - - lblTargetUnk8.setText("byte (0x8)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetUnk8, gridBagConstraints); - - lblTargetUnk9.setText("byte (0x9)"); - lblTargetUnk9.setToolTipText(""); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetUnk9, gridBagConstraints); - - lblTargetUnkA.setText("byte (0xA)"); - lblTargetUnkA.setToolTipText(""); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 7; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetUnkA, gridBagConstraints); - - lblTargetUnkB.setText("byte (0xB)"); - lblTargetUnkB.setToolTipText(""); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 8; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(lblTargetUnkB, gridBagConstraints); - - spnTargetPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetPosX, gridBagConstraints); - - spnTargetPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetPosY, gridBagConstraints); - - spnTargetUnk4.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetUnk4, gridBagConstraints); - - spnTargetUnk5.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetUnk5, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(cmoTargetID, gridBagConstraints); - - spnTargetUnk8.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetUnk8, gridBagConstraints); - - spnTargetUnk9.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetUnk9, gridBagConstraints); - - spnTargetUnkA.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 7; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetUnkA, gridBagConstraints); - - spnTargetUnkB.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 8; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneTargetSettings.add(spnTargetUnkB, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 9; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.weighty = 1.0; - pneTargetSettings.add(fillerTarget, gridBagConstraints); - - btnTargetSave.setText("Save"); - btnTargetSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnTargetSaveActionPerformed(evt); - } - }); - - btnTargetAdd.setText("Add"); - btnTargetAdd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnTargetAddActionPerformed(evt); - } - }); - - btnTargetRemove.setText("Remove"); - btnTargetRemove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnTargetRemoveActionPerformed(evt); - } - }); - - javax.swing.GroupLayout pneTargetsLayout = new javax.swing.GroupLayout(pneTargets); - pneTargets.setLayout(pneTargetsLayout); - pneTargetsLayout.setHorizontalGroup( - pneTargetsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneTargetsLayout.createSequentialGroup() - .addContainerGap() - .addComponent(scrTargets, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneTargetsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pneTargetSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(pneTargetsLayout.createSequentialGroup() - .addComponent(btnTargetSave) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnTargetAdd) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnTargetRemove) - .addGap(0, 112, Short.MAX_VALUE))) - .addContainerGap()) - ); - pneTargetsLayout.setVerticalGroup( - pneTargetsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneTargetsLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pneTargetsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneTargetsLayout.createSequentialGroup() - .addComponent(pneTargetSettings, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneTargetsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnTargetSave) - .addComponent(btnTargetAdd) - .addComponent(btnTargetRemove))) - .addComponent(scrTargets)) - .addContainerGap()) - ); - - tabPane.addTab("Targets", new javax.swing.ImageIcon(getClass().getResource("/res/tp_target.png")), pneTargets); // NOI18N - - listMons.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - listMons.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - listMonsValueChanged(evt); - } - }); - scrMons.setViewportView(listMons); - - pneMonSettings.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); - pneMonSettings.setLayout(new java.awt.GridBagLayout()); - - lblMonDataPosX.setText("X Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(lblMonDataPosX, gridBagConstraints); - - lblMonDataPosY.setText("Y Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(lblMonDataPosY, gridBagConstraints); - - lblMonDataBehavior.setText("Behavior"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(lblMonDataBehavior, gridBagConstraints); - - lblMonDataUnk5.setText("byte (0x5)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(lblMonDataUnk5, gridBagConstraints); - - lblMonDataMon.setText("Pokémon"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(lblMonDataMon, gridBagConstraints); - - lblMonDataUnk8.setText("byte (0x8)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(lblMonDataUnk8, gridBagConstraints); - - lblMonDataUnk9a.setText("byte (0x9)"); - lblMonDataUnk9a.setToolTipText(""); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(lblMonDataUnk9a, gridBagConstraints); - - spnMonDataPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(spnMonDataPosX, gridBagConstraints); - - spnMonDataPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(spnMonDataPosY, gridBagConstraints); - - spnMonDataBehavior.setModel(new javax.swing.SpinnerNumberModel(Short.valueOf((short)0), Short.valueOf((short)0), Short.valueOf((short)255), Short.valueOf((short)1))); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(spnMonDataBehavior, gridBagConstraints); - - spnMonDataUnk5.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(spnMonDataUnk5, gridBagConstraints); - - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(cmoMonDataMon, gridBagConstraints); - - spnMonDataUnk8.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(spnMonDataUnk8, gridBagConstraints); - - spnMonDataUnk9a.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneMonSettings.add(spnMonDataUnk9a, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 7; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.weighty = 1.0; - pneMonSettings.add(filler2, gridBagConstraints); - - btnMonSave.setText("Save"); - btnMonSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMonSaveActionPerformed(evt); - } - }); - - btnMonAdd.setText("Add"); - btnMonAdd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMonAddActionPerformed(evt); - } - }); - - btnMonRemove.setText("Remove"); - btnMonRemove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnMonRemoveActionPerformed(evt); - } - }); - - javax.swing.GroupLayout pneMonsLayout = new javax.swing.GroupLayout(pneMons); - pneMons.setLayout(pneMonsLayout); - pneMonsLayout.setHorizontalGroup( - pneMonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneMonsLayout.createSequentialGroup() - .addContainerGap() - .addComponent(scrMons, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneMonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pneMonSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(pneMonsLayout.createSequentialGroup() - .addComponent(btnMonSave) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnMonAdd) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnMonRemove) - .addGap(0, 112, Short.MAX_VALUE))) - .addContainerGap()) - ); - pneMonsLayout.setVerticalGroup( - pneMonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneMonsLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pneMonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneMonsLayout.createSequentialGroup() - .addComponent(pneMonSettings, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneMonsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnMonSave) - .addComponent(btnMonAdd) - .addComponent(btnMonRemove))) - .addComponent(scrMons)) - .addContainerGap()) - ); - - tabPane.addTab("Pokémon", new javax.swing.ImageIcon(getClass().getResource("/res/tp_pokemon.png")), pneMons); // NOI18N - - listNpcs.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - listNpcs.addListSelectionListener(new javax.swing.event.ListSelectionListener() { - public void valueChanged(javax.swing.event.ListSelectionEvent evt) { - listNpcsValueChanged(evt); - } - }); - scrNpcs.setViewportView(listNpcs); - - pneNpcSettings.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); - pneNpcSettings.setLayout(new java.awt.GridBagLayout()); - - lblNpcPosX.setText("X Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(lblNpcPosX, gridBagConstraints); - - lblNpcPosY.setText("Y Position"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(lblNpcPosY, gridBagConstraints); - - lblNpcDirection.setText("Direction"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(lblNpcDirection, gridBagConstraints); - - lblNpcNpc.setText("Sprite"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(lblNpcNpc, gridBagConstraints); - - lblNpcUnk8.setText("byte (0x8)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(lblNpcUnk8, gridBagConstraints); - - lblNpcUnk9.setText("byte (0x9)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(lblNpcUnk9, gridBagConstraints); - - spnNpcPosX.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 0; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(spnNpcPosX, gridBagConstraints); - - spnNpcPosY.setModel(new javax.swing.SpinnerNumberModel((short)0, null, null, (short)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 1; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(spnNpcPosY, gridBagConstraints); - - cmoNpcDirection.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0x00: Down", "0x01: Left", "0x02: Up", "0x03: Right", "0x04: Down(?)", "0x05: Left(?)", "0x06: Up(?)", "0x07: Right(?)", "0x08: Down(?)", "0x09: Left(?)", "0x0A: Up(?)", "0x0B: Right(?)" })); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(cmoNpcDirection, gridBagConstraints); - - chkNpcIsVisible.setText("Is visible?"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 3; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(chkNpcIsVisible, gridBagConstraints); - - spnNpcID.setModel(new javax.swing.SpinnerNumberModel(0, 0, 255, 1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 4; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(spnNpcID, gridBagConstraints); - - spnNpcUnk8.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 5; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(spnNpcUnk8, gridBagConstraints); - - spnNpcUnk9.setModel(new javax.swing.SpinnerNumberModel((byte)0, null, null, (byte)1)); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 6; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 0.5; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(spnNpcUnk9, gridBagConstraints); - - chkNpcUnkA.setText("bool (0xA)"); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 1; - gridBagConstraints.gridy = 7; - gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(1, 1, 1, 1); - pneNpcSettings.add(chkNpcUnkA, gridBagConstraints); - gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 0; - gridBagConstraints.gridy = 8; - gridBagConstraints.gridwidth = 2; - gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.weighty = 1.0; - pneNpcSettings.add(fillerNpc, gridBagConstraints); - - btnNpcSave.setText("Save"); - btnNpcSave.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnNpcSaveActionPerformed(evt); - } - }); - - btnNpcAdd.setText("Add"); - btnNpcAdd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnNpcAddActionPerformed(evt); - } - }); - - btnNpcRemove.setText("Remove"); - btnNpcRemove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnNpcRemoveActionPerformed(evt); - } - }); - - javax.swing.GroupLayout pneNpcsLayout = new javax.swing.GroupLayout(pneNpcs); - pneNpcs.setLayout(pneNpcsLayout); - pneNpcsLayout.setHorizontalGroup( - pneNpcsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(pneNpcsLayout.createSequentialGroup() - .addContainerGap() - .addComponent(scrNpcs, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneNpcsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pneNpcSettings, javax.swing.GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE) - .addGroup(pneNpcsLayout.createSequentialGroup() - .addComponent(btnNpcSave) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnNpcAdd) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(btnNpcRemove) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()) - ); - pneNpcsLayout.setVerticalGroup( - pneNpcsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pneNpcsLayout.createSequentialGroup() - .addContainerGap() - .addGroup(pneNpcsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(scrNpcs, javax.swing.GroupLayout.DEFAULT_SIZE, 419, Short.MAX_VALUE) - .addGroup(pneNpcsLayout.createSequentialGroup() - .addComponent(pneNpcSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pneNpcsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnNpcSave) - .addComponent(btnNpcAdd) - .addComponent(btnNpcRemove)))) - .addContainerGap()) - ); - - tabPane.addTab("NPCs", new javax.swing.ImageIcon(getClass().getResource("/res/tp_npc.png")), pneNpcs); // NOI18N - - warningLabel.setForeground(new java.awt.Color(255, 0, 0)); - warningLabel.setText(" "); - warningLabel.setToolTipText(""); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(toolbar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(tabPane) - .addGroup(layout.createSequentialGroup() - .addComponent(warningLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(toolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(tabPane) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(warningLabel) - .addContainerGap()) - ); - - pack(); - setLocationRelativeTo(null); - }// //GEN-END:initComponents - - private void saveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAllButtonActionPerformed - saveAll(); - }//GEN-LAST:event_saveAllButtonActionPerformed - - private void listTexInfoValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listTexInfoValueChanged - int index = listTexInfo.getSelectedIndex(); - - if (index < 0) { - return; - } - - TextureInfo.Entry tex = map.texInfo.entries.get(index); - - spnTexInfoUnk0.setValue(tex.unk0); - spnTexInfoTextureID.setValue(tex.textureID); - spnTexInfoUnk4.setValue(tex.unk4); - spnTexInfoUnk6.setValue(tex.unk6); - }//GEN-LAST:event_listTexInfoValueChanged - - private void btnTexInfoSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTexInfoSaveActionPerformed - int index = listTexInfo.getSelectedIndex(); - - if (index < 0) { - return; - } - - TextureInfo.Entry tex = map.texInfo.entries.get(index); - - tex.unk0 = (short)spnTexInfoUnk0.getValue(); - tex.textureID = (int)spnTexInfoTextureID.getValue(); - tex.unk4 = (short)spnTexInfoUnk4.getValue(); - tex.unk6 = (short)spnTexInfoUnk6.getValue(); - }//GEN-LAST:event_btnTexInfoSaveActionPerformed - - private void btnTexInfoAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTexInfoAddActionPerformed - TextureInfo.Entry tex = map.texInfo.new Entry(); - - map.texInfo.entries.add(tex); - - reloadTexInfoUI(); - }//GEN-LAST:event_btnTexInfoAddActionPerformed - - private void btnTexInfoRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTexInfoRemoveActionPerformed - int index = listTexInfo.getSelectedIndex(); - - if (index < 0) { - return; - } - - map.texInfo.entries.remove(index); - - reloadTexInfoUI(); - }//GEN-LAST:event_btnTexInfoRemoveActionPerformed - - private void listMonsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listMonsValueChanged - int index = listMons.getSelectedIndex(); - - if (index < 0) { - return; - } - - MonData.Entry mon = getCurLayer().monData.entries.get(index); - - spnMonDataPosX.setValue(mon.posX); - spnMonDataPosY.setValue(mon.posY); - spnMonDataBehavior.setValue(mon.behavior); - spnMonDataUnk5.setValue(mon.enabled); - cmoMonDataMon.setSelectedIndex(mon.monID); - spnMonDataUnk8.setValue(mon.unk8); - spnMonDataUnk9a.setValue(mon.unk9); - }//GEN-LAST:event_listMonsValueChanged - - private void btnMonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMonSaveActionPerformed - int index = listMons.getSelectedIndex(); - - if (index < 0) { - return; - } - - MonData.Entry mon = getCurLayer().monData.entries.get(index); - - mon.posX = (short)spnMonDataPosX.getValue(); - mon.posY = (short)spnMonDataPosY.getValue(); - mon.behavior = (short)spnMonDataBehavior.getValue(); - mon.enabled = (byte)spnMonDataUnk5.getValue(); - mon.monID = cmoMonDataMon.getSelectedIndex(); - mon.unk8 = (byte)spnMonDataUnk8.getValue(); - mon.unk9 = (byte)spnMonDataUnk9a.getValue(); - - modelMons.setElementAt(mon.toString(), index); - }//GEN-LAST:event_btnMonSaveActionPerformed - - private void btnMonAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMonAddActionPerformed - MonData mons = getCurLayer().monData; - MonData.Entry mon = mons.new Entry(); - - mons.entries.add(mon); - modelMons.addElement(mon.toString()); - - reloadMonUI(); - }//GEN-LAST:event_btnMonAddActionPerformed - - private void btnMonRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMonRemoveActionPerformed - int index = listMons.getSelectedIndex(); - - if (index < 0) { - return; - } - - getCurLayer().monData.entries.remove(index); - modelMons.remove(index); - - reloadMonUI(); - }//GEN-LAST:event_btnMonRemoveActionPerformed - - private void listNpcsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listNpcsValueChanged - int index = listNpcs.getSelectedIndex(); - - if (index < 0) { - return; - } - - NpcData.Entry npc = getCurLayer().npcData.entries.get(index); - - spnNpcPosX.setValue(npc.posX); - spnNpcPosY.setValue(npc.posY); - cmoNpcDirection.setSelectedIndex(npc.direction); - chkNpcIsVisible.setSelected(npc.isVisible); - spnNpcID.setValue(npc.npcID); - spnNpcUnk8.setValue(npc.unk8); - spnNpcUnk9.setValue(npc.unk9); - chkNpcUnkA.setSelected(npc.unkA); - }//GEN-LAST:event_listNpcsValueChanged - - private void btnNpcSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNpcSaveActionPerformed - int index = listNpcs.getSelectedIndex(); - - if (index < 0) { - return; - } - - NpcData.Entry npc = getCurLayer().npcData.entries.get(index); - - npc.posX = (short)spnNpcPosX.getValue(); - npc.posY = (short)spnNpcPosY.getValue(); - npc.direction = (byte)cmoNpcDirection.getSelectedIndex(); - npc.isVisible = chkNpcIsVisible.isSelected(); - npc.npcID = (int)spnNpcID.getValue(); - npc.unk8 = (byte)spnNpcUnk8.getValue(); - npc.unk9 = (byte)spnNpcUnk9.getValue(); - npc.unkA = chkNpcUnkA.isSelected(); - - modelNpcs.setElementAt(npc.toString(), index); - }//GEN-LAST:event_btnNpcSaveActionPerformed - - private void btnNpcAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNpcAddActionPerformed - NpcData npcs = getCurLayer().npcData; - NpcData.Entry npc = npcs.new Entry(); - - npcs.entries.add(npc); - modelNpcs.addElement(npc.toString()); - - reloadNpcUI(); - }//GEN-LAST:event_btnNpcAddActionPerformed - - private void btnNpcRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNpcRemoveActionPerformed - int index = listNpcs.getSelectedIndex(); - - if (index < 0) { - return; - } - - getCurLayer().npcData.entries.remove(index); - modelNpcs.remove(index); - - reloadNpcUI(); - }//GEN-LAST:event_btnNpcRemoveActionPerformed - - private void listTargetsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listTargetsValueChanged - int index = listTargets.getSelectedIndex(); - - if (index < 0) { - return; - } - - TargetData.Entry target = getCurLayer().targetData.entries.get(index); - - spnTargetPosX.setValue(target.posX); - spnTargetPosY.setValue(target.posY); - spnTargetUnk4.setValue(target.unk4); - spnTargetUnk5.setValue(target.unk5); - cmoTargetID.setSelectedIndex(target.obstacleID); - spnTargetUnk8.setValue(target.unk8); - spnTargetUnk9.setValue(target.unk9); - spnTargetUnkA.setValue(target.unkA); - spnTargetUnkB.setValue(target.unkB); - }//GEN-LAST:event_listTargetsValueChanged - - private void btnTargetSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTargetSaveActionPerformed - int index = listTargets.getSelectedIndex(); - - if (index < 0) { - return; - } - - TargetData.Entry target = getCurLayer().targetData.entries.get(index); - - target.posX = (short)spnTargetPosX.getValue(); - target.posY = (short)spnTargetPosY.getValue(); - target.unk4 = (byte)spnTargetUnk4.getValue(); - target.unk5 = (byte)spnTargetUnk5.getValue(); - target.obstacleID = cmoTargetID.getSelectedIndex(); - target.unk8 = (byte)spnTargetUnk8.getValue(); - target.unk9 = (byte)spnTargetUnk9.getValue(); - target.unkA = (byte)spnTargetUnkA.getValue(); - target.unkB = (byte)spnTargetUnkB.getValue(); - - modelTargets.setElementAt(target.toString(), index); - }//GEN-LAST:event_btnTargetSaveActionPerformed - - private void btnTargetAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTargetAddActionPerformed - TargetData targets = getCurLayer().targetData; - TargetData.Entry target = targets.new Entry(); - - targets.entries.add(target); - modelTargets.addElement(target.toString()); - - reloadTargetUI(); - }//GEN-LAST:event_btnTargetAddActionPerformed - - private void btnTargetRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTargetRemoveActionPerformed - int index = listTargets.getSelectedIndex(); - - if (index < 0) { - return; - } - - getCurLayer().targetData.entries.remove(index); - modelTargets.remove(index); - - reloadTargetUI(); - }//GEN-LAST:event_btnTargetRemoveActionPerformed - - private void listWarpsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listWarpsValueChanged - int index = listWarps.getSelectedIndex(); - - if (index < 0) { - return; - } - - WarpData.Entry warp = getCurLayer().warpData.entries.get(index); - - spnWarpPosX.setValue(warp.posX); - spnWarpPosY.setValue(warp.posY); - spnWarpUnk4.setValue(warp.unk4); - spnWarpUnk6.setValue(warp.unk6); - spnWarpUnk8.setValue(warp.unk8); - }//GEN-LAST:event_listWarpsValueChanged - - private void btnWarpSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWarpSaveActionPerformed - int index = listWarps.getSelectedIndex(); - - if (index < 0) { - return; - } - - WarpData.Entry warp = getCurLayer().warpData.entries.get(index); - - warp.posX = (short)spnWarpPosX.getValue(); - warp.posY = (short)spnWarpPosY.getValue(); - warp.unk4 = (short)spnWarpUnk4.getValue(); - warp.unk6 = (short)spnWarpUnk6.getValue(); - warp.unk8 = (short)spnWarpUnk8.getValue(); - - modelWarps.setElementAt(warp.toString(), index); - }//GEN-LAST:event_btnWarpSaveActionPerformed - - private void btnWarpAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWarpAddActionPerformed - WarpData warps = getCurLayer().warpData; - WarpData.Entry warp = warps.new Entry(); - - warps.entries.add(warp); - modelWarps.addElement(warp.toString()); - - reloadWarpUI(); - }//GEN-LAST:event_btnWarpAddActionPerformed - - private void btnWarpRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWarpRemoveActionPerformed - int index = listWarps.getSelectedIndex(); - - if (index < 0) { - return; - } - - getCurLayer().warpData.entries.remove(index); - modelWarps.remove(index); - - reloadWarpUI(); - }//GEN-LAST:event_btnWarpRemoveActionPerformed - - private void spnSelectedLayerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spnSelectedLayerStateChanged - reloadLayer(); - }//GEN-LAST:event_spnSelectedLayerStateChanged - - private void btnLayerAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLayerAddActionPerformed - map.layers.add(new Layer(map)); - updateLayers(); - }//GEN-LAST:event_btnLayerAddActionPerformed - - private void btnLayerDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLayerDeleteActionPerformed - if (map.layers.size() > 1) { - map.layers.remove((int)spnSelectedLayer.getValue()); - updateLayers(); - } - }//GEN-LAST:event_btnLayerDeleteActionPerformed - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnLayerAdd; - private javax.swing.JButton btnLayerDelete; - private javax.swing.JButton btnMonAdd; - private javax.swing.JButton btnMonRemove; - private javax.swing.JButton btnMonSave; - private javax.swing.JButton btnNpcAdd; - private javax.swing.JButton btnNpcRemove; - private javax.swing.JButton btnNpcSave; - private javax.swing.JButton btnTargetAdd; - private javax.swing.JButton btnTargetRemove; - private javax.swing.JButton btnTargetSave; - private javax.swing.JButton btnTexInfoAdd; - private javax.swing.JButton btnTexInfoRemove; - private javax.swing.JButton btnTexInfoSave; - private javax.swing.JButton btnWarpAdd; - private javax.swing.JButton btnWarpRemove; - private javax.swing.JButton btnWarpSave; - private javax.swing.JCheckBox chkNpcIsVisible; - private javax.swing.JCheckBox chkNpcUnkA; - private javax.swing.JComboBox cmoMonDataMon; - private javax.swing.JComboBox cmoNpcDirection; - private javax.swing.JComboBox cmoTargetID; - private javax.swing.Box.Filler filler1; - private javax.swing.Box.Filler filler2; - private javax.swing.Box.Filler filler3; - private javax.swing.Box.Filler fillerNpc; - private javax.swing.Box.Filler fillerTarget; - private javax.swing.Box.Filler fillerWarp; - private javax.swing.JSeparator jSeparator1; - private javax.swing.JToolBar.Separator jSeparator2; - private javax.swing.JToolBar.Separator jSeparator3; - private javax.swing.JToolBar.Separator jSeparator4; - private javax.swing.JLabel lblMapInfoHeight; - private javax.swing.JLabel lblMapInfoUnk8; - private javax.swing.JLabel lblMapInfoUnkC; - private javax.swing.JLabel lblMapInfoWidth; - private javax.swing.JLabel lblMonDataBehavior; - private javax.swing.JLabel lblMonDataMon; - private javax.swing.JLabel lblMonDataPosX; - private javax.swing.JLabel lblMonDataPosY; - private javax.swing.JLabel lblMonDataUnk5; - private javax.swing.JLabel lblMonDataUnk8; - private javax.swing.JLabel lblMonDataUnk9a; - private javax.swing.JLabel lblNpcDirection; - private javax.swing.JLabel lblNpcNpc; - private javax.swing.JLabel lblNpcPosX; - private javax.swing.JLabel lblNpcPosY; - private javax.swing.JLabel lblNpcUnk8; - private javax.swing.JLabel lblNpcUnk9; - private javax.swing.JLabel lblSelectedLayer; - private javax.swing.JLabel lblTargetID; - private javax.swing.JLabel lblTargetPosX; - private javax.swing.JLabel lblTargetPosY; - private javax.swing.JLabel lblTargetUnk4; - private javax.swing.JLabel lblTargetUnk5; - private javax.swing.JLabel lblTargetUnk8; - private javax.swing.JLabel lblTargetUnk9; - private javax.swing.JLabel lblTargetUnkA; - private javax.swing.JLabel lblTargetUnkB; - private javax.swing.JLabel lblTexInfoID; - private javax.swing.JLabel lblTexInfoUnk0; - private javax.swing.JLabel lblTexInfoUnk2; - private javax.swing.JLabel lblTexInfoUnk4; - private javax.swing.JLabel lblTexInfoUnk6; - private javax.swing.JLabel lblWarpPosX; - private javax.swing.JLabel lblWarpPosY; - private javax.swing.JLabel lblWarpUnk4; - private javax.swing.JLabel lblWarpUnk6; - private javax.swing.JLabel lblWarpUnk8; - private javax.swing.JList listMons; - private javax.swing.JList listNpcs; - private javax.swing.JList listTargets; - private javax.swing.JList listTexInfo; - private javax.swing.JList listWarps; - private javax.swing.JPanel pneMapInfo; - private javax.swing.JPanel pneMonSettings; - private javax.swing.JPanel pneMons; - private javax.swing.JPanel pneNpcSettings; - private javax.swing.JPanel pneNpcs; - private javax.swing.JPanel pneTargetSettings; - private javax.swing.JPanel pneTargets; - private javax.swing.JPanel pneTexInfo; - private javax.swing.JPanel pneTexInfoSettings; - private javax.swing.JPanel pneWarpSettings; - private javax.swing.JPanel pneWarps; - private javax.swing.JButton saveAllButton; - private javax.swing.JScrollPane scrMons; - private javax.swing.JScrollPane scrNpcs; - private javax.swing.JScrollPane scrTargets; - private javax.swing.JScrollPane scrTexInfo; - private javax.swing.JScrollPane scrWarps; - private javax.swing.JSpinner spnMapInfoHeight; - private javax.swing.JSpinner spnMapInfoUnk8; - private javax.swing.JSpinner spnMapInfoUnkC; - private javax.swing.JSpinner spnMapInfoWidth; - private javax.swing.JSpinner spnMonDataBehavior; - private javax.swing.JSpinner spnMonDataPosX; - private javax.swing.JSpinner spnMonDataPosY; - private javax.swing.JSpinner spnMonDataUnk5; - private javax.swing.JSpinner spnMonDataUnk8; - private javax.swing.JSpinner spnMonDataUnk9a; - private javax.swing.JSpinner spnNpcID; - private javax.swing.JSpinner spnNpcPosX; - private javax.swing.JSpinner spnNpcPosY; - private javax.swing.JSpinner spnNpcUnk8; - private javax.swing.JSpinner spnNpcUnk9; - private javax.swing.JSpinner spnSelectedLayer; - private javax.swing.JSpinner spnTargetPosX; - private javax.swing.JSpinner spnTargetPosY; - private javax.swing.JSpinner spnTargetUnk4; - private javax.swing.JSpinner spnTargetUnk5; - private javax.swing.JSpinner spnTargetUnk8; - private javax.swing.JSpinner spnTargetUnk9; - private javax.swing.JSpinner spnTargetUnkA; - private javax.swing.JSpinner spnTargetUnkB; - private javax.swing.JSpinner spnTexInfoTextureID; - private javax.swing.JSpinner spnTexInfoUnk0; - private javax.swing.JSpinner spnTexInfoUnk2; - private javax.swing.JSpinner spnTexInfoUnk4; - private javax.swing.JSpinner spnTexInfoUnk6; - private javax.swing.JSpinner spnWarpPosX; - private javax.swing.JSpinner spnWarpPosY; - private javax.swing.JSpinner spnWarpUnk4; - private javax.swing.JSpinner spnWarpUnk6; - private javax.swing.JSpinner spnWarpUnk8; - private javax.swing.JTabbedPane tabPane; - protected javax.swing.JToolBar toolbar; - protected javax.swing.JLabel warningLabel; - // End of variables declaration//GEN-END:variables -} \ No newline at end of file diff --git a/src/com/aurum/almia/util/ArrayUtils.java b/src/com/aurum/almia/util/ArrayUtils.java new file mode 100644 index 0000000..5811b24 --- /dev/null +++ b/src/com/aurum/almia/util/ArrayUtils.java @@ -0,0 +1,545 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.util; + +public final class ArrayUtils { + private ArrayUtils() {} + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(byte[] arr, byte val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(short[] arr, short val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(int[] arr, int val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(long[] arr, long val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(float[] arr, float val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(double[] arr, double val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(boolean[] arr, boolean val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(char[] arr, char val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Returns the next index of the specified value, starting from the given offset. + * @param arr the array + * @param val the value to be found + * @param off the starting offset + * @return the next index of the specified value. -1 if the value was not found. + */ + public static int indexOf(Object[] arr, Object val, int off) { + while(off < arr.length) { + if (arr[off] == val) + return off; + off++; + } + + return -1; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static byte[] sequence(int len, byte val) { + byte[] sequence = new byte[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static short[] sequence(int len, short val) { + short[] sequence = new short[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static int[] sequence(int len, int val) { + int[] sequence = new int[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static long[] sequence(int len, long val) { + long[] sequence = new long[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static float[] sequence(int len, float val) { + float[] sequence = new float[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static double[] sequence(int len, double val) { + double[] sequence = new double[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static boolean[] sequence(int len, boolean val) { + boolean[] sequence = new boolean[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static char[] sequence(int len, char val) { + char[] sequence = new char[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Creates a sequence of the specified value with a length of {@code len} elements. + * @param len the length of the sequence + * @param val the value + * @return the sequence as an array. + */ + public static Object[] sequence(int len, Object val) { + Object[] sequence = new Object[len]; + for (int i = 0 ; i < len ; i++) + sequence[i] = val; + + return sequence; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static byte[] reverse(byte[] arr) { + byte[] reversed = new byte[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static short[] reverse(short[] arr) { + short[] reversed = new short[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static int[] reverse(int[] arr) { + int[] reversed = new int[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static long[] reverse(long[] arr) { + long[] reversed = new long[arr.length]; + + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static float[] reverse(float[] arr) { + float[] reversed = new float[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static double[] reverse(double[] arr) { + double[] reversed = new double[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static boolean[] reverse(boolean[] arr) { + boolean[] reversed = new boolean[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static char[] reverse(char[] arr) { + char[] reversed = new char[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Reverses the order of the elements in the given array. + * @param arr the array + * @return the array with the order of its elements reversed. + */ + public static Object[] reverse(Object[] arr) { + Object[] reversed = new Object[arr.length]; + for (int l = 0, r = arr.length - 1 ; l <= arr.length && r >= 0 ; l++, r--) + reversed[l] = arr[r]; + + return reversed; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(byte[] arr, byte val) { + for (byte i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(short[] arr, short val) { + for (int i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(int[] arr, int val) { + for (int i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(long[] arr, long val) { + for (long i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(float[] arr, float val) { + for (float i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(double[] arr, double val) { + for (double i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(boolean[] arr, boolean val) { + for (boolean i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(char[] arr, char val) { + for (char i : arr) + if (i == val) + return true; + + return false; + } + + /** + * Checks if the array contains the specified element. + * @param arr the array + * @param val the checked element + * @return true if the array contains the element. + */ + public static boolean arrayContains(Object[] arr, Object val) { + for (Object i : arr) + if (i == val) + return true; + + return false; + } +} \ No newline at end of file diff --git a/src/com/aurum/almia/util/BitConverter.java b/src/com/aurum/almia/util/BitConverter.java new file mode 100644 index 0000000..fa0de15 --- /dev/null +++ b/src/com/aurum/almia/util/BitConverter.java @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.util; + +import java.math.BigInteger; +import java.nio.ByteOrder; + +public final class BitConverter { + private BitConverter() {} + + private static byte[] createBuffer(byte[] data, ByteOrder endian, int offset, int size) { + byte[] bytes = new byte[size]; + + for (int i = 0 ; i < size ; i++) + bytes[i] = data[i + offset]; + + return endian == ByteOrder.LITTLE_ENDIAN ? ArrayUtils.reverse(bytes) : bytes; + } + + public static short toShort(byte[] data, ByteOrder endian, int offset) { + byte[] bs = createBuffer(data, endian, offset, Short.BYTES); + + return (short)( + ((bs[0] & 0xFF) << 8) | + (bs[1] & 0xFF) + ); + } + + public static int toUnsignedShort(byte[] data, ByteOrder endian, int offset) { + return (int)(toShort(data, endian, offset) & 0xFFFF); + } + + public static int toInt(byte[] data, ByteOrder endian, int offset) { + byte[] bs = createBuffer(data, endian, offset, Integer.BYTES); + + return ( + ((bs[0] & 0xFF) << 24) | + ((bs[1] & 0xFF) << 16) | + ((bs[2] & 0xFF) << 8) | + (bs[3] & 0xFF) + ); + } + + public static long toUnsignedInt(byte[] data, ByteOrder endian, int offset) { + return (long)(toInt(data, endian, offset) & 0xFFFFFFFF); + } + + public static int toInt24(byte[] data, ByteOrder endian, int offset) { + byte[] bs = createBuffer(data, endian, offset, 3); + + return ( + ((bs[0] & 0xFF) << 16) | + ((bs[1] & 0xFF) << 8) | + (bs[2] & 0xFF) + ); + } + + public static int toUnsignedInt24(byte[] data, ByteOrder endian, int offset) { + return toInt24(data, endian, offset) & 0xFFFFFF; + } + + public static long toLong(byte[] data, ByteOrder endian, int offset) { + byte[] bs = createBuffer(data, endian, offset, Long.BYTES); + + return ( + ((long) (bs[0] & 0xFF) << 56) | + ((long) (bs[1] & 0xFF) << 48) | + ((long) (bs[2] & 0xFF) << 40) | + ((long) (bs[3] & 0xFF) << 32) | + ((long) (bs[4] & 0xFF) << 24) | + ((long) (bs[5] & 0xFF) << 16) | + ((long) (bs[6] & 0xFF) << 8) | + (long) (bs[7] & 0xFF) + ); + } + + public static BigInteger toUnsignedLong(byte[] data, ByteOrder endian, int offset) { + return new BigInteger(createBuffer(data, endian, offset, Long.BYTES)); + } + + public static float toFloat(byte[] data, ByteOrder endian, int offset) { + return Float.intBitsToFloat(toInt(data, endian, offset)); + } + + public static double toDouble(byte[] data, ByteOrder endian, int offset) { + return Double.longBitsToDouble(toLong(data, endian, offset)); + } + + public static char toChar(byte[] data, ByteOrder endian, int offset) { + return (char)toShort(data, endian, offset); + } + + public static boolean toBoolean(byte[] data, int offset) { + return data[offset] != 0; + } + + public static byte[] getBytes(short val, ByteOrder endian) { + byte[] bs = new byte[Short.BYTES]; + + bs[0] = (byte)((val >> 8) & 0xFF); + bs[1] = (byte) (val & 0xFF); + + return endian == ByteOrder.LITTLE_ENDIAN ? ArrayUtils.reverse(bs) : bs; + } + + public static byte[] getBytes(int val, ByteOrder endian) { + byte[] bs = new byte[Integer.BYTES]; + + bs[0] = (byte)((val >> 24) & 0xFF); + bs[1] = (byte)((val >> 16) & 0xFF); + bs[2] = (byte)((val >> 8) & 0xFF); + bs[3] = (byte) (val & 0xFF); + + return endian == ByteOrder.LITTLE_ENDIAN ? ArrayUtils.reverse(bs) : bs; + } + + public static byte[] getBytes(long val, ByteOrder endian) { + byte[] bs = new byte[Long.BYTES]; + + bs[0] = (byte)((val >> 56) & 0xFF); + bs[1] = (byte)((val >> 48) & 0xFF); + bs[2] = (byte)((val >> 40) & 0xFF); + bs[3] = (byte)((val >> 32) & 0xFF); + bs[4] = (byte)((val >> 24) & 0xFF); + bs[5] = (byte)((val >> 16) & 0xFF); + bs[6] = (byte)((val >> 8) & 0xFF); + bs[7] = (byte) (val & 0xFF); + + return endian == ByteOrder.LITTLE_ENDIAN ? ArrayUtils.reverse(bs) : bs; + } + + public static byte[] getBytes(float val, ByteOrder endian) { + return getBytes(Float.floatToIntBits(val), endian); + } + + public static byte[] getBytes(double val, ByteOrder endian) { + return getBytes(Double.doubleToLongBits(val), endian); + } + + public static byte[] getBytes(char val, ByteOrder endian) { + return getBytes((short)val, endian); + } + + public static byte[] getBytes(boolean val) { + return new byte[] { (byte)(val ? 1 : 0) }; + } +} \ No newline at end of file diff --git a/src/com/aurum/almia/ByteBuffer.java b/src/com/aurum/almia/util/ByteBuffer.java similarity index 89% rename from src/com/aurum/almia/ByteBuffer.java rename to src/com/aurum/almia/util/ByteBuffer.java index 80566d6..ca61431 100644 --- a/src/com/aurum/almia/ByteBuffer.java +++ b/src/com/aurum/almia/util/ByteBuffer.java @@ -15,49 +15,73 @@ * along with this program. If not, see . */ -package com.aurum.almia; +package com.aurum.almia.util; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.ByteOrder; import java.nio.charset.Charset; import java.util.Arrays; import java.util.HashMap; public class ByteBuffer { - public static final Charset CHARSET = Charset.forName("UTF-8"); + public static final String STANDARD_CHARSET = "UTF-8"; - //-------------------------------------------------------------------------- + public static ByteBuffer read(String filepath) throws IOException { + return read(new File(filepath)); + } + + public static ByteBuffer read(File file) throws IOException { + return read(new FileInputStream(file)); + } + + public static ByteBuffer read(InputStream in) throws IOException { + byte[] raw = new byte[in.available()]; + in.read(raw); + in.close(); + return new ByteBuffer(raw); + } + + public static void write(ByteBuffer buffer, String filepath) throws IOException { + write(buffer, new File(filepath)); + } + + public static void write(ByteBuffer buffer, File file) throws IOException { + write(buffer, new FileOutputStream(file)); + } + + public static void write(ByteBuffer buffer, OutputStream out) throws IOException { + out.write(buffer.getBuffer()); + out.flush(); + out.close(); + } protected byte[] buffer; protected int position; protected ByteOrder endianness; protected HashMap marks; - public ByteBuffer() { - this.buffer = new byte[0]; - this.position = 0; - this.endianness = ByteOrder.BIG_ENDIAN; - this.marks = new HashMap(); - } - public ByteBuffer(int length) { - this(); - this.buffer = new byte[length]; + this(new byte[length], ByteOrder.nativeOrder()); } public ByteBuffer(int length, ByteOrder endian) { - this(); - this.buffer = new byte[length]; - this.endianness = endian; + this(new byte[length], endian); } public ByteBuffer(byte[] bytes) { - this(); - this.buffer = bytes; + this(bytes, ByteOrder.nativeOrder()); } public ByteBuffer(byte[] bytes, ByteOrder endian) { - this(); this.buffer = bytes; + this.position = 0; this.endianness = endian; + this.marks = new HashMap(); } /** @@ -75,7 +99,7 @@ public class ByteBuffer { */ @Override public int hashCode() { - return Arrays.hashCode(buffer); + return Arrays.hashCode(buffer) ^ position; } /** @@ -190,9 +214,6 @@ public class ByteBuffer { * @return the index. */ public int indexOf(byte val, int off) { - if (off < 0) - throw new IllegalArgumentException("offset " + off + " is < than 0"); - while(off < buffer.length) { if (buffer[off] == val) return off; @@ -227,9 +248,6 @@ public class ByteBuffer { * @return the same value as {@code pos}. */ public int addMark(String name, int pos) { - if (pos < 0) - throw new IllegalArgumentException("position " + pos + " < 0"); - return marks.containsKey(name) ? marks.replace(name, pos) : marks.put(name, pos); } @@ -255,8 +273,6 @@ public class ByteBuffer { * @param size the new size */ public void allocate(int size) { - if (size < 0) - throw new IllegalArgumentException("new size " + size + " < 0"); buffer = new byte[size]; position = 0; marks.clear(); @@ -282,7 +298,7 @@ public class ByteBuffer { throw new IllegalArgumentException("end index > start index"); for ( ; start <= end ; start++) - buffer[start] = (byte) 0x0; + buffer[start] = (byte)0x0; } /** @@ -290,8 +306,6 @@ public class ByteBuffer { * @param addsize the length that is added to the current length. */ public void extend(int addsize) { - if (addsize < 0) - throw new IllegalArgumentException("addsize " + addsize + " < 0"); if (addsize == 0) return; @@ -306,9 +320,6 @@ public class ByteBuffer { * @return an array of bytes. */ public byte[] readBytes(int len) { - if (len < 0) - throw new IllegalArgumentException("negative length " + len); - byte[] b = new byte[len]; if (remaining() >= len && len != 0) { for (int c = 0 ; c < len ; c++) @@ -405,7 +416,7 @@ public class ByteBuffer { * @return the unsigned 16-bit value. */ public int readUnsignedShort() { - return (remaining() >= Short.BYTES) ? BitConverter.toUShort(readBytes(Short.BYTES), endianness, 0) : 0; + return (remaining() >= Short.BYTES) ? BitConverter.toUnsignedShort(readBytes(Short.BYTES), endianness, 0) : 0; } /** @@ -441,7 +452,7 @@ public class ByteBuffer { * @return the unsigned 32-bit value. */ public long readUnsignedInt() { - return (remaining() >= Integer.BYTES) ? BitConverter.toUInt(readBytes(Integer.BYTES), endianness, 0) : 0; + return (remaining() >= Integer.BYTES) ? BitConverter.toUnsignedInt(readBytes(Integer.BYTES), endianness, 0) : 0; } /** @@ -513,7 +524,7 @@ public class ByteBuffer { * @return the Unicode char. */ public char readCharacter() { - return (remaining() >= Character.BYTES) ? BitConverter.toCharacter(readBytes(Character.BYTES), endianness, 0) : 0; + return (remaining() >= Character.BYTES) ? BitConverter.toChar(readBytes(Character.BYTES), endianness, 0) : 0; } /** @@ -550,8 +561,8 @@ public class ByteBuffer { * @param len the length of the String * @return the String. */ - public String readString(Charset charset, int len) { - return (len > 0) ? new String(readBytes(len), charset) : new String(); + public String readString(String charset, int len) { + return (len > 0) ? new String(readBytes(len), Charset.forName(charset)) : ""; } /** @@ -561,7 +572,7 @@ public class ByteBuffer { * @param len the length of the String * @return the String. */ - public String readStringAt(int pos, Charset charset, int len) { + public String readStringAt(int pos, String charset, int len) { seek(pos); return readString(charset, len); } @@ -572,7 +583,7 @@ public class ByteBuffer { * @return the String. */ public String readString(int len) { - return readString(CHARSET, len); + return readString(STANDARD_CHARSET, len); } /** @@ -591,7 +602,7 @@ public class ByteBuffer { * @param charset * @return A string. */ - public String readString(Charset charset) { + public String readString(String charset) { return readString(charset, indexOf((byte) 0, position) - position); } @@ -601,7 +612,7 @@ public class ByteBuffer { * @param charset * @return A string. */ - public String readStringAt(int pos, Charset charset) { + public String readStringAt(int pos, String charset) { seek(pos); return readString(charset); } @@ -611,7 +622,7 @@ public class ByteBuffer { * @return A string. */ public String readString() { - return readString(CHARSET); + return readString(STANDARD_CHARSET); } /** @@ -624,6 +635,15 @@ public class ByteBuffer { return readString(); } + public String readMagic() { + return readString("ASCII", 4); + } + + public String readMagicAt(int pos) { + seek(pos); + return readMagic(); + } + /** * Writes the content of the specified byte array to this buffer. * @param val the byte array @@ -851,9 +871,9 @@ public class ByteBuffer { * @param charset the charset * @return the offset to this String. */ - public int writeString(String val, Charset charset) { + public int writeString(String val, String charset) { int pos = position; - writeBytes(val.getBytes(charset)); + writeBytes(val.getBytes(Charset.forName(charset))); writeByte((byte) 0x0); return pos; } @@ -865,7 +885,7 @@ public class ByteBuffer { * @param charset the charset * @return the offset to this String. */ - public int writeStringAt(int pos, String val, Charset charset) { + public int writeStringAt(int pos, String val, String charset) { seek(pos); return writeString(val, charset); } @@ -876,7 +896,7 @@ public class ByteBuffer { * @return the offset to this String. */ public int writeString(String val) { - return writeString(val, CHARSET); + return writeString(val, STANDARD_CHARSET); } /** @@ -889,4 +909,15 @@ public class ByteBuffer { seek(pos); return writeString(val); } + + public int writeMagic(String val) { + int pos = position; + writeBytes(val.getBytes(Charset.forName("ASCII"))); + return pos; + } + + public int writeMagicAt(int pos, String val) { + seek(pos); + return writeMagic(val); + } } \ No newline at end of file diff --git a/src/com/aurum/almia/util/IOHelper.java b/src/com/aurum/almia/util/IOHelper.java new file mode 100644 index 0000000..3703777 --- /dev/null +++ b/src/com/aurum/almia/util/IOHelper.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +public final class IOHelper { + private IOHelper() {} + + public static byte[] read(String filename) throws IOException { + return read(new File(filename)); + } + + public static byte[] read(File file) throws IOException { + return read(new FileInputStream(file)); + } + + public static byte[] read(InputStream in) throws IOException { + byte[] data = new byte[in.available()]; + in.read(data); + in.close(); + return data; + } + + public static void write(byte[] data, String filename) throws IOException { + write(data, new File(filename)); + } + + public static void write(byte[] data, File file) throws IOException { + write(data, new FileOutputStream(file)); + } + + public static void write(byte[] data, OutputStream out) throws IOException { + out.write(data); + out.flush(); + out.close(); + } +} \ No newline at end of file diff --git a/src/com/aurum/almia/util/RenderHelper.java b/src/com/aurum/almia/util/RenderHelper.java new file mode 100644 index 0000000..d5a369e --- /dev/null +++ b/src/com/aurum/almia/util/RenderHelper.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2018 Aurum + * + * AlmiaE is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AlmiaE is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.aurum.almia.util; + +import java.awt.Color; +import java.awt.Graphics; + +public final class RenderHelper { + private RenderHelper() {} + + public static void drawBox(Graphics g, int x, int y, int w, int h, Color out, Color in, boolean aligned) { + if (aligned) { + x -= w / 2; + y -= h / 2; + } + + g.setColor(out); + g.drawRect(x, y, w, h); + g.setColor(in); + g.fillRect(x + 1, y + 1, w - 1, h - 1); + } +} \ No newline at end of file diff --git a/src/res/icon.png b/src/res/icon.png index 9b987fa..bfcfaf3 100644 Binary files a/src/res/icon.png and b/src/res/icon.png differ diff --git a/src/res/lists/npcs.txt b/src/res/lists/npcs.txt new file mode 100644 index 0000000..26f7831 --- /dev/null +++ b/src/res/lists/npcs.txt @@ -0,0 +1,256 @@ +Nothing +Father +Mother +Sister +Ms. April +Mr. Lamont +Kincaid (Teacher) +Kincaid (Dim Sun) +unknown +unknown +unknown +unknown +Keith (Student) +Keith (Ranger) +Isaac (Student) +Isaac (Scientist) +unknown +unknown +Barlow +Crawford +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Regigigas +Palkia +Dialga +Tangrowth +Dusknoir +Rhyperior +Drapion +Abomasnow +Aggron +Spiritomb +Mismagius +Infernape +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown \ No newline at end of file diff --git a/src/res/lists/obstacles.txt b/src/res/lists/obstacles.txt index 07b18be..6f8a59e 100644 --- a/src/res/lists/obstacles.txt +++ b/src/res/lists/obstacles.txt @@ -1,4 +1,4 @@ -NONE +Nothing Oddish Weed Gloom Flower Vileplume Flower @@ -44,7 +44,7 @@ Steel Frame Large Cage Fallen Log Rope -NONE +Burning Tree Solid Ice Ice Block Burning Log @@ -52,11 +52,11 @@ Fiery Wall Hot Boulder Fallen Leaves Soft Soil -NONE +Metal Crate Torch Torch -NONE -NONE +unknown +unknown Trap Power Generator Power Generator @@ -73,9 +73,9 @@ Vine Forest Tree Forest Tree Snow Tree -NONE -NONE -NONE +unknown +unknown +unknown Electric Door Electric Door Electric Door @@ -90,30 +90,44 @@ Rock Statue Pledge Stone Pledge Stone Ice Statue -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE +unknown +unknown +unknown +unknown +unknown +Temple Platform +unknown +unknown +unknown +Trampline Plant +Icicle +unknown +unknown +unknown +unknown +unknown Ice Wall Rotten Log -NONE -NONE -NONE -NONE -NONE -NONE +Ice Platform +unknown +unknown +Quicksand Pit +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown Wire Fence Kingston Valve Yellow Switch @@ -125,244 +139,244 @@ Circuit Ball Circuit Ball Smoke Detector Gateway -Sand Cover +Sandshrew Cover Strange Machine -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE -NONE \ No newline at end of file +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Regigigas Door +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Blue Gem +Red Gem +Yellow Gem +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Sand Cannon +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Temple Pit +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Regirock Podestal +Regice Podestal +Registeel Podestal +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Temple Lift (right) +Temple Lift (left) +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +Sand Tornado +unknown +unknown +unknown +unknown +unknown +Sandslash Cover +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown +unknown \ No newline at end of file diff --git a/src/res/mapEditor/node_location.png b/src/res/mapEditor/node_location.png new file mode 100644 index 0000000..f6d99b1 Binary files /dev/null and b/src/res/mapEditor/node_location.png differ diff --git a/src/res/mapEditor/node_misc.png b/src/res/mapEditor/node_misc.png new file mode 100644 index 0000000..d25cdae Binary files /dev/null and b/src/res/mapEditor/node_misc.png differ diff --git a/src/res/mapEditor/node_mon.png b/src/res/mapEditor/node_mon.png new file mode 100644 index 0000000..f1a8445 Binary files /dev/null and b/src/res/mapEditor/node_mon.png differ diff --git a/src/res/mapEditor/node_npc.png b/src/res/mapEditor/node_npc.png new file mode 100644 index 0000000..0a0c4ab Binary files /dev/null and b/src/res/mapEditor/node_npc.png differ diff --git a/src/res/mapEditor/node_target.png b/src/res/mapEditor/node_target.png new file mode 100644 index 0000000..cead3b9 Binary files /dev/null and b/src/res/mapEditor/node_target.png differ diff --git a/src/res/mons/0_0.png b/src/res/mons/0_0.png new file mode 100644 index 0000000..d62280e Binary files /dev/null and b/src/res/mons/0_0.png differ diff --git a/src/res/mons/100_0.png b/src/res/mons/100_0.png new file mode 100644 index 0000000..2622b9d Binary files /dev/null and b/src/res/mons/100_0.png differ diff --git a/src/res/mons/101_0.png b/src/res/mons/101_0.png new file mode 100644 index 0000000..c79e0dd Binary files /dev/null and b/src/res/mons/101_0.png differ diff --git a/src/res/mons/109_0.png b/src/res/mons/109_0.png new file mode 100644 index 0000000..d08625c Binary files /dev/null and b/src/res/mons/109_0.png differ diff --git a/src/res/mons/110_0.png b/src/res/mons/110_0.png new file mode 100644 index 0000000..5eddacb Binary files /dev/null and b/src/res/mons/110_0.png differ diff --git a/src/res/mons/111_0.png b/src/res/mons/111_0.png new file mode 100644 index 0000000..11f757a Binary files /dev/null and b/src/res/mons/111_0.png differ diff --git a/src/res/mons/112_0.png b/src/res/mons/112_0.png new file mode 100644 index 0000000..cbbc4d3 Binary files /dev/null and b/src/res/mons/112_0.png differ diff --git a/src/res/mons/115_0.png b/src/res/mons/115_0.png new file mode 100644 index 0000000..752bd87 Binary files /dev/null and b/src/res/mons/115_0.png differ diff --git a/src/res/mons/116_0.png b/src/res/mons/116_0.png new file mode 100644 index 0000000..21b672e Binary files /dev/null and b/src/res/mons/116_0.png differ diff --git a/src/res/mons/117_0.png b/src/res/mons/117_0.png new file mode 100644 index 0000000..c6edef8 Binary files /dev/null and b/src/res/mons/117_0.png differ diff --git a/src/res/mons/120_0.png b/src/res/mons/120_0.png new file mode 100644 index 0000000..fd35bfd Binary files /dev/null and b/src/res/mons/120_0.png differ diff --git a/src/res/mons/121_0.png b/src/res/mons/121_0.png new file mode 100644 index 0000000..80fc057 Binary files /dev/null and b/src/res/mons/121_0.png differ diff --git a/src/res/mons/122_0.png b/src/res/mons/122_0.png new file mode 100644 index 0000000..781be30 Binary files /dev/null and b/src/res/mons/122_0.png differ diff --git a/src/res/mons/123_0.png b/src/res/mons/123_0.png new file mode 100644 index 0000000..c600c80 Binary files /dev/null and b/src/res/mons/123_0.png differ diff --git a/src/res/mons/124_0.png b/src/res/mons/124_0.png new file mode 100644 index 0000000..188f4ad Binary files /dev/null and b/src/res/mons/124_0.png differ diff --git a/src/res/mons/125_0.png b/src/res/mons/125_0.png new file mode 100644 index 0000000..9dbc7aa Binary files /dev/null and b/src/res/mons/125_0.png differ diff --git a/src/res/mons/126_0.png b/src/res/mons/126_0.png new file mode 100644 index 0000000..23135c0 Binary files /dev/null and b/src/res/mons/126_0.png differ diff --git a/src/res/mons/127_0.png b/src/res/mons/127_0.png new file mode 100644 index 0000000..d3ac21a Binary files /dev/null and b/src/res/mons/127_0.png differ diff --git a/src/res/mons/128_0.png b/src/res/mons/128_0.png new file mode 100644 index 0000000..a2dfb18 Binary files /dev/null and b/src/res/mons/128_0.png differ diff --git a/src/res/mons/133_0.png b/src/res/mons/133_0.png new file mode 100644 index 0000000..ea0f0b9 Binary files /dev/null and b/src/res/mons/133_0.png differ diff --git a/src/res/mons/134_0.png b/src/res/mons/134_0.png new file mode 100644 index 0000000..4d3d8a9 Binary files /dev/null and b/src/res/mons/134_0.png differ diff --git a/src/res/mons/135_0.png b/src/res/mons/135_0.png new file mode 100644 index 0000000..88186a9 Binary files /dev/null and b/src/res/mons/135_0.png differ diff --git a/src/res/mons/136_0.png b/src/res/mons/136_0.png new file mode 100644 index 0000000..42225f8 Binary files /dev/null and b/src/res/mons/136_0.png differ diff --git a/src/res/mons/138_0.png b/src/res/mons/138_0.png new file mode 100644 index 0000000..7518520 Binary files /dev/null and b/src/res/mons/138_0.png differ diff --git a/src/res/mons/139_0.png b/src/res/mons/139_0.png new file mode 100644 index 0000000..196d3ff Binary files /dev/null and b/src/res/mons/139_0.png differ diff --git a/src/res/mons/13_0.png b/src/res/mons/13_0.png new file mode 100644 index 0000000..0f0ef54 Binary files /dev/null and b/src/res/mons/13_0.png differ diff --git a/src/res/mons/142_0.png b/src/res/mons/142_0.png new file mode 100644 index 0000000..17cf164 Binary files /dev/null and b/src/res/mons/142_0.png differ diff --git a/src/res/mons/147_0.png b/src/res/mons/147_0.png new file mode 100644 index 0000000..c6f27f7 Binary files /dev/null and b/src/res/mons/147_0.png differ diff --git a/src/res/mons/148_0.png b/src/res/mons/148_0.png new file mode 100644 index 0000000..903ffc1 Binary files /dev/null and b/src/res/mons/148_0.png differ diff --git a/src/res/mons/15_0.png b/src/res/mons/15_0.png new file mode 100644 index 0000000..74d261e Binary files /dev/null and b/src/res/mons/15_0.png differ diff --git a/src/res/mons/167_0.png b/src/res/mons/167_0.png new file mode 100644 index 0000000..d87d264 Binary files /dev/null and b/src/res/mons/167_0.png differ diff --git a/src/res/mons/168_0.png b/src/res/mons/168_0.png new file mode 100644 index 0000000..e7e4a7c Binary files /dev/null and b/src/res/mons/168_0.png differ diff --git a/src/res/mons/169_0.png b/src/res/mons/169_0.png new file mode 100644 index 0000000..5b5a6cf Binary files /dev/null and b/src/res/mons/169_0.png differ diff --git a/src/res/mons/170_0.png b/src/res/mons/170_0.png new file mode 100644 index 0000000..f403e2d Binary files /dev/null and b/src/res/mons/170_0.png differ diff --git a/src/res/mons/171_0.png b/src/res/mons/171_0.png new file mode 100644 index 0000000..b04fa41 Binary files /dev/null and b/src/res/mons/171_0.png differ diff --git a/src/res/mons/172_0.png b/src/res/mons/172_0.png new file mode 100644 index 0000000..f325523 Binary files /dev/null and b/src/res/mons/172_0.png differ diff --git a/src/res/mons/179_0.png b/src/res/mons/179_0.png new file mode 100644 index 0000000..0b15f6e Binary files /dev/null and b/src/res/mons/179_0.png differ diff --git a/src/res/mons/180_0.png b/src/res/mons/180_0.png new file mode 100644 index 0000000..3f17404 Binary files /dev/null and b/src/res/mons/180_0.png differ diff --git a/src/res/mons/181_0.png b/src/res/mons/181_0.png new file mode 100644 index 0000000..a032381 Binary files /dev/null and b/src/res/mons/181_0.png differ diff --git a/src/res/mons/182_0.png b/src/res/mons/182_0.png new file mode 100644 index 0000000..351e1ad Binary files /dev/null and b/src/res/mons/182_0.png differ diff --git a/src/res/mons/185_0.png b/src/res/mons/185_0.png new file mode 100644 index 0000000..c937d13 Binary files /dev/null and b/src/res/mons/185_0.png differ diff --git a/src/res/mons/190_0.png b/src/res/mons/190_0.png new file mode 100644 index 0000000..a5630a2 Binary files /dev/null and b/src/res/mons/190_0.png differ diff --git a/src/res/mons/193_0.png b/src/res/mons/193_0.png new file mode 100644 index 0000000..a0ccda6 Binary files /dev/null and b/src/res/mons/193_0.png differ diff --git a/src/res/mons/196_0.png b/src/res/mons/196_0.png new file mode 100644 index 0000000..95d7c2c Binary files /dev/null and b/src/res/mons/196_0.png differ diff --git a/src/res/mons/197_0.png b/src/res/mons/197_0.png new file mode 100644 index 0000000..c9e2fe7 Binary files /dev/null and b/src/res/mons/197_0.png differ diff --git a/src/res/mons/198_0.png b/src/res/mons/198_0.png new file mode 100644 index 0000000..87d5e13 Binary files /dev/null and b/src/res/mons/198_0.png differ diff --git a/src/res/mons/19_0.png b/src/res/mons/19_0.png new file mode 100644 index 0000000..4d96ff9 Binary files /dev/null and b/src/res/mons/19_0.png differ diff --git a/src/res/mons/200_0.png b/src/res/mons/200_0.png new file mode 100644 index 0000000..43fea2b Binary files /dev/null and b/src/res/mons/200_0.png differ diff --git a/src/res/mons/203_0.png b/src/res/mons/203_0.png new file mode 100644 index 0000000..4d9f9a6 Binary files /dev/null and b/src/res/mons/203_0.png differ diff --git a/src/res/mons/204_0.png b/src/res/mons/204_0.png new file mode 100644 index 0000000..0efe891 Binary files /dev/null and b/src/res/mons/204_0.png differ diff --git a/src/res/mons/205_0.png b/src/res/mons/205_0.png new file mode 100644 index 0000000..829bcdb Binary files /dev/null and b/src/res/mons/205_0.png differ diff --git a/src/res/mons/207_0.png b/src/res/mons/207_0.png new file mode 100644 index 0000000..efe71a6 Binary files /dev/null and b/src/res/mons/207_0.png differ diff --git a/src/res/mons/20_0.png b/src/res/mons/20_0.png new file mode 100644 index 0000000..2057216 Binary files /dev/null and b/src/res/mons/20_0.png differ diff --git a/src/res/mons/211_0.png b/src/res/mons/211_0.png new file mode 100644 index 0000000..ddd9945 Binary files /dev/null and b/src/res/mons/211_0.png differ diff --git a/src/res/mons/212_0.png b/src/res/mons/212_0.png new file mode 100644 index 0000000..df3a228 Binary files /dev/null and b/src/res/mons/212_0.png differ diff --git a/src/res/mons/215_0.png b/src/res/mons/215_0.png new file mode 100644 index 0000000..6fb6d6e Binary files /dev/null and b/src/res/mons/215_0.png differ diff --git a/src/res/mons/218_0.png b/src/res/mons/218_0.png new file mode 100644 index 0000000..3440003 Binary files /dev/null and b/src/res/mons/218_0.png differ diff --git a/src/res/mons/219_0.png b/src/res/mons/219_0.png new file mode 100644 index 0000000..72f181f Binary files /dev/null and b/src/res/mons/219_0.png differ diff --git a/src/res/mons/21_0.png b/src/res/mons/21_0.png new file mode 100644 index 0000000..af89611 Binary files /dev/null and b/src/res/mons/21_0.png differ diff --git a/src/res/mons/220_0.png b/src/res/mons/220_0.png new file mode 100644 index 0000000..998dcd2 Binary files /dev/null and b/src/res/mons/220_0.png differ diff --git a/src/res/mons/221_0.png b/src/res/mons/221_0.png new file mode 100644 index 0000000..43218e9 Binary files /dev/null and b/src/res/mons/221_0.png differ diff --git a/src/res/mons/222_0.png b/src/res/mons/222_0.png new file mode 100644 index 0000000..c9b5265 Binary files /dev/null and b/src/res/mons/222_0.png differ diff --git a/src/res/mons/225_0.png b/src/res/mons/225_0.png new file mode 100644 index 0000000..9d2a61d Binary files /dev/null and b/src/res/mons/225_0.png differ diff --git a/src/res/mons/226_0.png b/src/res/mons/226_0.png new file mode 100644 index 0000000..928c489 Binary files /dev/null and b/src/res/mons/226_0.png differ diff --git a/src/res/mons/227_0.png b/src/res/mons/227_0.png new file mode 100644 index 0000000..fe7a483 Binary files /dev/null and b/src/res/mons/227_0.png differ diff --git a/src/res/mons/228_0.png b/src/res/mons/228_0.png new file mode 100644 index 0000000..adc0ff7 Binary files /dev/null and b/src/res/mons/228_0.png differ diff --git a/src/res/mons/229_0.png b/src/res/mons/229_0.png new file mode 100644 index 0000000..8471cbf Binary files /dev/null and b/src/res/mons/229_0.png differ diff --git a/src/res/mons/22_0.png b/src/res/mons/22_0.png new file mode 100644 index 0000000..1a7e836 Binary files /dev/null and b/src/res/mons/22_0.png differ diff --git a/src/res/mons/230_0.png b/src/res/mons/230_0.png new file mode 100644 index 0000000..1a184f6 Binary files /dev/null and b/src/res/mons/230_0.png differ diff --git a/src/res/mons/236_0.png b/src/res/mons/236_0.png new file mode 100644 index 0000000..c9aaa69 Binary files /dev/null and b/src/res/mons/236_0.png differ diff --git a/src/res/mons/239_0.png b/src/res/mons/239_0.png new file mode 100644 index 0000000..68e87b4 Binary files /dev/null and b/src/res/mons/239_0.png differ diff --git a/src/res/mons/240_0.png b/src/res/mons/240_0.png new file mode 100644 index 0000000..196104a Binary files /dev/null and b/src/res/mons/240_0.png differ diff --git a/src/res/mons/241_0.png b/src/res/mons/241_0.png new file mode 100644 index 0000000..91bee81 Binary files /dev/null and b/src/res/mons/241_0.png differ diff --git a/src/res/mons/246_0.png b/src/res/mons/246_0.png new file mode 100644 index 0000000..e736aa5 Binary files /dev/null and b/src/res/mons/246_0.png differ diff --git a/src/res/mons/247_0.png b/src/res/mons/247_0.png new file mode 100644 index 0000000..22c7085 Binary files /dev/null and b/src/res/mons/247_0.png differ diff --git a/src/res/mons/248_0.png b/src/res/mons/248_0.png new file mode 100644 index 0000000..d41565f Binary files /dev/null and b/src/res/mons/248_0.png differ diff --git a/src/res/mons/251_0.png b/src/res/mons/251_0.png new file mode 100644 index 0000000..ebc3dae Binary files /dev/null and b/src/res/mons/251_0.png differ diff --git a/src/res/mons/252_0.png b/src/res/mons/252_0.png new file mode 100644 index 0000000..cb7dde4 Binary files /dev/null and b/src/res/mons/252_0.png differ diff --git a/src/res/mons/253_0.png b/src/res/mons/253_0.png new file mode 100644 index 0000000..7a5f8ad Binary files /dev/null and b/src/res/mons/253_0.png differ diff --git a/src/res/mons/254_0.png b/src/res/mons/254_0.png new file mode 100644 index 0000000..0c61b49 Binary files /dev/null and b/src/res/mons/254_0.png differ diff --git a/src/res/mons/255_0.png b/src/res/mons/255_0.png new file mode 100644 index 0000000..59ac614 Binary files /dev/null and b/src/res/mons/255_0.png differ diff --git a/src/res/mons/256_0.png b/src/res/mons/256_0.png new file mode 100644 index 0000000..b64983e Binary files /dev/null and b/src/res/mons/256_0.png differ diff --git a/src/res/mons/257_0.png b/src/res/mons/257_0.png new file mode 100644 index 0000000..a1d3ba2 Binary files /dev/null and b/src/res/mons/257_0.png differ diff --git a/src/res/mons/258_0.png b/src/res/mons/258_0.png new file mode 100644 index 0000000..af3551d Binary files /dev/null and b/src/res/mons/258_0.png differ diff --git a/src/res/mons/259_0.png b/src/res/mons/259_0.png new file mode 100644 index 0000000..99ec5e9 Binary files /dev/null and b/src/res/mons/259_0.png differ diff --git a/src/res/mons/25_0.png b/src/res/mons/25_0.png new file mode 100644 index 0000000..c3e2a77 Binary files /dev/null and b/src/res/mons/25_0.png differ diff --git a/src/res/mons/260_0.png b/src/res/mons/260_0.png new file mode 100644 index 0000000..0d62dab Binary files /dev/null and b/src/res/mons/260_0.png differ diff --git a/src/res/mons/26_0.png b/src/res/mons/26_0.png new file mode 100644 index 0000000..ac377f3 Binary files /dev/null and b/src/res/mons/26_0.png differ diff --git a/src/res/mons/273_0.png b/src/res/mons/273_0.png new file mode 100644 index 0000000..249b84f Binary files /dev/null and b/src/res/mons/273_0.png differ diff --git a/src/res/mons/274_0.png b/src/res/mons/274_0.png new file mode 100644 index 0000000..4cb31c7 Binary files /dev/null and b/src/res/mons/274_0.png differ diff --git a/src/res/mons/275_0.png b/src/res/mons/275_0.png new file mode 100644 index 0000000..8e4fc57 Binary files /dev/null and b/src/res/mons/275_0.png differ diff --git a/src/res/mons/276_0.png b/src/res/mons/276_0.png new file mode 100644 index 0000000..b168ac1 Binary files /dev/null and b/src/res/mons/276_0.png differ diff --git a/src/res/mons/277_0.png b/src/res/mons/277_0.png new file mode 100644 index 0000000..1b20a8e Binary files /dev/null and b/src/res/mons/277_0.png differ diff --git a/src/res/mons/278_0.png b/src/res/mons/278_0.png new file mode 100644 index 0000000..e1beab7 Binary files /dev/null and b/src/res/mons/278_0.png differ diff --git a/src/res/mons/279_0.png b/src/res/mons/279_0.png new file mode 100644 index 0000000..507df76 Binary files /dev/null and b/src/res/mons/279_0.png differ diff --git a/src/res/mons/27_0.png b/src/res/mons/27_0.png new file mode 100644 index 0000000..8eeb4de Binary files /dev/null and b/src/res/mons/27_0.png differ diff --git a/src/res/mons/280_0.png b/src/res/mons/280_0.png new file mode 100644 index 0000000..420bd33 Binary files /dev/null and b/src/res/mons/280_0.png differ diff --git a/src/res/mons/281_0.png b/src/res/mons/281_0.png new file mode 100644 index 0000000..0165540 Binary files /dev/null and b/src/res/mons/281_0.png differ diff --git a/src/res/mons/282_0.png b/src/res/mons/282_0.png new file mode 100644 index 0000000..1513470 Binary files /dev/null and b/src/res/mons/282_0.png differ diff --git a/src/res/mons/287_0.png b/src/res/mons/287_0.png new file mode 100644 index 0000000..2ed69f2 Binary files /dev/null and b/src/res/mons/287_0.png differ diff --git a/src/res/mons/28_0.png b/src/res/mons/28_0.png new file mode 100644 index 0000000..cd3a728 Binary files /dev/null and b/src/res/mons/28_0.png differ diff --git a/src/res/mons/291_0.png b/src/res/mons/291_0.png new file mode 100644 index 0000000..1ca07f7 Binary files /dev/null and b/src/res/mons/291_0.png differ diff --git a/src/res/mons/296_0.png b/src/res/mons/296_0.png new file mode 100644 index 0000000..9f8f273 Binary files /dev/null and b/src/res/mons/296_0.png differ diff --git a/src/res/mons/297_0.png b/src/res/mons/297_0.png new file mode 100644 index 0000000..071d36f Binary files /dev/null and b/src/res/mons/297_0.png differ diff --git a/src/res/mons/299_0.png b/src/res/mons/299_0.png new file mode 100644 index 0000000..b002558 Binary files /dev/null and b/src/res/mons/299_0.png differ diff --git a/src/res/mons/302_0.png b/src/res/mons/302_0.png new file mode 100644 index 0000000..af31675 Binary files /dev/null and b/src/res/mons/302_0.png differ diff --git a/src/res/mons/303_0.png b/src/res/mons/303_0.png new file mode 100644 index 0000000..d7d528f Binary files /dev/null and b/src/res/mons/303_0.png differ diff --git a/src/res/mons/304_0.png b/src/res/mons/304_0.png new file mode 100644 index 0000000..3cb7c31 Binary files /dev/null and b/src/res/mons/304_0.png differ diff --git a/src/res/mons/305_0.png b/src/res/mons/305_0.png new file mode 100644 index 0000000..5d7f20f Binary files /dev/null and b/src/res/mons/305_0.png differ diff --git a/src/res/mons/306_0.png b/src/res/mons/306_0.png new file mode 100644 index 0000000..52f66c1 Binary files /dev/null and b/src/res/mons/306_0.png differ diff --git a/src/res/mons/311_0.png b/src/res/mons/311_0.png new file mode 100644 index 0000000..66ae04d Binary files /dev/null and b/src/res/mons/311_0.png differ diff --git a/src/res/mons/312_0.png b/src/res/mons/312_0.png new file mode 100644 index 0000000..1b8c330 Binary files /dev/null and b/src/res/mons/312_0.png differ diff --git a/src/res/mons/315_0.png b/src/res/mons/315_0.png new file mode 100644 index 0000000..50cd6a2 Binary files /dev/null and b/src/res/mons/315_0.png differ diff --git a/src/res/mons/319_0.png b/src/res/mons/319_0.png new file mode 100644 index 0000000..f9146e0 Binary files /dev/null and b/src/res/mons/319_0.png differ diff --git a/src/res/mons/320_0.png b/src/res/mons/320_0.png new file mode 100644 index 0000000..61f7b06 Binary files /dev/null and b/src/res/mons/320_0.png differ diff --git a/src/res/mons/321_0.png b/src/res/mons/321_0.png new file mode 100644 index 0000000..c313e04 Binary files /dev/null and b/src/res/mons/321_0.png differ diff --git a/src/res/mons/322_0.png b/src/res/mons/322_0.png new file mode 100644 index 0000000..ec60ee4 Binary files /dev/null and b/src/res/mons/322_0.png differ diff --git a/src/res/mons/323_0.png b/src/res/mons/323_0.png new file mode 100644 index 0000000..fc1fc20 Binary files /dev/null and b/src/res/mons/323_0.png differ diff --git a/src/res/mons/324_0.png b/src/res/mons/324_0.png new file mode 100644 index 0000000..3c35746 Binary files /dev/null and b/src/res/mons/324_0.png differ diff --git a/src/res/mons/330_0.png b/src/res/mons/330_0.png new file mode 100644 index 0000000..4408558 Binary files /dev/null and b/src/res/mons/330_0.png differ diff --git a/src/res/mons/331_0.png b/src/res/mons/331_0.png new file mode 100644 index 0000000..cab4d4e Binary files /dev/null and b/src/res/mons/331_0.png differ diff --git a/src/res/mons/332_0.png b/src/res/mons/332_0.png new file mode 100644 index 0000000..7cc7356 Binary files /dev/null and b/src/res/mons/332_0.png differ diff --git a/src/res/mons/334_0.png b/src/res/mons/334_0.png new file mode 100644 index 0000000..628b272 Binary files /dev/null and b/src/res/mons/334_0.png differ diff --git a/src/res/mons/344_0.png b/src/res/mons/344_0.png new file mode 100644 index 0000000..25e6de6 Binary files /dev/null and b/src/res/mons/344_0.png differ diff --git a/src/res/mons/353_0.png b/src/res/mons/353_0.png new file mode 100644 index 0000000..28c683a Binary files /dev/null and b/src/res/mons/353_0.png differ diff --git a/src/res/mons/354_0.png b/src/res/mons/354_0.png new file mode 100644 index 0000000..bbefe68 Binary files /dev/null and b/src/res/mons/354_0.png differ diff --git a/src/res/mons/355_0.png b/src/res/mons/355_0.png new file mode 100644 index 0000000..bdcfb7f Binary files /dev/null and b/src/res/mons/355_0.png differ diff --git a/src/res/mons/356_0.png b/src/res/mons/356_0.png new file mode 100644 index 0000000..384541d Binary files /dev/null and b/src/res/mons/356_0.png differ diff --git a/src/res/mons/359_0.png b/src/res/mons/359_0.png new file mode 100644 index 0000000..9652a89 Binary files /dev/null and b/src/res/mons/359_0.png differ diff --git a/src/res/mons/361_0.png b/src/res/mons/361_0.png new file mode 100644 index 0000000..0a83770 Binary files /dev/null and b/src/res/mons/361_0.png differ diff --git a/src/res/mons/362_0.png b/src/res/mons/362_0.png new file mode 100644 index 0000000..600cf66 Binary files /dev/null and b/src/res/mons/362_0.png differ diff --git a/src/res/mons/363_0.png b/src/res/mons/363_0.png new file mode 100644 index 0000000..5afa469 Binary files /dev/null and b/src/res/mons/363_0.png differ diff --git a/src/res/mons/364_0.png b/src/res/mons/364_0.png new file mode 100644 index 0000000..ba06fdf Binary files /dev/null and b/src/res/mons/364_0.png differ diff --git a/src/res/mons/365_0.png b/src/res/mons/365_0.png new file mode 100644 index 0000000..9858107 Binary files /dev/null and b/src/res/mons/365_0.png differ diff --git a/src/res/mons/367_0.png b/src/res/mons/367_0.png new file mode 100644 index 0000000..ab58423 Binary files /dev/null and b/src/res/mons/367_0.png differ diff --git a/src/res/mons/368_0.png b/src/res/mons/368_0.png new file mode 100644 index 0000000..4a500af Binary files /dev/null and b/src/res/mons/368_0.png differ diff --git a/src/res/mons/371_0.png b/src/res/mons/371_0.png new file mode 100644 index 0000000..4596195 Binary files /dev/null and b/src/res/mons/371_0.png differ diff --git a/src/res/mons/372_0.png b/src/res/mons/372_0.png new file mode 100644 index 0000000..13609a7 Binary files /dev/null and b/src/res/mons/372_0.png differ diff --git a/src/res/mons/373_0.png b/src/res/mons/373_0.png new file mode 100644 index 0000000..07f7816 Binary files /dev/null and b/src/res/mons/373_0.png differ diff --git a/src/res/mons/377_0.png b/src/res/mons/377_0.png new file mode 100644 index 0000000..931e4d8 Binary files /dev/null and b/src/res/mons/377_0.png differ diff --git a/src/res/mons/378_0.png b/src/res/mons/378_0.png new file mode 100644 index 0000000..a65ad87 Binary files /dev/null and b/src/res/mons/378_0.png differ diff --git a/src/res/mons/379_0.png b/src/res/mons/379_0.png new file mode 100644 index 0000000..5e5a8fe Binary files /dev/null and b/src/res/mons/379_0.png differ diff --git a/src/res/mons/37_0.png b/src/res/mons/37_0.png new file mode 100644 index 0000000..97e1d91 Binary files /dev/null and b/src/res/mons/37_0.png differ diff --git a/src/res/mons/387_0.png b/src/res/mons/387_0.png new file mode 100644 index 0000000..a891b94 Binary files /dev/null and b/src/res/mons/387_0.png differ diff --git a/src/res/mons/388_0.png b/src/res/mons/388_0.png new file mode 100644 index 0000000..31da006 Binary files /dev/null and b/src/res/mons/388_0.png differ diff --git a/src/res/mons/389_0.png b/src/res/mons/389_0.png new file mode 100644 index 0000000..7ec9c24 Binary files /dev/null and b/src/res/mons/389_0.png differ diff --git a/src/res/mons/38_0.png b/src/res/mons/38_0.png new file mode 100644 index 0000000..0fbe155 Binary files /dev/null and b/src/res/mons/38_0.png differ diff --git a/src/res/mons/390_0.png b/src/res/mons/390_0.png new file mode 100644 index 0000000..41a1a15 Binary files /dev/null and b/src/res/mons/390_0.png differ diff --git a/src/res/mons/391_0.png b/src/res/mons/391_0.png new file mode 100644 index 0000000..727d8a9 Binary files /dev/null and b/src/res/mons/391_0.png differ diff --git a/src/res/mons/392_0.png b/src/res/mons/392_0.png new file mode 100644 index 0000000..9e0ccf1 Binary files /dev/null and b/src/res/mons/392_0.png differ diff --git a/src/res/mons/393_0.png b/src/res/mons/393_0.png new file mode 100644 index 0000000..c67d614 Binary files /dev/null and b/src/res/mons/393_0.png differ diff --git a/src/res/mons/394_0.png b/src/res/mons/394_0.png new file mode 100644 index 0000000..6607d69 Binary files /dev/null and b/src/res/mons/394_0.png differ diff --git a/src/res/mons/395_0.png b/src/res/mons/395_0.png new file mode 100644 index 0000000..36bb56f Binary files /dev/null and b/src/res/mons/395_0.png differ diff --git a/src/res/mons/396_0.png b/src/res/mons/396_0.png new file mode 100644 index 0000000..63b2c52 Binary files /dev/null and b/src/res/mons/396_0.png differ diff --git a/src/res/mons/397_0.png b/src/res/mons/397_0.png new file mode 100644 index 0000000..2f8eaeb Binary files /dev/null and b/src/res/mons/397_0.png differ diff --git a/src/res/mons/398_0.png b/src/res/mons/398_0.png new file mode 100644 index 0000000..5f015cb Binary files /dev/null and b/src/res/mons/398_0.png differ diff --git a/src/res/mons/399_0.png b/src/res/mons/399_0.png new file mode 100644 index 0000000..0fd66f8 Binary files /dev/null and b/src/res/mons/399_0.png differ diff --git a/src/res/mons/39_0.png b/src/res/mons/39_0.png new file mode 100644 index 0000000..bcc9b45 Binary files /dev/null and b/src/res/mons/39_0.png differ diff --git a/src/res/mons/400_0.png b/src/res/mons/400_0.png new file mode 100644 index 0000000..a325fd0 Binary files /dev/null and b/src/res/mons/400_0.png differ diff --git a/src/res/mons/401_0.png b/src/res/mons/401_0.png new file mode 100644 index 0000000..dbe3ea2 Binary files /dev/null and b/src/res/mons/401_0.png differ diff --git a/src/res/mons/402_0.png b/src/res/mons/402_0.png new file mode 100644 index 0000000..a6614fe Binary files /dev/null and b/src/res/mons/402_0.png differ diff --git a/src/res/mons/403_0.png b/src/res/mons/403_0.png new file mode 100644 index 0000000..1b7e696 Binary files /dev/null and b/src/res/mons/403_0.png differ diff --git a/src/res/mons/404_0.png b/src/res/mons/404_0.png new file mode 100644 index 0000000..a5e70df Binary files /dev/null and b/src/res/mons/404_0.png differ diff --git a/src/res/mons/405_0.png b/src/res/mons/405_0.png new file mode 100644 index 0000000..12511b0 Binary files /dev/null and b/src/res/mons/405_0.png differ diff --git a/src/res/mons/406_0.png b/src/res/mons/406_0.png new file mode 100644 index 0000000..b9e646b Binary files /dev/null and b/src/res/mons/406_0.png differ diff --git a/src/res/mons/407_0.png b/src/res/mons/407_0.png new file mode 100644 index 0000000..c91d67a Binary files /dev/null and b/src/res/mons/407_0.png differ diff --git a/src/res/mons/408_0.png b/src/res/mons/408_0.png new file mode 100644 index 0000000..f147137 Binary files /dev/null and b/src/res/mons/408_0.png differ diff --git a/src/res/mons/409_0.png b/src/res/mons/409_0.png new file mode 100644 index 0000000..0ba10c6 Binary files /dev/null and b/src/res/mons/409_0.png differ diff --git a/src/res/mons/40_0.png b/src/res/mons/40_0.png new file mode 100644 index 0000000..82561c9 Binary files /dev/null and b/src/res/mons/40_0.png differ diff --git a/src/res/mons/410_0.png b/src/res/mons/410_0.png new file mode 100644 index 0000000..b4a85a3 Binary files /dev/null and b/src/res/mons/410_0.png differ diff --git a/src/res/mons/411_0.png b/src/res/mons/411_0.png new file mode 100644 index 0000000..0d527c5 Binary files /dev/null and b/src/res/mons/411_0.png differ diff --git a/src/res/mons/412_0.png b/src/res/mons/412_0.png new file mode 100644 index 0000000..f792830 Binary files /dev/null and b/src/res/mons/412_0.png differ diff --git a/src/res/mons/412_1.png b/src/res/mons/412_1.png new file mode 100644 index 0000000..9dea615 Binary files /dev/null and b/src/res/mons/412_1.png differ diff --git a/src/res/mons/412_2.png b/src/res/mons/412_2.png new file mode 100644 index 0000000..9902576 Binary files /dev/null and b/src/res/mons/412_2.png differ diff --git a/src/res/mons/413_0.png b/src/res/mons/413_0.png new file mode 100644 index 0000000..7a31ddb Binary files /dev/null and b/src/res/mons/413_0.png differ diff --git a/src/res/mons/413_1.png b/src/res/mons/413_1.png new file mode 100644 index 0000000..4bec54a Binary files /dev/null and b/src/res/mons/413_1.png differ diff --git a/src/res/mons/413_2.png b/src/res/mons/413_2.png new file mode 100644 index 0000000..52c27b6 Binary files /dev/null and b/src/res/mons/413_2.png differ diff --git a/src/res/mons/414_0.png b/src/res/mons/414_0.png new file mode 100644 index 0000000..e14b0d0 Binary files /dev/null and b/src/res/mons/414_0.png differ diff --git a/src/res/mons/415_0.png b/src/res/mons/415_0.png new file mode 100644 index 0000000..7bcddc8 Binary files /dev/null and b/src/res/mons/415_0.png differ diff --git a/src/res/mons/416_0.png b/src/res/mons/416_0.png new file mode 100644 index 0000000..d2b86a6 Binary files /dev/null and b/src/res/mons/416_0.png differ diff --git a/src/res/mons/417_0.png b/src/res/mons/417_0.png new file mode 100644 index 0000000..d19bcc2 Binary files /dev/null and b/src/res/mons/417_0.png differ diff --git a/src/res/mons/418_0.png b/src/res/mons/418_0.png new file mode 100644 index 0000000..2173a19 Binary files /dev/null and b/src/res/mons/418_0.png differ diff --git a/src/res/mons/419_0.png b/src/res/mons/419_0.png new file mode 100644 index 0000000..ba21d37 Binary files /dev/null and b/src/res/mons/419_0.png differ diff --git a/src/res/mons/41_0.png b/src/res/mons/41_0.png new file mode 100644 index 0000000..fd20f6c Binary files /dev/null and b/src/res/mons/41_0.png differ diff --git a/src/res/mons/420_0.png b/src/res/mons/420_0.png new file mode 100644 index 0000000..0611816 Binary files /dev/null and b/src/res/mons/420_0.png differ diff --git a/src/res/mons/421_0.png b/src/res/mons/421_0.png new file mode 100644 index 0000000..f097424 Binary files /dev/null and b/src/res/mons/421_0.png differ diff --git a/src/res/mons/421_1.png b/src/res/mons/421_1.png new file mode 100644 index 0000000..605e0ef Binary files /dev/null and b/src/res/mons/421_1.png differ diff --git a/src/res/mons/422_0.png b/src/res/mons/422_0.png new file mode 100644 index 0000000..1c78162 Binary files /dev/null and b/src/res/mons/422_0.png differ diff --git a/src/res/mons/422_1.png b/src/res/mons/422_1.png new file mode 100644 index 0000000..a89a864 Binary files /dev/null and b/src/res/mons/422_1.png differ diff --git a/src/res/mons/423_0.png b/src/res/mons/423_0.png new file mode 100644 index 0000000..473a06b Binary files /dev/null and b/src/res/mons/423_0.png differ diff --git a/src/res/mons/423_1.png b/src/res/mons/423_1.png new file mode 100644 index 0000000..bfd98a8 Binary files /dev/null and b/src/res/mons/423_1.png differ diff --git a/src/res/mons/424_0.png b/src/res/mons/424_0.png new file mode 100644 index 0000000..04a0b67 Binary files /dev/null and b/src/res/mons/424_0.png differ diff --git a/src/res/mons/425_0.png b/src/res/mons/425_0.png new file mode 100644 index 0000000..1d1b572 Binary files /dev/null and b/src/res/mons/425_0.png differ diff --git a/src/res/mons/426_0.png b/src/res/mons/426_0.png new file mode 100644 index 0000000..d2c398f Binary files /dev/null and b/src/res/mons/426_0.png differ diff --git a/src/res/mons/427_0.png b/src/res/mons/427_0.png new file mode 100644 index 0000000..6867e07 Binary files /dev/null and b/src/res/mons/427_0.png differ diff --git a/src/res/mons/428_0.png b/src/res/mons/428_0.png new file mode 100644 index 0000000..da5c57b Binary files /dev/null and b/src/res/mons/428_0.png differ diff --git a/src/res/mons/429_0.png b/src/res/mons/429_0.png new file mode 100644 index 0000000..e2e1eb5 Binary files /dev/null and b/src/res/mons/429_0.png differ diff --git a/src/res/mons/42_0.png b/src/res/mons/42_0.png new file mode 100644 index 0000000..1fffde7 Binary files /dev/null and b/src/res/mons/42_0.png differ diff --git a/src/res/mons/430_0.png b/src/res/mons/430_0.png new file mode 100644 index 0000000..ea19727 Binary files /dev/null and b/src/res/mons/430_0.png differ diff --git a/src/res/mons/431_0.png b/src/res/mons/431_0.png new file mode 100644 index 0000000..2998ae1 Binary files /dev/null and b/src/res/mons/431_0.png differ diff --git a/src/res/mons/432_0.png b/src/res/mons/432_0.png new file mode 100644 index 0000000..68f1121 Binary files /dev/null and b/src/res/mons/432_0.png differ diff --git a/src/res/mons/433_0.png b/src/res/mons/433_0.png new file mode 100644 index 0000000..fa3deb8 Binary files /dev/null and b/src/res/mons/433_0.png differ diff --git a/src/res/mons/434_0.png b/src/res/mons/434_0.png new file mode 100644 index 0000000..e3cfdd2 Binary files /dev/null and b/src/res/mons/434_0.png differ diff --git a/src/res/mons/435_0.png b/src/res/mons/435_0.png new file mode 100644 index 0000000..cf4f631 Binary files /dev/null and b/src/res/mons/435_0.png differ diff --git a/src/res/mons/436_0.png b/src/res/mons/436_0.png new file mode 100644 index 0000000..e4d33e3 Binary files /dev/null and b/src/res/mons/436_0.png differ diff --git a/src/res/mons/437_0.png b/src/res/mons/437_0.png new file mode 100644 index 0000000..ccb47c3 Binary files /dev/null and b/src/res/mons/437_0.png differ diff --git a/src/res/mons/438_0.png b/src/res/mons/438_0.png new file mode 100644 index 0000000..4818b22 Binary files /dev/null and b/src/res/mons/438_0.png differ diff --git a/src/res/mons/439_0.png b/src/res/mons/439_0.png new file mode 100644 index 0000000..8285fff Binary files /dev/null and b/src/res/mons/439_0.png differ diff --git a/src/res/mons/43_0.png b/src/res/mons/43_0.png new file mode 100644 index 0000000..b34b5ed Binary files /dev/null and b/src/res/mons/43_0.png differ diff --git a/src/res/mons/440_0.png b/src/res/mons/440_0.png new file mode 100644 index 0000000..dfd0cf7 Binary files /dev/null and b/src/res/mons/440_0.png differ diff --git a/src/res/mons/441_0.png b/src/res/mons/441_0.png new file mode 100644 index 0000000..09b627a Binary files /dev/null and b/src/res/mons/441_0.png differ diff --git a/src/res/mons/442_0.png b/src/res/mons/442_0.png new file mode 100644 index 0000000..6ca4646 Binary files /dev/null and b/src/res/mons/442_0.png differ diff --git a/src/res/mons/443_0.png b/src/res/mons/443_0.png new file mode 100644 index 0000000..c54b516 Binary files /dev/null and b/src/res/mons/443_0.png differ diff --git a/src/res/mons/444_0.png b/src/res/mons/444_0.png new file mode 100644 index 0000000..d86be3f Binary files /dev/null and b/src/res/mons/444_0.png differ diff --git a/src/res/mons/445_0.png b/src/res/mons/445_0.png new file mode 100644 index 0000000..9645ba5 Binary files /dev/null and b/src/res/mons/445_0.png differ diff --git a/src/res/mons/446_0.png b/src/res/mons/446_0.png new file mode 100644 index 0000000..6a707dc Binary files /dev/null and b/src/res/mons/446_0.png differ diff --git a/src/res/mons/447_0.png b/src/res/mons/447_0.png new file mode 100644 index 0000000..c915a25 Binary files /dev/null and b/src/res/mons/447_0.png differ diff --git a/src/res/mons/447_1.png b/src/res/mons/447_1.png new file mode 100644 index 0000000..1f99771 Binary files /dev/null and b/src/res/mons/447_1.png differ diff --git a/src/res/mons/448_0.png b/src/res/mons/448_0.png new file mode 100644 index 0000000..496a8f2 Binary files /dev/null and b/src/res/mons/448_0.png differ diff --git a/src/res/mons/448_1.png b/src/res/mons/448_1.png new file mode 100644 index 0000000..d0e36ee Binary files /dev/null and b/src/res/mons/448_1.png differ diff --git a/src/res/mons/449_0.png b/src/res/mons/449_0.png new file mode 100644 index 0000000..c91e789 Binary files /dev/null and b/src/res/mons/449_0.png differ diff --git a/src/res/mons/44_0.png b/src/res/mons/44_0.png new file mode 100644 index 0000000..7684c1b Binary files /dev/null and b/src/res/mons/44_0.png differ diff --git a/src/res/mons/450_0.png b/src/res/mons/450_0.png new file mode 100644 index 0000000..f42d0c2 Binary files /dev/null and b/src/res/mons/450_0.png differ diff --git a/src/res/mons/451_0.png b/src/res/mons/451_0.png new file mode 100644 index 0000000..4fafbea Binary files /dev/null and b/src/res/mons/451_0.png differ diff --git a/src/res/mons/452_0.png b/src/res/mons/452_0.png new file mode 100644 index 0000000..9c22490 Binary files /dev/null and b/src/res/mons/452_0.png differ diff --git a/src/res/mons/453_0.png b/src/res/mons/453_0.png new file mode 100644 index 0000000..9d1e435 Binary files /dev/null and b/src/res/mons/453_0.png differ diff --git a/src/res/mons/454_0.png b/src/res/mons/454_0.png new file mode 100644 index 0000000..cf6b8f9 Binary files /dev/null and b/src/res/mons/454_0.png differ diff --git a/src/res/mons/455_0.png b/src/res/mons/455_0.png new file mode 100644 index 0000000..7cb4e53 Binary files /dev/null and b/src/res/mons/455_0.png differ diff --git a/src/res/mons/456_0.png b/src/res/mons/456_0.png new file mode 100644 index 0000000..f4864ba Binary files /dev/null and b/src/res/mons/456_0.png differ diff --git a/src/res/mons/457_0.png b/src/res/mons/457_0.png new file mode 100644 index 0000000..c2fd670 Binary files /dev/null and b/src/res/mons/457_0.png differ diff --git a/src/res/mons/458_0.png b/src/res/mons/458_0.png new file mode 100644 index 0000000..5ca68d2 Binary files /dev/null and b/src/res/mons/458_0.png differ diff --git a/src/res/mons/459_0.png b/src/res/mons/459_0.png new file mode 100644 index 0000000..48a6452 Binary files /dev/null and b/src/res/mons/459_0.png differ diff --git a/src/res/mons/45_0.png b/src/res/mons/45_0.png new file mode 100644 index 0000000..e386735 Binary files /dev/null and b/src/res/mons/45_0.png differ diff --git a/src/res/mons/460_0.png b/src/res/mons/460_0.png new file mode 100644 index 0000000..9e6eea6 Binary files /dev/null and b/src/res/mons/460_0.png differ diff --git a/src/res/mons/461_0.png b/src/res/mons/461_0.png new file mode 100644 index 0000000..3dbed29 Binary files /dev/null and b/src/res/mons/461_0.png differ diff --git a/src/res/mons/462_0.png b/src/res/mons/462_0.png new file mode 100644 index 0000000..3fd9e54 Binary files /dev/null and b/src/res/mons/462_0.png differ diff --git a/src/res/mons/463_0.png b/src/res/mons/463_0.png new file mode 100644 index 0000000..672d705 Binary files /dev/null and b/src/res/mons/463_0.png differ diff --git a/src/res/mons/464_0.png b/src/res/mons/464_0.png new file mode 100644 index 0000000..9dca75e Binary files /dev/null and b/src/res/mons/464_0.png differ diff --git a/src/res/mons/465_0.png b/src/res/mons/465_0.png new file mode 100644 index 0000000..4113ab4 Binary files /dev/null and b/src/res/mons/465_0.png differ diff --git a/src/res/mons/466_0.png b/src/res/mons/466_0.png new file mode 100644 index 0000000..e619360 Binary files /dev/null and b/src/res/mons/466_0.png differ diff --git a/src/res/mons/467_0.png b/src/res/mons/467_0.png new file mode 100644 index 0000000..2a8d44c Binary files /dev/null and b/src/res/mons/467_0.png differ diff --git a/src/res/mons/468_0.png b/src/res/mons/468_0.png new file mode 100644 index 0000000..6c892a7 Binary files /dev/null and b/src/res/mons/468_0.png differ diff --git a/src/res/mons/469_0.png b/src/res/mons/469_0.png new file mode 100644 index 0000000..f7d4f4a Binary files /dev/null and b/src/res/mons/469_0.png differ diff --git a/src/res/mons/470_0.png b/src/res/mons/470_0.png new file mode 100644 index 0000000..48d3102 Binary files /dev/null and b/src/res/mons/470_0.png differ diff --git a/src/res/mons/471_0.png b/src/res/mons/471_0.png new file mode 100644 index 0000000..62fc0f5 Binary files /dev/null and b/src/res/mons/471_0.png differ diff --git a/src/res/mons/472_0.png b/src/res/mons/472_0.png new file mode 100644 index 0000000..9021e8b Binary files /dev/null and b/src/res/mons/472_0.png differ diff --git a/src/res/mons/473_0.png b/src/res/mons/473_0.png new file mode 100644 index 0000000..ba444e0 Binary files /dev/null and b/src/res/mons/473_0.png differ diff --git a/src/res/mons/474_0.png b/src/res/mons/474_0.png new file mode 100644 index 0000000..bd8a960 Binary files /dev/null and b/src/res/mons/474_0.png differ diff --git a/src/res/mons/475_0.png b/src/res/mons/475_0.png new file mode 100644 index 0000000..6d1548a Binary files /dev/null and b/src/res/mons/475_0.png differ diff --git a/src/res/mons/476_0.png b/src/res/mons/476_0.png new file mode 100644 index 0000000..da810a2 Binary files /dev/null and b/src/res/mons/476_0.png differ diff --git a/src/res/mons/477_0.png b/src/res/mons/477_0.png new file mode 100644 index 0000000..04eb3b1 Binary files /dev/null and b/src/res/mons/477_0.png differ diff --git a/src/res/mons/478_0.png b/src/res/mons/478_0.png new file mode 100644 index 0000000..1ee21e3 Binary files /dev/null and b/src/res/mons/478_0.png differ diff --git a/src/res/mons/483_0.png b/src/res/mons/483_0.png new file mode 100644 index 0000000..81a4689 Binary files /dev/null and b/src/res/mons/483_0.png differ diff --git a/src/res/mons/484_0.png b/src/res/mons/484_0.png new file mode 100644 index 0000000..ca7ff90 Binary files /dev/null and b/src/res/mons/484_0.png differ diff --git a/src/res/mons/485_0.png b/src/res/mons/485_0.png new file mode 100644 index 0000000..352504b Binary files /dev/null and b/src/res/mons/485_0.png differ diff --git a/src/res/mons/485_1.png b/src/res/mons/485_1.png new file mode 100644 index 0000000..2bfe40b Binary files /dev/null and b/src/res/mons/485_1.png differ diff --git a/src/res/mons/486_0.png b/src/res/mons/486_0.png new file mode 100644 index 0000000..c73671e Binary files /dev/null and b/src/res/mons/486_0.png differ diff --git a/src/res/mons/488_0.png b/src/res/mons/488_0.png new file mode 100644 index 0000000..00b1deb Binary files /dev/null and b/src/res/mons/488_0.png differ diff --git a/src/res/mons/488_1.png b/src/res/mons/488_1.png new file mode 100644 index 0000000..1145d50 Binary files /dev/null and b/src/res/mons/488_1.png differ diff --git a/src/res/mons/489_0.png b/src/res/mons/489_0.png new file mode 100644 index 0000000..e9fd839 Binary files /dev/null and b/src/res/mons/489_0.png differ diff --git a/src/res/mons/490_0.png b/src/res/mons/490_0.png new file mode 100644 index 0000000..5da1c94 Binary files /dev/null and b/src/res/mons/490_0.png differ diff --git a/src/res/mons/490_1.png b/src/res/mons/490_1.png new file mode 100644 index 0000000..d59ecb2 Binary files /dev/null and b/src/res/mons/490_1.png differ diff --git a/src/res/mons/491_0.png b/src/res/mons/491_0.png new file mode 100644 index 0000000..a79a599 Binary files /dev/null and b/src/res/mons/491_0.png differ diff --git a/src/res/mons/491_1.png b/src/res/mons/491_1.png new file mode 100644 index 0000000..a79a599 Binary files /dev/null and b/src/res/mons/491_1.png differ diff --git a/src/res/mons/492_0.png b/src/res/mons/492_0.png new file mode 100644 index 0000000..09bef24 Binary files /dev/null and b/src/res/mons/492_0.png differ diff --git a/src/res/mons/4_0.png b/src/res/mons/4_0.png new file mode 100644 index 0000000..09dc0df Binary files /dev/null and b/src/res/mons/4_0.png differ diff --git a/src/res/mons/56_0.png b/src/res/mons/56_0.png new file mode 100644 index 0000000..832c82e Binary files /dev/null and b/src/res/mons/56_0.png differ diff --git a/src/res/mons/57_0.png b/src/res/mons/57_0.png new file mode 100644 index 0000000..dfa5f66 Binary files /dev/null and b/src/res/mons/57_0.png differ diff --git a/src/res/mons/58_0.png b/src/res/mons/58_0.png new file mode 100644 index 0000000..cc9ba56 Binary files /dev/null and b/src/res/mons/58_0.png differ diff --git a/src/res/mons/59_0.png b/src/res/mons/59_0.png new file mode 100644 index 0000000..eb1436b Binary files /dev/null and b/src/res/mons/59_0.png differ diff --git a/src/res/mons/5_0.png b/src/res/mons/5_0.png new file mode 100644 index 0000000..8fe0cc4 Binary files /dev/null and b/src/res/mons/5_0.png differ diff --git a/src/res/mons/63_0.png b/src/res/mons/63_0.png new file mode 100644 index 0000000..799ca38 Binary files /dev/null and b/src/res/mons/63_0.png differ diff --git a/src/res/mons/65_0.png b/src/res/mons/65_0.png new file mode 100644 index 0000000..3bbe095 Binary files /dev/null and b/src/res/mons/65_0.png differ diff --git a/src/res/mons/66_0.png b/src/res/mons/66_0.png new file mode 100644 index 0000000..2df7e4d Binary files /dev/null and b/src/res/mons/66_0.png differ diff --git a/src/res/mons/67_0.png b/src/res/mons/67_0.png new file mode 100644 index 0000000..74032c7 Binary files /dev/null and b/src/res/mons/67_0.png differ diff --git a/src/res/mons/68_0.png b/src/res/mons/68_0.png new file mode 100644 index 0000000..bb63b2a Binary files /dev/null and b/src/res/mons/68_0.png differ diff --git a/src/res/mons/6_0.png b/src/res/mons/6_0.png new file mode 100644 index 0000000..52f970f Binary files /dev/null and b/src/res/mons/6_0.png differ diff --git a/src/res/mons/6_1.png b/src/res/mons/6_1.png new file mode 100644 index 0000000..e33b60a Binary files /dev/null and b/src/res/mons/6_1.png differ diff --git a/src/res/mons/71_0.png b/src/res/mons/71_0.png new file mode 100644 index 0000000..480c724 Binary files /dev/null and b/src/res/mons/71_0.png differ diff --git a/src/res/mons/73_0.png b/src/res/mons/73_0.png new file mode 100644 index 0000000..505c8c4 Binary files /dev/null and b/src/res/mons/73_0.png differ diff --git a/src/res/mons/74_0.png b/src/res/mons/74_0.png new file mode 100644 index 0000000..a227f07 Binary files /dev/null and b/src/res/mons/74_0.png differ diff --git a/src/res/mons/75_0.png b/src/res/mons/75_0.png new file mode 100644 index 0000000..c7e8af4 Binary files /dev/null and b/src/res/mons/75_0.png differ diff --git a/src/res/mons/76_0.png b/src/res/mons/76_0.png new file mode 100644 index 0000000..cc97829 Binary files /dev/null and b/src/res/mons/76_0.png differ diff --git a/src/res/mons/77_0.png b/src/res/mons/77_0.png new file mode 100644 index 0000000..06e5424 Binary files /dev/null and b/src/res/mons/77_0.png differ diff --git a/src/res/mons/78_0.png b/src/res/mons/78_0.png new file mode 100644 index 0000000..9511cd1 Binary files /dev/null and b/src/res/mons/78_0.png differ diff --git a/src/res/mons/7_0.png b/src/res/mons/7_0.png new file mode 100644 index 0000000..83cb09d Binary files /dev/null and b/src/res/mons/7_0.png differ diff --git a/src/res/mons/81_0.png b/src/res/mons/81_0.png new file mode 100644 index 0000000..e286385 Binary files /dev/null and b/src/res/mons/81_0.png differ diff --git a/src/res/mons/82_0.png b/src/res/mons/82_0.png new file mode 100644 index 0000000..2f4cfc4 Binary files /dev/null and b/src/res/mons/82_0.png differ diff --git a/src/res/mons/84_0.png b/src/res/mons/84_0.png new file mode 100644 index 0000000..adf0479 Binary files /dev/null and b/src/res/mons/84_0.png differ diff --git a/src/res/mons/85_0.png b/src/res/mons/85_0.png new file mode 100644 index 0000000..7a37132 Binary files /dev/null and b/src/res/mons/85_0.png differ diff --git a/src/res/mons/89_0.png b/src/res/mons/89_0.png new file mode 100644 index 0000000..d0c0b06 Binary files /dev/null and b/src/res/mons/89_0.png differ diff --git a/src/res/mons/8_0.png b/src/res/mons/8_0.png new file mode 100644 index 0000000..eec2d73 Binary files /dev/null and b/src/res/mons/8_0.png differ diff --git a/src/res/mons/92_0.png b/src/res/mons/92_0.png new file mode 100644 index 0000000..2aa1001 Binary files /dev/null and b/src/res/mons/92_0.png differ diff --git a/src/res/mons/93_0.png b/src/res/mons/93_0.png new file mode 100644 index 0000000..3d5fa5a Binary files /dev/null and b/src/res/mons/93_0.png differ diff --git a/src/res/mons/94_0.png b/src/res/mons/94_0.png new file mode 100644 index 0000000..1794693 Binary files /dev/null and b/src/res/mons/94_0.png differ diff --git a/src/res/mons/96_0.png b/src/res/mons/96_0.png new file mode 100644 index 0000000..f6ffad5 Binary files /dev/null and b/src/res/mons/96_0.png differ diff --git a/src/res/mons/97_0.png b/src/res/mons/97_0.png new file mode 100644 index 0000000..5e60991 Binary files /dev/null and b/src/res/mons/97_0.png differ diff --git a/src/res/mons/9_0.png b/src/res/mons/9_0.png new file mode 100644 index 0000000..cc26425 Binary files /dev/null and b/src/res/mons/9_0.png differ diff --git a/src/res/npcs/1.png b/src/res/npcs/1.png new file mode 100644 index 0000000..23835ee Binary files /dev/null and b/src/res/npcs/1.png differ diff --git a/src/res/npcs/10.png b/src/res/npcs/10.png new file mode 100644 index 0000000..f825fcc Binary files /dev/null and b/src/res/npcs/10.png differ diff --git a/src/res/npcs/11.png b/src/res/npcs/11.png new file mode 100644 index 0000000..2894866 Binary files /dev/null and b/src/res/npcs/11.png differ diff --git a/src/res/npcs/12.png b/src/res/npcs/12.png new file mode 100644 index 0000000..595ec0b Binary files /dev/null and b/src/res/npcs/12.png differ diff --git a/src/res/npcs/13.png b/src/res/npcs/13.png new file mode 100644 index 0000000..7d84ec3 Binary files /dev/null and b/src/res/npcs/13.png differ diff --git a/src/res/npcs/14.png b/src/res/npcs/14.png new file mode 100644 index 0000000..bc1c6a0 Binary files /dev/null and b/src/res/npcs/14.png differ diff --git a/src/res/npcs/15.png b/src/res/npcs/15.png new file mode 100644 index 0000000..a8618fb Binary files /dev/null and b/src/res/npcs/15.png differ diff --git a/src/res/npcs/16.png b/src/res/npcs/16.png new file mode 100644 index 0000000..9fb5786 Binary files /dev/null and b/src/res/npcs/16.png differ diff --git a/src/res/npcs/17.png b/src/res/npcs/17.png new file mode 100644 index 0000000..a4de637 Binary files /dev/null and b/src/res/npcs/17.png differ diff --git a/src/res/npcs/18.png b/src/res/npcs/18.png new file mode 100644 index 0000000..c2df7b1 Binary files /dev/null and b/src/res/npcs/18.png differ diff --git a/src/res/npcs/19.png b/src/res/npcs/19.png new file mode 100644 index 0000000..147c119 Binary files /dev/null and b/src/res/npcs/19.png differ diff --git a/src/res/npcs/2.png b/src/res/npcs/2.png new file mode 100644 index 0000000..06157b6 Binary files /dev/null and b/src/res/npcs/2.png differ diff --git a/src/res/npcs/3.png b/src/res/npcs/3.png new file mode 100644 index 0000000..38485f9 Binary files /dev/null and b/src/res/npcs/3.png differ diff --git a/src/res/npcs/4.png b/src/res/npcs/4.png new file mode 100644 index 0000000..f821add Binary files /dev/null and b/src/res/npcs/4.png differ diff --git a/src/res/npcs/5.png b/src/res/npcs/5.png new file mode 100644 index 0000000..d9114f0 Binary files /dev/null and b/src/res/npcs/5.png differ diff --git a/src/res/npcs/6.png b/src/res/npcs/6.png new file mode 100644 index 0000000..8d7cd8d Binary files /dev/null and b/src/res/npcs/6.png differ diff --git a/src/res/npcs/7.png b/src/res/npcs/7.png new file mode 100644 index 0000000..4f4d018 Binary files /dev/null and b/src/res/npcs/7.png differ diff --git a/src/res/npcs/8.png b/src/res/npcs/8.png new file mode 100644 index 0000000..1d5f2fa Binary files /dev/null and b/src/res/npcs/8.png differ diff --git a/src/res/npcs/9.png b/src/res/npcs/9.png new file mode 100644 index 0000000..47baa3b Binary files /dev/null and b/src/res/npcs/9.png differ diff --git a/src/res/targets/1.png b/src/res/targets/1.png new file mode 100644 index 0000000..ae4dcd1 Binary files /dev/null and b/src/res/targets/1.png differ diff --git a/src/res/targets/10.png b/src/res/targets/10.png new file mode 100644 index 0000000..9d08baf Binary files /dev/null and b/src/res/targets/10.png differ diff --git a/src/res/targets/108.png b/src/res/targets/108.png new file mode 100644 index 0000000..b046929 Binary files /dev/null and b/src/res/targets/108.png differ diff --git a/src/res/targets/109.png b/src/res/targets/109.png new file mode 100644 index 0000000..3d27a08 Binary files /dev/null and b/src/res/targets/109.png differ diff --git a/src/res/targets/11.png b/src/res/targets/11.png new file mode 100644 index 0000000..131af56 Binary files /dev/null and b/src/res/targets/11.png differ diff --git a/src/res/targets/12.png b/src/res/targets/12.png new file mode 100644 index 0000000..a6878d7 Binary files /dev/null and b/src/res/targets/12.png differ diff --git a/src/res/targets/13.png b/src/res/targets/13.png new file mode 100644 index 0000000..4c5cdda Binary files /dev/null and b/src/res/targets/13.png differ diff --git a/src/res/targets/130.png b/src/res/targets/130.png new file mode 100644 index 0000000..655576f Binary files /dev/null and b/src/res/targets/130.png differ diff --git a/src/res/targets/131.png b/src/res/targets/131.png new file mode 100644 index 0000000..79d405e Binary files /dev/null and b/src/res/targets/131.png differ diff --git a/src/res/targets/132.png b/src/res/targets/132.png new file mode 100644 index 0000000..bac28dc Binary files /dev/null and b/src/res/targets/132.png differ diff --git a/src/res/targets/133.png b/src/res/targets/133.png new file mode 100644 index 0000000..ddb5698 Binary files /dev/null and b/src/res/targets/133.png differ diff --git a/src/res/targets/134.png b/src/res/targets/134.png new file mode 100644 index 0000000..93066de Binary files /dev/null and b/src/res/targets/134.png differ diff --git a/src/res/targets/136.png b/src/res/targets/136.png new file mode 100644 index 0000000..02d9308 Binary files /dev/null and b/src/res/targets/136.png differ diff --git a/src/res/targets/137.png b/src/res/targets/137.png new file mode 100644 index 0000000..cde6b6d Binary files /dev/null and b/src/res/targets/137.png differ diff --git a/src/res/targets/138.png b/src/res/targets/138.png new file mode 100644 index 0000000..a5f9f5d Binary files /dev/null and b/src/res/targets/138.png differ diff --git a/src/res/targets/139.png b/src/res/targets/139.png new file mode 100644 index 0000000..5dfc118 Binary files /dev/null and b/src/res/targets/139.png differ diff --git a/src/res/targets/14.png b/src/res/targets/14.png new file mode 100644 index 0000000..48a0470 Binary files /dev/null and b/src/res/targets/14.png differ diff --git a/src/res/targets/140.png b/src/res/targets/140.png new file mode 100644 index 0000000..f4c2c9f Binary files /dev/null and b/src/res/targets/140.png differ diff --git a/src/res/targets/141.png b/src/res/targets/141.png new file mode 100644 index 0000000..ec438ab Binary files /dev/null and b/src/res/targets/141.png differ diff --git a/src/res/targets/15.png b/src/res/targets/15.png new file mode 100644 index 0000000..8b79de3 Binary files /dev/null and b/src/res/targets/15.png differ diff --git a/src/res/targets/16.png b/src/res/targets/16.png new file mode 100644 index 0000000..f845c0d Binary files /dev/null and b/src/res/targets/16.png differ diff --git a/src/res/targets/17.png b/src/res/targets/17.png new file mode 100644 index 0000000..d68b408 Binary files /dev/null and b/src/res/targets/17.png differ diff --git a/src/res/targets/18.png b/src/res/targets/18.png new file mode 100644 index 0000000..39c0069 Binary files /dev/null and b/src/res/targets/18.png differ diff --git a/src/res/targets/19.png b/src/res/targets/19.png new file mode 100644 index 0000000..d5d88cd Binary files /dev/null and b/src/res/targets/19.png differ diff --git a/src/res/targets/2.png b/src/res/targets/2.png new file mode 100644 index 0000000..76046cd Binary files /dev/null and b/src/res/targets/2.png differ diff --git a/src/res/targets/20.png b/src/res/targets/20.png new file mode 100644 index 0000000..a71af23 Binary files /dev/null and b/src/res/targets/20.png differ diff --git a/src/res/targets/21.png b/src/res/targets/21.png new file mode 100644 index 0000000..4dbc12a Binary files /dev/null and b/src/res/targets/21.png differ diff --git a/src/res/targets/22.png b/src/res/targets/22.png new file mode 100644 index 0000000..5c99023 Binary files /dev/null and b/src/res/targets/22.png differ diff --git a/src/res/targets/23.png b/src/res/targets/23.png new file mode 100644 index 0000000..c691720 Binary files /dev/null and b/src/res/targets/23.png differ diff --git a/src/res/targets/24.png b/src/res/targets/24.png new file mode 100644 index 0000000..8064c4d Binary files /dev/null and b/src/res/targets/24.png differ diff --git a/src/res/targets/25.png b/src/res/targets/25.png new file mode 100644 index 0000000..7d36f09 Binary files /dev/null and b/src/res/targets/25.png differ diff --git a/src/res/targets/26.png b/src/res/targets/26.png new file mode 100644 index 0000000..93259b6 Binary files /dev/null and b/src/res/targets/26.png differ diff --git a/src/res/targets/27.png b/src/res/targets/27.png new file mode 100644 index 0000000..d3c8ddb Binary files /dev/null and b/src/res/targets/27.png differ diff --git a/src/res/targets/28.png b/src/res/targets/28.png new file mode 100644 index 0000000..210a975 Binary files /dev/null and b/src/res/targets/28.png differ diff --git a/src/res/targets/29.png b/src/res/targets/29.png new file mode 100644 index 0000000..c5bc888 Binary files /dev/null and b/src/res/targets/29.png differ diff --git a/src/res/targets/3.png b/src/res/targets/3.png new file mode 100644 index 0000000..d1ee6ca Binary files /dev/null and b/src/res/targets/3.png differ diff --git a/src/res/targets/30.png b/src/res/targets/30.png new file mode 100644 index 0000000..df153c7 Binary files /dev/null and b/src/res/targets/30.png differ diff --git a/src/res/targets/31.png b/src/res/targets/31.png new file mode 100644 index 0000000..7c7b650 Binary files /dev/null and b/src/res/targets/31.png differ diff --git a/src/res/targets/32.png b/src/res/targets/32.png new file mode 100644 index 0000000..305c212 Binary files /dev/null and b/src/res/targets/32.png differ diff --git a/src/res/targets/33.png b/src/res/targets/33.png new file mode 100644 index 0000000..a70f465 Binary files /dev/null and b/src/res/targets/33.png differ diff --git a/src/res/targets/34.png b/src/res/targets/34.png new file mode 100644 index 0000000..fc11102 Binary files /dev/null and b/src/res/targets/34.png differ diff --git a/src/res/targets/35.png b/src/res/targets/35.png new file mode 100644 index 0000000..cc57184 Binary files /dev/null and b/src/res/targets/35.png differ diff --git a/src/res/targets/36.png b/src/res/targets/36.png new file mode 100644 index 0000000..50b7c70 Binary files /dev/null and b/src/res/targets/36.png differ diff --git a/src/res/targets/37.png b/src/res/targets/37.png new file mode 100644 index 0000000..7f5d953 Binary files /dev/null and b/src/res/targets/37.png differ diff --git a/src/res/targets/38.png b/src/res/targets/38.png new file mode 100644 index 0000000..16a4bd8 Binary files /dev/null and b/src/res/targets/38.png differ diff --git a/src/res/targets/39.png b/src/res/targets/39.png new file mode 100644 index 0000000..63baaa5 Binary files /dev/null and b/src/res/targets/39.png differ diff --git a/src/res/targets/4.png b/src/res/targets/4.png new file mode 100644 index 0000000..b690fb3 Binary files /dev/null and b/src/res/targets/4.png differ diff --git a/src/res/targets/40.png b/src/res/targets/40.png new file mode 100644 index 0000000..fe3ede2 Binary files /dev/null and b/src/res/targets/40.png differ diff --git a/src/res/targets/41.png b/src/res/targets/41.png new file mode 100644 index 0000000..7c6bfe3 Binary files /dev/null and b/src/res/targets/41.png differ diff --git a/src/res/targets/42.png b/src/res/targets/42.png new file mode 100644 index 0000000..a9639d7 Binary files /dev/null and b/src/res/targets/42.png differ diff --git a/src/res/targets/43.png b/src/res/targets/43.png new file mode 100644 index 0000000..db32dc2 Binary files /dev/null and b/src/res/targets/43.png differ diff --git a/src/res/targets/44.png b/src/res/targets/44.png new file mode 100644 index 0000000..697e1a1 Binary files /dev/null and b/src/res/targets/44.png differ diff --git a/src/res/targets/45.png b/src/res/targets/45.png new file mode 100644 index 0000000..9569195 Binary files /dev/null and b/src/res/targets/45.png differ diff --git a/src/res/targets/46.png b/src/res/targets/46.png new file mode 100644 index 0000000..6cc9c1f Binary files /dev/null and b/src/res/targets/46.png differ diff --git a/src/res/targets/47.png b/src/res/targets/47.png new file mode 100644 index 0000000..7d5ee95 Binary files /dev/null and b/src/res/targets/47.png differ diff --git a/src/res/targets/48.png b/src/res/targets/48.png new file mode 100644 index 0000000..1d8e767 Binary files /dev/null and b/src/res/targets/48.png differ diff --git a/src/res/targets/49.png b/src/res/targets/49.png new file mode 100644 index 0000000..6bf5cf4 Binary files /dev/null and b/src/res/targets/49.png differ diff --git a/src/res/targets/5.png b/src/res/targets/5.png new file mode 100644 index 0000000..ff96eb8 Binary files /dev/null and b/src/res/targets/5.png differ diff --git a/src/res/targets/50.png b/src/res/targets/50.png new file mode 100644 index 0000000..0aa89cd Binary files /dev/null and b/src/res/targets/50.png differ diff --git a/src/res/targets/51.png b/src/res/targets/51.png new file mode 100644 index 0000000..bd64eb3 Binary files /dev/null and b/src/res/targets/51.png differ diff --git a/src/res/targets/52.png b/src/res/targets/52.png new file mode 100644 index 0000000..28156ee Binary files /dev/null and b/src/res/targets/52.png differ diff --git a/src/res/targets/53.png b/src/res/targets/53.png new file mode 100644 index 0000000..8dbddb4 Binary files /dev/null and b/src/res/targets/53.png differ diff --git a/src/res/targets/54.png b/src/res/targets/54.png new file mode 100644 index 0000000..ab8db73 Binary files /dev/null and b/src/res/targets/54.png differ diff --git a/src/res/targets/55.png b/src/res/targets/55.png new file mode 100644 index 0000000..dc8507b Binary files /dev/null and b/src/res/targets/55.png differ diff --git a/src/res/targets/59.png b/src/res/targets/59.png new file mode 100644 index 0000000..e2bc665 Binary files /dev/null and b/src/res/targets/59.png differ diff --git a/src/res/targets/6.png b/src/res/targets/6.png new file mode 100644 index 0000000..6e8723c Binary files /dev/null and b/src/res/targets/6.png differ diff --git a/src/res/targets/60.png b/src/res/targets/60.png new file mode 100644 index 0000000..ea7cfa8 Binary files /dev/null and b/src/res/targets/60.png differ diff --git a/src/res/targets/64.png b/src/res/targets/64.png new file mode 100644 index 0000000..b4c8c4f Binary files /dev/null and b/src/res/targets/64.png differ diff --git a/src/res/targets/68.png b/src/res/targets/68.png new file mode 100644 index 0000000..76ae8ea Binary files /dev/null and b/src/res/targets/68.png differ diff --git a/src/res/targets/7.png b/src/res/targets/7.png new file mode 100644 index 0000000..6f4bd9c Binary files /dev/null and b/src/res/targets/7.png differ diff --git a/src/res/targets/70.png b/src/res/targets/70.png new file mode 100644 index 0000000..c97b3f4 Binary files /dev/null and b/src/res/targets/70.png differ diff --git a/src/res/targets/72.png b/src/res/targets/72.png new file mode 100644 index 0000000..29cd46f Binary files /dev/null and b/src/res/targets/72.png differ diff --git a/src/res/targets/74.png b/src/res/targets/74.png new file mode 100644 index 0000000..6fe4f4b Binary files /dev/null and b/src/res/targets/74.png differ diff --git a/src/res/targets/78.png b/src/res/targets/78.png new file mode 100644 index 0000000..59dbd62 Binary files /dev/null and b/src/res/targets/78.png differ diff --git a/src/res/targets/8.png b/src/res/targets/8.png new file mode 100644 index 0000000..98ca5e2 Binary files /dev/null and b/src/res/targets/8.png differ diff --git a/src/res/targets/84.png b/src/res/targets/84.png new file mode 100644 index 0000000..797f762 Binary files /dev/null and b/src/res/targets/84.png differ diff --git a/src/res/targets/85.png b/src/res/targets/85.png new file mode 100644 index 0000000..0c91fe5 Binary files /dev/null and b/src/res/targets/85.png differ diff --git a/src/res/targets/86.png b/src/res/targets/86.png new file mode 100644 index 0000000..2f2b96b Binary files /dev/null and b/src/res/targets/86.png differ diff --git a/src/res/targets/87.png b/src/res/targets/87.png new file mode 100644 index 0000000..d00716e Binary files /dev/null and b/src/res/targets/87.png differ diff --git a/src/res/targets/88.png b/src/res/targets/88.png new file mode 100644 index 0000000..39df4c9 Binary files /dev/null and b/src/res/targets/88.png differ diff --git a/src/res/targets/89.png b/src/res/targets/89.png new file mode 100644 index 0000000..56b09ef Binary files /dev/null and b/src/res/targets/89.png differ diff --git a/src/res/targets/9.png b/src/res/targets/9.png new file mode 100644 index 0000000..fd8efaa Binary files /dev/null and b/src/res/targets/9.png differ diff --git a/src/res/targets/91.png b/src/res/targets/91.png new file mode 100644 index 0000000..c2515d1 Binary files /dev/null and b/src/res/targets/91.png differ diff --git a/src/res/tp_npc.png b/src/res/tp_npc.png deleted file mode 100644 index 50a0ffa..0000000 Binary files a/src/res/tp_npc.png and /dev/null differ diff --git a/src/res/tp_pokemon.png b/src/res/tp_pokemon.png deleted file mode 100644 index 7342cd6..0000000 Binary files a/src/res/tp_pokemon.png and /dev/null differ diff --git a/src/res/tp_target.png b/src/res/tp_target.png deleted file mode 100644 index fb5e5ac..0000000 Binary files a/src/res/tp_target.png and /dev/null differ diff --git a/src/res/tp_warp.png b/src/res/tp_warp.png deleted file mode 100644 index de5c617..0000000 Binary files a/src/res/tp_warp.png and /dev/null differ