re = /void\s*\*\s*([0-9a-zA-Z\_]*)\s*\[\s*\]\s*\[[0-9a-zA-Z_]*\]\s*=\s*\{(.*?)\}\s*;/m
str = '/**
* Link\\\'s eyes and mouth textures are placed at the exact same place in adult and child Link\\\'s respective object files.
* This allows the array to only contain the symbols for one file and have it apply to both. This is a problem for
* shiftability, and changes will need to be made in the code to account for this in a modding scenario. The symbols
* from adult Link\\\'s object are used here.
*/
#ifndef AVOID_UB
void* sEyeTextures[PLAYER_EYES_MAX] = {
gLinkAdultEyesOpenTex, // PLAYER_EYES_OPEN
gLinkAdultEyesHalfTex, // PLAYER_EYES_HALF
gLinkAdultEyesClosedfTex, // PLAYER_EYES_CLOSED
gLinkAdultEyesLeftTex, // PLAYER_EYES_LEFT
gLinkAdultEyesRightTex, // PLAYER_EYES_RIGHT
gLinkAdultEyesWideTex, // PLAYER_EYES_WIDE
gLinkAdultEyesDownTex, // PLAYER_EYES_DOWN
gLinkAdultEyesWincingTex, // PLAYER_EYES_WINCING
};
void* sMouthTextures[PLAYER_MOUTH_MAX] = {
gLinkAdultMouthClosedTex, // PLAYER_MOUTH_CLOSED
gLinkAdultMouthHalfTex, // PLAYER_MOUTH_HALF
gLinkAdultMouthOpenTex, // PLAYER_MOUTH_OPEN
gLinkAdultMouthSmileTex, // PLAYER_MOUTH_SMILE
};
#else
// Defining `AVOID_UB` will use a 2D array instead and properly use the child link pointers to allow for shifting.
void* sEyeTextures[][PLAYER_EYES_MAX] = {
{
gLinkAdultEyesOpenTex, // PLAYER_EYES_OPEN
gLinkAdultEyesHalfTex, // PLAYER_EYES_HALF
gLinkAdultEyesClosedfTex, // PLAYER_EYES_CLOSED
gLinkAdultEyesLeftTex, // PLAYER_EYES_LEFT
gLinkAdultEyesRightTex, // PLAYER_EYES_RIGHT
gLinkAdultEyesWideTex, // PLAYER_EYES_WIDE
gLinkAdultEyesDownTex, // PLAYER_EYES_DOWN
gLinkAdultEyesWincingTex, // PLAYER_EYES_WINCING
},
{
gLinkChildEyesOpenTex, // PLAYER_EYES_OPEN
gLinkChildEyesHalfTex, // PLAYER_EYES_HALF
gLinkChildEyesClosedfTex, // PLAYER_EYES_CLOSED
gLinkChildEyesLeftTex, // PLAYER_EYES_LEFT
gLinkChildEyesRightTex, // PLAYER_EYES_RIGHT
gLinkChildEyesWideTex, // PLAYER_EYES_WIDE
gLinkChildEyesDownTex, // PLAYER_EYES_DOWN
gLinkChildEyesWincingTex, // PLAYER_EYES_WINCING
},
};
void* sMouthTextures[][PLAYER_MOUTH_MAX] = {
{
gLinkAdultMouthClosedTex, // PLAYER_MOUTH_CLOSED
gLinkAdultMouthHalfTex, // PLAYER_MOUTH_HALF
gLinkAdultMouthOpenTex, // PLAYER_MOUTH_OPEN
gLinkAdultMouthSmileTex, // PLAYER_MOUTH_SMILE
},
{
gLinkChildMouthClosedTex, // PLAYER_MOUTH_CLOSED
gLinkChildMouthHalfTex, // PLAYER_MOUTH_HALF
gLinkChildMouthOpenTex, // PLAYER_MOUTH_OPEN
gLinkChildMouthSmileTex, // PLAYER_MOUTH_SMILE
},
};
#endif
Color_RGB8 sTunicColors[PLAYER_TUNIC_MAX] = {
{ 30, 105, 27 }, // PLAYER_TUNIC_KOKIRI
{ 100, 20, 0 }, // PLAYER_TUNIC_GORON
{ 0, 60, 100 }, // PLAYER_TUNIC_ZORA
};
Color_RGB8 sGauntletColors[] = {
{ 255, 255, 255 },
{ 254, 207, 15 },
};
Gfx* sBootDListGroups[][2] = {
{ gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL }, // PLAYER_BOOTS_IRON
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, // PLAYER_BOOTS_HOVER
};
'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html