Wow! You have a lot of questions. That's OK. It is just going to take me some time to answer them all. Let's start with some info.
I downloaded halflife and started ripping apart more wads. The code that I posted yesterday is only going to help you for entries.type = 0x43. Parsing 0x40,0x42 & 0x46 types is not properly handled in my code. This is because there are only 2 wad3 specs that I can find and they do not entirely agree. One of them illustrates a much more robust texture struct but it seems to be inaccurate. Following it to the T is not producing the proper results. If you know of some official wad3 specs somewhere there is absolutely no doubt that I could write a full featured wad3 parser. I have had no luck finding anything official. All that being said let me start answering your questions.
First of all I see you are using the old code from my github for flash quake. There is nothing wrong with that necessarily but, it is not optimal. If you want to "steal" that code you are more than welcome to or I can give you even better code to "steal". It's not stealing if I tell you flat out you can do whatever you want with it. Actually, I would love to see you do something with it. You don't even have to give me credit cause, credit + a nickel still won't buy me a piece of gum.
If you've been using my code then you know my content manager consists of 4 parts. Importer, EventHandler, Library and ContentManager. The Importer triggers the EventManager which loads the file and bubbles the resulting event back up to the Importer. The Importer is then triggered (if Event.COMPLETE) to switch/case the file extension and format the loaded bytes as either ByteArray, BitmapData or String. Once formatted it is stored in the Library. Each filetype has a getter in Content(Manager) which allows you to retrieve the desired data by name. The main reason for the Importer and Content(Manager) is to create a public interface that abstracts the EventManager and Library allowing both to remain encapsulated as internal classes.
I guess one way to answer your ContentManager questions is simply to say I just changed the names and namespace of the stuff you are already using. I did this because I also stripped the files down to bare minimums to deal with wad because, I have every intention of giving you all of the current code, and I wanted to make it as simple as possible to read/use.
@Electron or NW.js, BoxedApp Packer or Engima Protector
I don't know what any of that is. Honestly, all of that seems way too cumbersome and overblown just to make flash stuff and/or package it as a standalone. I use flashDevelop for EVERYTHING.
@i don't know what to do with haxe.zip
here is my old cheater script. The only things that you do not have is utils.ByteStream because I invented it and Importer cause I invented that too. Simply replace those with haxe.io.BytesInput class and some other class for managing storage of the bytes.
I will tell you, if you intend to develop in Haxe for windows (cpp) you are going to need to drop back a few revisions from the most current. There is a bug that makes msvc2010 hang on the resources part of the compile and when it does finally build it's broken. I guarantee you that shit will be fixed soon cause I have found a LOT of threads with people complaining about it directly to the people in control of fixing this. I fixed it myself but it is hacky and temporary til they fix it so I can at least keep working.
I'm sure I have left some questions unanswered. I need a break. I'll be back in a bit, look at your post again and try to answer anything I missed. You are welcome to ask more questions before I finish answering the ones you already asked. I'll just keep chipping away at them til I catch up.
EDIT: One problem I can see you having regarding "then" vs "now" is that I am constantly upgrading my skills as a programmer. Code you are reading from last year is going to be "junky" in comparison to my code now. Code from right now will be "junky" in comparison to my code of the future. My real life goal has always been to be an amazing programmer. I realize I probably already am that but it is not good enough for me. If I already am amazing then the new goal is to be phenomenal. When I get to phenomenal the goal will be to be ... something better than phenomenal...lol. My point being that you are asking me about code that I have moved well beyond at this point and for me to answer you takes away from the much better answers I could give you regarding the present.
Allow me to give you an example. In the past I would program by the seat of my pants with absolutely no direction beyond some vague notion of a goal. These days I spend maybe a few hours a week writing spreadsheets in OpenOffice that map code I intend to write. The objects in my spreadsheets reference other spreadsheets that go into even deeper detail. I used to spend crazy amounts of time toiling over code and mistakes. It is 100% factual that I am practically famous for programming 20+ hours straight. These days, I follow my spreadsheets for 2 or 3 hours and get substantially more work done with far far far less errors.
I downloaded halflife and started ripping apart more wads. The code that I posted yesterday is only going to help you for entries.type = 0x43. Parsing 0x40,0x42 & 0x46 types is not properly handled in my code. This is because there are only 2 wad3 specs that I can find and they do not entirely agree. One of them illustrates a much more robust texture struct but it seems to be inaccurate. Following it to the T is not producing the proper results. If you know of some official wad3 specs somewhere there is absolutely no doubt that I could write a full featured wad3 parser. I have had no luck finding anything official. All that being said let me start answering your questions.
First of all I see you are using the old code from my github for flash quake. There is nothing wrong with that necessarily but, it is not optimal. If you want to "steal" that code you are more than welcome to or I can give you even better code to "steal". It's not stealing if I tell you flat out you can do whatever you want with it. Actually, I would love to see you do something with it. You don't even have to give me credit cause, credit + a nickel still won't buy me a piece of gum.
If you've been using my code then you know my content manager consists of 4 parts. Importer, EventHandler, Library and ContentManager. The Importer triggers the EventManager which loads the file and bubbles the resulting event back up to the Importer. The Importer is then triggered (if Event.COMPLETE) to switch/case the file extension and format the loaded bytes as either ByteArray, BitmapData or String. Once formatted it is stored in the Library. Each filetype has a getter in Content(Manager) which allows you to retrieve the desired data by name. The main reason for the Importer and Content(Manager) is to create a public interface that abstracts the EventManager and Library allowing both to remain encapsulated as internal classes.
I guess one way to answer your ContentManager questions is simply to say I just changed the names and namespace of the stuff you are already using. I did this because I also stripped the files down to bare minimums to deal with wad because, I have every intention of giving you all of the current code, and I wanted to make it as simple as possible to read/use.
@Electron or NW.js, BoxedApp Packer or Engima Protector
I don't know what any of that is. Honestly, all of that seems way too cumbersome and overblown just to make flash stuff and/or package it as a standalone. I use flashDevelop for EVERYTHING.
@i don't know what to do with haxe.zip
here is my old cheater script. The only things that you do not have is utils.ByteStream because I invented it and Importer cause I invented that too. Simply replace those with haxe.io.BytesInput class and some other class for managing storage of the bytes.
Code:
package parsers.zip; import utils.bytes.ByteStream; import haxe.io.Bytes; class Zip { private var _entries:List<haxe.zip.Entry>; private var _imported:Map<String, Bool>; //don't think I even need this. I certainly don't need it "yet" @:isVar public var entries(get, never):List<haxe.zip.Entry>; public function get_entries():List<haxe.zip.Entry> return _entries; /** CLASS_CONSTRUCTOR * @param data - zip data as ByteStream from Import */ public function new(data:ByteStream):Void { var reader = new haxe.zip.Reader( data.input ); _entries = reader.read(); setImported(); } /** SET_IMPORTED * init false for all entries. * true indicates that the entry has already been decompressed to the local lib */ private function setImported():Void { if (_imported == null) _imported = new Map<String, Bool>(); var extension:String; var filename:Array<String>; var name:String; for (entry in _entries) { filename = ( entry.fileName.split("/").pop() ).split("."); extension = ( filename.pop() ).toLowerCase(); name = ( filename.pop() ).toLowerCase(); _imported.set(name+extension, false); } } /** LOOP_RETRIEVE_AN_ENTITY * @param byName - file name * @param byRegExt - regex of possible extensions for this file - ie ~/png|jpg|gif|jpeg/i * @return zip entry struct */ public function getEntry(byName:String, byRegExt:EReg):haxe.zip.Entry { var filename:EReg = new EReg(byName, "i"); for (entry in _entries) if (filename.match(entry.fileName)) if(byRegExt.match(entry.fileName)) return entry; return null; } /** MAKE_ZIPFILE_LOCAL * @param byName - file name * @param byRegExt - regex of possible extensions for this file - ie ~/png|tga|gif|bmp/i */ public function setFile(byName:String, byRegExt:EReg):Bool { var entry = getEntry(byName, byRegExt); byName = StringTools.replace(byName, "#", "*"); if(byRegExt.match(entry.fileName)) { var byExt = byRegExt.matched(0); if(!_imported.get(byName+byExt)) { _imported.set(byName+byExt, true); if (entry != null) { Importer.libBytes(byName, byExt, new ByteStream(cast uncompress(entry.data).getData())); return true; } } } return false; } /** UNCOMPRESS_BYTES * @param bytes - compressed Bytes * @return uncompressed bytes */ private function uncompress( bytes:Bytes ):Bytes { var tmp = haxe.io.Bytes.alloc(65536); var out = new haxe.io.BytesBuffer(); var z = new haxe.zip.InflateImpl( new haxe.io.BytesInput(bytes), false, false ); while( true ) { var n = z.readBytes( tmp, 0, 65536 ); out.addBytes( tmp, 0, n ); if( n < 65536 ) break; } return out.getBytes(); } }
I'm sure I have left some questions unanswered. I need a break. I'll be back in a bit, look at your post again and try to answer anything I missed. You are welcome to ask more questions before I finish answering the ones you already asked. I'll just keep chipping away at them til I catch up.
EDIT: One problem I can see you having regarding "then" vs "now" is that I am constantly upgrading my skills as a programmer. Code you are reading from last year is going to be "junky" in comparison to my code now. Code from right now will be "junky" in comparison to my code of the future. My real life goal has always been to be an amazing programmer. I realize I probably already am that but it is not good enough for me. If I already am amazing then the new goal is to be phenomenal. When I get to phenomenal the goal will be to be ... something better than phenomenal...lol. My point being that you are asking me about code that I have moved well beyond at this point and for me to answer you takes away from the much better answers I could give you regarding the present.
Allow me to give you an example. In the past I would program by the seat of my pants with absolutely no direction beyond some vague notion of a goal. These days I spend maybe a few hours a week writing spreadsheets in OpenOffice that map code I intend to write. The objects in my spreadsheets reference other spreadsheets that go into even deeper detail. I used to spend crazy amounts of time toiling over code and mistakes. It is 100% factual that I am practically famous for programming 20+ hours straight. These days, I follow my spreadsheets for 2 or 3 hours and get substantially more work done with far far far less errors.
Comment