Loading [MathJax]/extensions/Safe.js

Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Reducing the number of cockpit views  (Read 172 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6231
Reducing the number of cockpit views
« on: September 01, 2023, 10:50:56 AM »

Here's a reminder of one of my fairly early mods for my own game, soon after getting to grips with Java. And that is reducing the number of cockpit views to cycle through. To start with, I really disliked the number of key presses. And some views I hardly used. The stock scheme:

- Start: cockpit interior
- 1st change: HUD, reticle w/ velocity vector
- 2nd change: HUD, simple reticle
- 3rd change: reticle w/ velocity vector
- 4th change: simple reticle
- 5th change: empty ('Wonder Woman')
- 6th change: back to cockpit interior

I have cut out the two HUD views, reducing the number of key presses from 6 to 4, as I have very little use for that extra info. And it's ugly. Here's the code, in AircraftHotKeys.class:

Code: [Select]
HotKeyCmdEnv.addCmd(new HotKeyCmd(true, "CockpitShow", "28")
{

public void created()
{
setRecordId(213);
}

public void begin()
{
if(World.cur().diffCur.Cockpit_Always_On)
return;
if(Main3D.cur3D().isViewOutside())
return;
if(!(Main3D.cur3D().cockpitCur instanceof CockpitPilot))
return;
if(Main3D.cur3D().isViewInsideShow())  //1st change: show reticle with velocity vector only
{
Main3D.cur3D().setViewInsideShow(false);  //set interior OFF
Main3D.cur3D().hud.bDrawDashBoard = false;  //set HUD OFF
Main3D.cur3D().cockpitCur.setEnableRenderingBall(true);  //set reticle/vector ON
} else
if(Main3D.cur3D().isEnableRenderingCockpit() && Main3D.cur3D().cockpitCur.isEnableRenderingBall())  //show simple reticle only
Main3D.cur3D().cockpitCur.setEnableRenderingBall(false);  //set reticle/vector OFF
else
if(Main3D.cur3D().isEnableRenderingCockpit() && !Main3D.cur3D().cockpitCur.isEnableRenderingBall())  //3rd change: show EMPTY
{
Main3D.cur3D().setEnableRenderingCockpit(false);  //set cockpit OFF
} else  //4th change: restore cockpit ON
{
Main3D.cur3D().setEnableRenderingCockpit(true);
Main3D.cur3D().setViewInsideShow(true);//set interior ON
}
}
}
);


By itself it is AircraftHotKeys$66.class (in B.A.T. 4.0, anyway); here it is in its entirety:

Code: [Select]
package com.maddox.il2.game;

import com.maddox.il2.ai.DifficultySettings;
import com.maddox.il2.ai.World;
import com.maddox.il2.objects.air.Cockpit;
import com.maddox.il2.objects.air.CockpitPilot;
import com.maddox.rts.HotKeyCmd;

// Referenced classes of package com.maddox.il2.game:
//            Main3D, HUD, AircraftHotKeys

final class AircraftHotKeys$66 extends HotKeyCmd
{

    public void created()
    {
        setRecordId(213);
    }

    public void begin()
    {
        if(World.cur().diffCur.Cockpit_Always_On)
            return;
        if(Main3D.cur3D().isViewOutside())
            return;
        if(!(Main3D.cur3D().cockpitCur instanceof CockpitPilot))
            return;
        if(Main3D.cur3D().isViewInsideShow())
        {
            Main3D.cur3D().setViewInsideShow(false);
            Main3D.cur3D().hud.bDrawDashBoard = false;
            Main3D.cur3D().cockpitCur.setEnableRenderingBall(true);
        } else
        if(Main3D.cur3D().isEnableRenderingCockpit() && Main3D.cur3D().cockpitCur.isEnableRenderingBall())
            Main3D.cur3D().cockpitCur.setEnableRenderingBall(false);
        else
        if(Main3D.cur3D().isEnableRenderingCockpit() && !Main3D.cur3D().cockpitCur.isEnableRenderingBall())
        {
            Main3D.cur3D().setEnableRenderingCockpit(false);
        } else
        {
            Main3D.cur3D().setEnableRenderingCockpit(true);
            Main3D.cur3D().setViewInsideShow(true);
        }
    }

    AircraftHotKeys$66(boolean flag, String s, String s1)
    {
        super(flag, s, s1);
    }
}
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)
Pages: [1]   Go Up
 

Page created in 0.031 seconds with 19 queries.