| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
hpl2:resources:preprocess [2012/05/07 06:07] homicide13 [Reccomended Extra Installation Setup] |
hpl2:resources:preprocess [2012/06/06 20:37] (current) apjjm [Setting Up] |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | The C pre-processer is a powerful tool that allows programers many options when writing their code - among these options are commands such as #include "", which allows the user to include the contents from one code file into another. | + | The C pre-processer is a powerful tool that allows programers many options when writing their code - among these options are commands such as #include ””, which allows the user to include the contents from one code file into another. |
| + | |||
| + | [[http://www.frictionalgames.com/forum/thread-12023.html|Original Post]] | ||
| ===== Setting Up ===== | ===== Setting Up ===== | ||
| - | In the below ZIP-File a copy of [[http://mcpp.sourceforge.net/|MCPP ]] is included as the pre-processor. I have also written a batch script which will call the pre-processor with the appropriate arguments as well as a display error messages & log them into a text file. | + | In the below ZIP-File a copy of [[http://mcpp.sourceforge.net/|MCPP ]] is included as the pre-processor. I have also written a batch script which will call the pre-processor with the appropriate arguments as well as a display error messages & log them into a text file. |
| Line 14: | Line 16: | ||
| - | The next thing to do is set up notepad++ to use the batch file and MCPP. Extract the contents of the zip file to a safe place (For example in a new folder in the amnesia directory). Open up notepad++ and go into the "run" menu and click "run" (or press F5). Into this dialogue box put the following: | + | The next thing to do is set up notepad++ to use the batch file and MCPP. Extract the contents of the zip file to a safe place (For example in a new folder in the amnesia directory). Open up notepad++ and go into the “run” menu and click “run” (or press F5). Into this dialogue box put the following: |
| - | <code>''[FOLDER]\PreProcess.bat $(CURRENT_DIRECTORY) $(FILE_NAME) $(NAME_PART).hps'' | + | <code> |
| + | [FOLDER]\PreProcess.bat $(CURRENT_DIRECTORY) $(FILE_NAME) $(NAME_PART).hps | ||
| </code> | </code> | ||
| + | |||
| + | |||
| Replace [FOLDER] with the folder the batch file is in. For example: | Replace [FOLDER] with the folder the batch file is in. For example: | ||
| - | <code>''C:\Program Files (x86)\Amnesia\HPS_PREPROCESSOR\PreProcess.bat $(CURRENT_DIRECTORY) $(FILE_NAME) $(NAME_PART).hps'' | + | <code> |
| + | C:\Program Files (x86)\Amnesia\HPS_PREPROCESSOR\PreProcess.bat $(CURRENT_DIRECTORY) $(FILE_NAME) $(NAME_PART).hps | ||
| </code> | </code> | ||
| - | It is recommended that you then click save and bind the command to something like F6 - otherwise you will have to enter this every time you start notepad++ | + | It is recommended that you then click save and bind the command to something like F6 - otherwise you will have to enter this every time you start notepad++ . |
| - | . | + | |
| - | Warning: Do not press "run" (or F6 if you bound it) on a script file which ends in ".hps"! This will wipe the script file!!! Give your script files which use the pre-processor a different extension (E.g .phps or .lhps). | + | __**Warning: Do not press “run” (or F6 if you bound it) on a script file which ends in ”.hps”! This will wipe the script file!!! Give your script files which use the pre-processor a different extension (E.g .phps or .lhps). ** __ |
| ===== Usage ===== | ===== Usage ===== | ||
| - | The files that exist before pre-processing will have to have a different extension to the one after pre-processing. The simplest way to do this is to call your script files something like "level.phps" so that the pre-processor writes "level.hps". Consider the following test code: | + | The files that exist before pre-processing will have to have a different extension to the one after pre-processing. The simplest way to do this is to call your script files something like “level.phps” so that the pre-processor writes “level.hps”. Consider the following test code: |
| - | <code>''//level.phps// | + | <code> |
| + | //level.phps// | ||
| #include "inclusion_test.phps" | #include "inclusion_test.phps" | ||
| Line 51: | Line 56: | ||
| { | { | ||
| AddDebugMessage("File 2",false); | AddDebugMessage("File 2",false); | ||
| - | }'' | + | } |
| </code> | </code> | ||
| - | Running the script | + | Running the script from test.phps (F6 if you followed the instructions above) should create “test.hps”: |
| - | from test.phps | + | |
| - | (F6 if you followed the instructions above) should create "test.hps": | + | |
| <code> | <code> | ||
| - | v''oid OnStart() | + | void OnStart() |
| { | { | ||
| AddDebugMessage("File 2",false); | AddDebugMessage("File 2",false); | ||
| Line 69: | Line 72: | ||
| { | { | ||
| AddDebugMessage("File 1",false); | AddDebugMessage("File 1",false); | ||
| - | }'' | + | } |
| </code> | </code> | ||
| - | Which is what the game will see from test.map and run. When you distribute your custom stories only this exported file is required. Obviously, since we are now using a C pre-processor there is a whole [[http://en.wikipedia.org/wiki/C_preprocessor|host of other things you can do.]] | + | Which is what the game will see from test.map and run. When you distribute your custom stories only this exported file is required. Obviously, since we are now using a C pre-processor there is a whole [[http://en.wikipedia.org/wiki/C_preprocessor|host of other things you can do.]] |
| Line 79: | Line 82: | ||
| - | You may notice that stuff like #include isn't color coded - and that your new script files ".phps" aren't automatically recognised as HPS files! I Have updated the notepad++ files to fix this (Note that these are updated versions of the [[http://www.frictionalgames.com/forum/thread-9783.html|overhauled notepad++ files]], which provide a fixed function list, folding regions and a new color scheme) | + | You may notice that stuff like #include isn't color coded - and that your new script files ”.phps” aren't automatically recognised as HPS files! I Have updated the notepad++ files to fix this (Note that these are updated versions of the [[http://www.frictionalgames.com/forum/thread-9783.html|overhauled notepad++ files]], which provide a fixed function list, folding regions and a new color scheme) |
| Line 100: | Line 103: | ||
| - | \\ \\ You will now a fixed functions list for amnesia (Adds missing functions & keywords, removes non-existing ones), as well as a new color scheme, folding regions (//+ //- /<nowiki>*</nowiki><nowiki>*</nowiki> <nowiki>*</nowiki><nowiki>*</nowiki>/ //Begin // End) etc. ".hps, .phps, .lhps" are now detected, and "#…" are coloured correctly. | + | \\ \\ You will now a fixed functions list for amnesia (Adds missing functions & keywords, removes non-existing ones), as well as a new color scheme, folding regions (//+ //- /<nowiki>*</nowiki><nowiki>*</nowiki> <nowiki>*</nowiki><nowiki>*</nowiki>/ //Begin // End) etc. ”.hps, .phps, .lhps” are now detected, and ”#…” are coloured correctly. |
| - | + | ||
| - | + | ||
| - | Origional thread: [[http://www.frictionalgames.com/forum/thread-12023.html|http://www.frictionalgames.com/forum/thread-12023.html]] | + | |