Skip to content

Commit

Permalink
Fix #26 add options, remove tremor
Browse files Browse the repository at this point in the history
Enabling and disabling free aiming is the only setting added
  • Loading branch information
szapp committed Sep 6, 2016
1 parent 09cf417 commit 423e996
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 43 deletions.
44 changes: 1 addition & 43 deletions Content/freeAim.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

/* Free aim settings */
const int FREEAIM_ACTIVATED = 1; // Enable/Disable free aiming
const int FREEAIM_FOCUS_ACTIVATED = 1; // Enable/Disable focus collection (disable for performance)
const int FREEAIM_CAMERA_X_SHIFT = 0; // Set to 1, if camera is in shoulder view (not recommended)
const int FREEAIM_MAX_DIST = 5000; // 50 meters. For shooting and crosshair adjustments
Expand Down Expand Up @@ -73,7 +72,7 @@ func void Init_FreeAim() {

/* Check whether free aim should be activated */
func int isFreeAimActive() {
if (!FREEAIM_ACTIVATED) { return 0; }; // Only free aiming is enabled
if (!STR_ToInt(MEM_GetGothOpt("FREEAIM", "enabled"))) { return 0; }; // Only free aiming is enabled in the menu
if (MEM_Game.pause_screen) { return 0; }; // Only when playing
if (!MEM_ReadInt(mouseEnabled)) { return 0; }; // Only when mouse controls are enabled
if (!MEM_ReadInt(oCGame__s_bUseOldControls)) { return 0; }; // Only for classic gothic 1 controls
Expand All @@ -91,10 +90,6 @@ func int isFreeAimActive() {
/* Delete crosshair (hiding it is not sufficient, since it might change texture later) */
func void removeCrosshair() {
if (Hlp_IsValidHandle(crosshairHndl)) { View_Delete(crosshairHndl); };

// const int zCCamera__StopTremor = 5551696; //0x54B650
// CALL__thiscall(_@(MEM_Camera), zCCamera__StopTremor);

};

/* Draw crosshair */
Expand All @@ -121,43 +116,6 @@ func void insertCrosshair(var int crosshairStyle, var int size) {
View_MoveToPxl(crosshairHndl, Print_Screen[PS_X]/2-(size/2), Print_Screen[PS_Y]/2-(size/2));
};
};

if (FREEAIM_TREMOR) {
if (MEM_Timer.totalTime-bowDrawOnset > FREEAIM_DRAWTIME_MAX) {
var int vec1[3]; var int vec2[3];
vec1[0] = castToIntf(12.0);
vec1[1] = castToIntf(12.0);
vec1[2] = castToIntf(12.0);
vec2[0] = castToIntf(12.0);
vec2[1] = castToIntf(12.0);
vec2[2] = castToIntf(12.0);
const int zCCamera__AddTremor = 5551712; //0x54B660
CALL_PtrParam(_@(vec2)); // zVEC3 const &
CALL_FloatParam(castToIntf(0.001)); // float tremorVelo
CALL_FloatParam(castToIntf(0.4)); // float tremorScale
CALL_PtrParam(_@(vec1)); // zVEC3 const &
CALL__thiscall(MEM_ReadInt(9273236), zCCamera__AddTremor); // zCCamera__activeCam 0x08D7F94
} else {
// const int zCCamera__StopTremor = 5551696; //0x54B650
// CALL__thiscall(_@(MEM_Camera), zCCamera__StopTremor);
};
};
/* if (FREEAIM_TREMOR) {
if (MEM_Timer.totalTime-bowDrawOnset > FREEAIM_DRAWTIME_MAX) {
MEM_Camera.tremorToggle = 1;
MEM_Camera.tremorScale = castToIntf(0.08);
MEM_Camera.tremorAmplitude[0] = FLOATNULL; // Z (back and forth)
MEM_Camera.tremorAmplitude[1] = mkf(FREEAIM_TREMOR); // Y (up and down)
MEM_Camera.tremorAmplitude[2] = mkf(FREEAIM_TREMOR); // X (left and right)
MEM_Camera.tremorOrigin[0] = castToIntf(0.0);
MEM_Camera.tremorOrigin[1] = castToIntf(20.0);
MEM_Camera.tremorOrigin[2] = castToIntf(0.0);
MEM_Camera.tremorVelo = castToIntf(0.00001);
} else {
MEM_Camera.tremorToggle = 0;
MEM_Camera.tremorScale = FLOATNULL;
};
};*/
} else { removeCrosshair(); };
};

Expand Down
39 changes: 39 additions & 0 deletions System/Menu_Opt_Game_FreeAim.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* FREEAIM OPTIONS
*
* Add these entries to the Menu_Opt_Game.d and adjust the indices:
* items[15] = "MENUITEM_OPT_FREEAIM";
* items[16] = "MENUITEM_OPT_FREEAIM_CHOICE";
* Also in Menu_Opt_Game.d in MENUITEM_GAME_BACK change this:
* posy = MENU_BACK_Y+300;
*
* Adjust the item id (MENU_ID_FREEAIM) below if you added other options and change the labels if needed
*/

const int MENU_ID_FREEAIM = 7; // Next available Y-spot in the menu
const string MENU_FREEAIM_LABEL = "Freies Zielen"; // "Free aiming"
const string MENU_FREEAIM_CHOICES = "aus|an"; // "off|on"
const string MENU_FREEAIM_DESCR = "Erfordert Gothic 1 controls"; // "Requires Gothic 1 controls"

INSTANCE MENUITEM_OPT_FREEAIM(C_MENU_ITEM_DEF) {
backpic = MENU_ITEM_BACK_PIC;
text[0] = MENU_FREEAIM_LABEL;
text[1] = MENU_FREEAIM_DESCR;
posx = 1000; posy = MENU_START_Y + MENU_SOUND_DY*MENU_ID_FREEAIM;
dimx = 3000; dimy = 750;
onSelAction[0] = SEL_ACTION_UNDEF;
flags = flags | IT_EFFECTS_NEXT;
};

instance MENUITEM_OPT_FREEAIM_CHOICE(C_MENU_ITEM_DEF) {
backPic = MENU_CHOICE_BACK_PIC;
type = MENU_ITEM_CHOICEBOX;
text[0] = MENU_FREEAIM_CHOICES;
fontName = MENU_FONT_SMALL;
posx = 5000; posy = MENU_START_Y + MENU_SOUND_DY*MENU_ID_FREEAIM + MENU_CHOICE_YPLUS;
dimx = MENU_SLIDER_DX; dimy = MENU_CHOICE_DY;
onChgSetOption = "enabled";
onChgSetOptionSection = "FREEAIM";
flags = flags & ~IT_SELECTABLE;
flags = flags | IT_TXT_CENTER;
};

0 comments on commit 423e996

Please sign in to comment.