Annotate hero/code466
This commit is contained in:
parent
40ee8253f6
commit
d7ed74ba7d
|
@ -0,0 +1,83 @@
|
|||
[video member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Loading and Displaying HHA Files as Text" vod_platform=youtube id=GFhXSma72W0 annotator=Miblo]
|
||||
[0:01][Recap and set the stage for the day continuing with our modder-friendly asset file format][:"asset loading" :speech]
|
||||
[2:23][Dive into the code with a few words on the asset annotations, and the determination to augment the hha_asset struct with data conducive to moving assets between packs][:"asset loading" :speech]
|
||||
[7:03][Augment hha_asset with DataSize and DataType][:"asset loading"]
|
||||
[11:13][Introduce CTAssert() (compile-time assertion)][:language]
|
||||
[16:35][Provide the ability to use CTAssert() multiple times, by appending __LINE__ to its test struct][:language]
|
||||
[24:36][Use CTAssert() on our hha_asset, hha_annotation, hha_tag and hha_header structs][:language]
|
||||
[26:01][Introduce flag32() and enum32() for hha_asset, hha_sound and hha_tag to use, for documentation purposes][:"asset loading"]
|
||||
[29:41][Set up to finish the asset importer][:"asset loading" :speech]
|
||||
[32:53][Include the necessary data from hha_annotation in loaded_hha_annotation][:"asset loading"]
|
||||
[35:15][Introduce WrapZ() and ConstZ() as a way to turn a null-terminated string into a count-string, for ReadHHA_V0() to use when setting the DefaultAnnotation][:"asset loading" :"string manipulation"]
|
||||
[40:19][Set up to dump our HHA info][:"asset loading" :speech]
|
||||
[41:27][Enable hhaedit to print the TagCount, AssetCount and presence of Annotations][:"asset loading"]
|
||||
[42:38][Check out our HHA printout][:"asset loading" :run]
|
||||
[42:46][Introduce PrintHeaderInfo() and a -dump flag][:"asset loading"]
|
||||
[44:43][Check out our -info and -dump][:"asset loading" :run]
|
||||
[45:03][Demo TabView from the Handmade Fund's bonus pack[ref
|
||||
site="Handmade Hero"
|
||||
page=Fund
|
||||
url=https://handmadehero.org/fund]][:run]
|
||||
[46:49][Introduce PrintContents() to print our HHA data indented for viewing in TabView][:"asset loading"]
|
||||
[51:31][Enable ReadHHA_V0() to read in all the asset types][:"asset loading"]
|
||||
[1:09:35][Dump our HHA info and take a look at it in TabView][:"asset loading" :run]
|
||||
[1:10:07][Enable PrintContents() to print the Tags][:"asset loading"]
|
||||
[1:13:03][Check out our dump in TabView][:"asset loading" :run]
|
||||
[1:13:40][Enable ReadHHA_V0() to read in the tags][:"asset loading"]
|
||||
[1:14:21][Check out our dump in TabView to see some UNKNOWN tags][:"asset loading" :run]
|
||||
[1:14:52][Fix the TagCount in ReadHHA_V0()][:"asset loading"]
|
||||
[1:15:02][Check out our dump in TabView to see that our tags are correct][:"asset loading" :run]
|
||||
[1:15:07][Try dumping test2.hha to see that it has no tags][:"asset loading" :run]
|
||||
[1:16:20][Try dumping intro_art.hha to see that it looks like we're working properly][:"asset loading" :run]
|
||||
[1:17:05][Enable PrintContents() to print out all the information, introducing PrintTag()][:"asset loading"]
|
||||
[1:32:11][Check out our more detailed dump in TabView][:"asset loading" :run]
|
||||
[1:32:54][Make PrintContents() flip the x and y when printing "Tags: x at y"][:"asset loading"]
|
||||
[1:33:54][Check out the dump of testfonts.hha][:"asset loading" :run]
|
||||
[1:34:39][Prevent PrintContents() from printing the tag field if there are no tags][:"asset loading"]
|
||||
[1:35:15][Check out the dump of testfonts.hha][:"asset loading" :run]
|
||||
[1:36:57][Q&A (not quite)][:speech]
|
||||
[1:37:27][Enable PrintContents() to print the Annotations][:"asset loading"]
|
||||
[1:38:13][Check out the dump of testfonts.hha with its annotations][:"asset loading" :run]
|
||||
[1:38:47][Enable PrintContents() to print the AssetDescription and Author, wondering whether %llu is the correct identifier, with a meta-comment on :metaprogramming][:"asset loading"]
|
||||
[1:42:04][Check out our further annotated dump of testfonts.hha][:"asset loading" :run]
|
||||
[1:42:12][Q&A][:speech]
|
||||
[1:42:26][@mmozeiko][Q: I would suggest using static_assert(bool_condition, "message"); instead of CTAssert. It is a C++11 feature and it is supported by MSVC2013 (you are using other C++11 features already now anyways)][:language]
|
||||
[1:43:01][Change CTAssert() to be a static_assert][:language]
|
||||
[1:45:09][@Jim0_o][Q: Regarding CTAssert: Do you have a trick for getting a number for __FILE__ to use in the struct name (assuming you don't have a trick for using that in the struct name)?][:language]
|
||||
[1:46:42][@mallesbixie][Q: You have "one past alst" in your output]
|
||||
[1:46:48][Fix typo in PrintContents()][:"asset loading"]
|
||||
[1:47:01][@Brian][Q: In an earlier episode of [~hero Handmade Hero] (around day 160), you answered a question regarding your plan on splitting [~hero Handmade Hero] into two parts – first, writing the engine; second, writing the game – and there was a clear divide. Do you still see you moving towards that goal, or do you feel it is better, when you move to game code, to still work on the engine to add features?]
|
||||
[1:48:00][@nordicplayer][Q: How to deal with concurrency in C++?]
|
||||
[1:50:44][@mallesbixie][Q: Why is hha version 1 still important? Is it only to convert the (few) existing assets?][:"asset loading"]
|
||||
[1:51:17][@noxnode][Q: How do you feel about the progress of [~hero Handmade Hero] so far?]
|
||||
[1:51:51][@nordicplayer][Q: Should I learn C or C++ first? Is there any good advantage that C++ offers?][:language]
|
||||
[1:53:31][@jwindahouse][Q: Given that static_assert is a :language feature and you can't really implement it yourself, why not just use it?][:language]
|
||||
[1:53:40][@thebirkisreal][Q: Remember to lookup printf() stuff[ref
|
||||
site=MSDN
|
||||
page="Size Specification"
|
||||
url=https://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx]]
|
||||
[1:54:31][@longboolean][Q: I know we haven't done much with in-game text in this series yet, but could the asset system be used as is for storing story text, etc., tagged with language tag for translation and other relevant data tags? Maybe we would want custom tags for storing language codes? Or do you think it better to make a different system specifically for this purpose? Also, TabView is looking cool. All it needs now is the iconic [~hero Handmade Hero] dark theme][:"asset loading"]
|
||||
[1:55:32][@tmellemseter][Q: Out of curiosity, why OnePassedLastAssetsIndex. Would not, e.g. AssetCount or NumberOfAssets be more readable?]
|
||||
[1:55:54][@uplinkcoder][Q: Maybe you could add the line to the message? Or did it print line numbers][:language]
|
||||
[1:56:09][@vaualbus][Q: Does the CTAssert fail if we have two asserts in two files at the same line?][:language]
|
||||
[1:56:41][@tmellemseter][Q: I'm interested in knowing how downloading a patch or DLC is getting installed and changes how existing code works. Would that be covered at the end?]
|
||||
[1:57:15][@grimjoey][Q: How did you recompile / reload a dll when LoadLibrary seems to keep a lock on the file? Any tricks or just copy the dll?]
|
||||
[1:57:34][@flyinginthedark][Q: Why not use -1 instead of 0 as an array length to get harder error in assert?][:language]
|
||||
[1:57:46][Make CTAssert3() use array length of -1][:language]
|
||||
[1:58:27][@mmozeiko][Q: long long is not the same as int64_t type (it is 64-bit but gcc / clang will still complain that %llu does not match uint64_t). The "proper" way is to include <inttypes.h> which provides compiler specific PRIu64 string literal (as define), so you need to do printf("%" PRIu64, value);]
|
||||
[1:59:16][@vaualbus][Q: Doeo the preprocessor parse before #include directive and then resolve the __LINE__ after the include is parsed? I still do not get why the preprocessor, that can be powerful, is so bad][:language]
|
||||
[1:59:51][Demo line number resolution][:language]
|
||||
[2:01:57][Compile it to see our error reported to be on line 278]
|
||||
[2:02:18][Demo use of the #line directive[ref
|
||||
site=MSDN
|
||||
page="#line Directive (C/C++)"
|
||||
url=https://msdn.microsoft.com/en-us/library/b5w2czay.aspx]][:language]
|
||||
[2:03:43][@mmozeiko][Q: The good news is that starting with C99 printf() supports u modifier for size_t - so "%zu" or "%zx" would work]
|
||||
[2:04:17][Replace %llu with %zu in hhaedit.cpp][:"asset loading"]
|
||||
[2:04:37][Check out the dump of testfonts.hha to see that %zu works][:"asset loading" :run]
|
||||
[2:05:17][@noxnode][Q: Have you ever changed the line number / file name in that way in an actual project?][:language]
|
||||
[2:05:41][@mmozeiko][Oops, "z" modifier. What was changed? I missed it...]
|
||||
[2:06:04][@mmozeiko]["%zu" will work only for size_t type, not uint64_t type]
|
||||
[2:06:15][Change PrintContents() to cast some values to size_t][:"asset loading"]
|
||||
[2:07:27][Close it down in the hopes that that's okay][:speech]
|
||||
[/video]
|
Loading…
Reference in New Issue