Skip to content

Commit

Permalink
Merge pull request #102 from YoYoGames/develop
Browse files Browse the repository at this point in the history
Changes for 2024.2 (feb 2024)
  • Loading branch information
gurpreetsinghmatharoo authored Mar 4, 2024
2 parents d336834 + 58b2c03 commit d7cced7
Show file tree
Hide file tree
Showing 284 changed files with 5,341 additions and 6,344 deletions.
26 changes: 21 additions & 5 deletions Manual/GenerateKeyboardShortcutTableFromJson.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,30 @@
### Provide the full directory path to the .json files as the command line argument.
### The output HTML file will also be placed there.
### For example: CMD > python GenerateKeyboardShortcutTableFromJson.py "C:/Users/Dev/Documents/Manual/" -name_as_desc
###
### You can provide an optional argument:
###
### -name_as_desc: Add this to write the hotkey's name as the description.
###
### Important: The JSON cannot contain trailing commas, this isn't supported
### using the built-in json module.
### Important: Technically, the JSON cannot contain trailing commas, this isn't supported
### using the built-in json module. Though it is supported through the yy_load function.
###

import sys
import json
import re
from collections import OrderedDict

def yy_load(file):
""" Load json from a file that possibly contains trailing commas """
# Do some tricky regex substitution
# so we can use the json module
data_string = ''.join(file.readlines())
data_string = re.sub("(,)(\s*[]}])","\g<2>", data_string)

# Now we can import using the json module
return json.loads(data_string)

# Utility functions
def get_combo_string(combo):
if not combo:
Expand Down Expand Up @@ -42,9 +57,10 @@ def get_combo_string(combo):
shortcuts_per_location = OrderedDict() # stores shortcuts under locations

# First read the Windows defaults file
with open(fdir + "/" + fname_win_hotkeys, 'r') as f:
with open(fdir + "/" + fname_win_hotkeys, 'r', encoding="utf-8") as f:
# Load all the data
input = json.load(f)
# input = json.load(f) # risk of errors if trailing commas are present
input = yy_load(f) # regex-replace variety that fixes things

# Add items under their respective locations (i.e. "group" per location)
for shortcut in input:
Expand Down Expand Up @@ -84,7 +100,7 @@ def get_combo_string(combo):
# Then add the combos in the macOS defaults file
with open(fdir + "/" + fname_mac_hotkeys, 'r') as f:
# Load all the data
input = json.load(f)
input = yy_load(f)

# Add items under their respective locations
for shortcut in input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Additional Information</title>
<meta name="generator" content="Adobe RoboHelp 2020" />
<meta name="generator" content="Adobe RoboHelp 2022" />
<link rel="stylesheet" href="../assets/css/default.css" type="text/css" />
<script src="../assets/scripts/main_script.js" type="module"></script>
<meta name="rh-authors" content="Mark Alexander" />
Expand All @@ -18,7 +18,6 @@ <h1><span data-field="title" data-format="default">Additional Information</span>
<p>This section of the manual contain a collection of miscellaneous articles related to programming and the way the GameMaker Language works. The following articles are designed as companion articles to further expand your understanding of how GameMaker works and how to get the most from the different language features available:</p>
<ul class="colour">
<li><a href="Best_Practices_When_Programming.htm">Best Practices When Programming</a></li>
<li><a href="The_File_System.htm">The File System</a></li>
<li><a href="Bitwise_Operators.htm">Bitwise Operators</a></li>
<li><a href="Type_Tables.htm">Type Tables</a></li>
<li><a data-xref="{title}" href="Whitespace_Characters.htm">White-space Characters</a></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ <h1>Best Practices When Programming</h1>
<div class="buttons">
<div class="clear">
<div style="float:left">Back: <a href="Additional_Information.htm">Additional Information</a></div>
<div style="float:right">Next: <a href="The_File_System.htm">The File System</a></div>
<div style="float:right">Next: <a href="Bitwise_Operators.htm">Bitwise Operators</a></div>
</div>
</div>
<h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2023 All Rights Reserved</span></h5>
Expand Down
10 changes: 6 additions & 4 deletions Manual/contents/Additional_Information/Bitwise_Operators.htm
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ <h1>Bitwise Operators And Binary</h1>
<p class="code">door_id = 1; // 0001</p>
<p class="dropspot">The others would be something like:<br />
 </p>
<p class="code">door_id=2; // 0010<br />
door_id=4; // 0100<br />
door_id=8; // 1000<br />
etc...</p>
<p class="code">
door_id = 2; // 0010 <br />
door_id = 4; // 0100 <br />
door_id = 8; // 1000 <br />
// etc...
</p>
<p class="dropspot">If we wanted the key to open door 1 and 3, then the key would have the MASK value of 5 (which is 101 in binary). If we perform an <span class="inline">AND</span> of this, and it comes out &quot;not zero&quot;, then we know that the key can open the door. You could also have keys that opened nothing by having a MASK of 0. See the code below for the actual check:</p>
<p class="code">if ((key_id &amp; door_id) ! = 0)<br />
{<br />
Expand Down
Loading

0 comments on commit d7cced7

Please sign in to comment.