Special Aircraft Service

Please login or register.

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

Author Topic: No cockpit view mod request  (Read 1930 times)

0 Members and 2 Guests are viewing this topic.

shardana

  • member
  • Offline Offline
  • Posts: 868
No cockpit view mod request
« on: November 14, 2020, 05:24:37 PM »

Hi all! Would it be possible to have  only two views in the no cockpit View option? At the moment we have three a part the cockpit view. I’d love to have the possibility to chose only One of the three.
Logged

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #1 on: November 14, 2020, 10:59:00 PM »

A little while ago I started to develop a wish along this line. I also don't like the large number of no-cockpit views to cycle through. Eliminating one, or even two, would be fine with me. I'm not sure if I have the confidence and knowledge to do this safely, though.  :D

But out of interest I might start to look into it, at least to see what the code looks like. If, that is, this is completely controlled in a class or classes, and not in a .dll. (I suspect the latter is not involved, meaning we modders should hopefully be able to wrestle with this.)
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

shardana

  • member
  • Offline Offline
  • Posts: 868
Re: No cockpit view mod request
« Reply #2 on: November 15, 2020, 01:47:48 AM »

Well thank you!!  Hope you or someone else can solve this problem. I too use it just before
Take offs to check the situation on the runway.
Logged

DESPEREAUX

  • Modder
  • member
  • Offline Offline
  • Posts: 618
Re: No cockpit view mod request
« Reply #3 on: November 15, 2020, 04:29:17 AM »

If you disable such functions, then with the ability to do this optionally. I think so.
Logged

Greif11

  • Modder
  • member
  • Offline Offline
  • Posts: 489
  • Salty??....Just taste it
Re: No cockpit view mod request
« Reply #4 on: November 15, 2020, 05:41:57 AM »

You can use notepad as crowbar. Just open Body mesh in desired cockpit and delete or comment // unwanted camera hook.
Logged
BRGDS Andrew

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #5 on: November 15, 2020, 08:48:35 AM »

Andrew,
The issue here is the number of cockpit-off views that can be cycled through. These are the views that show no cockpit interior and no exterior parts of the plane at all, but for each view cycled through, one of a variety of HUD elements (and one view showing nothing at all.) The CAMERA, CAMERAAIM and CAMERAUP view hooks (usually defined in Body.msh) are not related to this view cycling aspect.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #6 on: November 15, 2020, 10:33:13 AM »

In AircraftHotKeys.java is this relevant bit of code (4.12), which looks to be directly relevant. It sets the action of the command, "CockpitShow", and controls what elements are to be displayed as the key is cycled, based on some states as checked for.

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())
                {
                    Main3D.cur3D().hud.bDrawDashBoard = true;
                    Main3D.cur3D().setViewInsideShow(false);
                    Main3D.cur3D().cockpitCur.setEnableRenderingBall(true);
                } else
                if(Main3D.cur3D().hud.bDrawDashBoard && Main3D.cur3D().cockpitCur.isEnableRenderingBall())
                    Main3D.cur3D().cockpitCur.setEnableRenderingBall(false);
                else
                if(Main3D.cur3D().hud.bDrawDashBoard && !Main3D.cur3D().cockpitCur.isEnableRenderingBall())
                {
                    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);
                }
            }

        }
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #7 on: November 15, 2020, 11:18:37 AM »

Delving further. Related to the no-cockpit views are the ones showing two different kinds of reticle; a fixed one only (nullMesh), and another fixed one with velocity vector included (nullMeshIL2). These are actual cockpits, placed in the same 3do\cockpit folder with all the rest, just very minimal ones indeed! This code snippet from Cockpit.java is related to their display:

Code: [Select]
    class NullDraw extends ActorDraw
    {

        public void preRender()
        {
            if(!Actor.isValid(pos.base()))
                return;
            if(nullMesh == null)
                return;
            if(nullMeshIL2 == null)
                return;
            pos.getRender(__l);
            Main3D.cur3D().cameraCockpit.pos.getRender(__p);
            __l.set(__p);
            if(bEnableRenderingBall)
                nullMesh.setPos(__l);
            else
                nullMeshIL2.setPos(__l);
            if(aircraft() != null)
                nullMesh.chunkSetAngles("Ball", aircraft().FM.getAOS(), -aircraft().FM.getAOA(), 0.0F);
            if(bEnableRenderingBall)
                iPreRender = nullMesh.preRender();
            else
                iPreRender = nullMeshIL2.preRender();
        }

        public void render()
        {
            if(iPreRender == 0)
                return;
            if(!Actor.isValid(pos.base()))
                return;
            if(nullMesh == null)
                return;
            if(nullMeshIL2 == null)
                return;
            if(bEnableRenderingBall)
                nullMesh.render();
            else
                nullMeshIL2.render();
        }

        private int iPreRender;

        NullDraw()
        {
            iPreRender = 0;
        }
    }

Farther along in Cockpit.java:

Code: [Select]
    public boolean isNullShow()
    {
        return bNullShow;
    }

    public void setNullShow(boolean flag)
    {
        Cockpit acockpit[] = Main3D.cur3D().cockpits;
        for(int i = 0; i < acockpit.length; i++)
            acockpit[i]._setNullShow(flag);

        if(bFocus)
        {
            Aircraft aircraft1 = aircraft();
            if(Actor.isValid(aircraft1))
                aircraft1.drawing(!flag);
        }
    }

    protected void _setNullShow(boolean flag)
    {
        bNullShow = flag;
    }

    public boolean isEnableRendering()
    {
        return bEnableRendering;
    }

    public void setEnableRendering(boolean flag)
    {
        Cockpit acockpit[] = Main3D.cur3D().cockpits;
        for(int i = 0; i < acockpit.length; i++)
            acockpit[i]._setEnableRendering(flag);

    }

    protected void _setEnableRendering(boolean flag)
    {
        bEnableRendering = flag;
    }

    public boolean isEnableRenderingBall()
    {
        return bEnableRenderingBall;
    }

    public void setEnableRenderingBall(boolean flag)
    {
        Cockpit acockpit[] = Main3D.cur3D().cockpits;
        for(int i = 0; i < acockpit.length; i++)
            acockpit[i]._setEnableRenderingBall(flag);

    }

    protected void _setEnableRenderingBall(boolean flag)
    {
        bEnableRenderingBall = flag;
    }

From the preceding snippet, this is a crucial element, where my guess is that acockpit.length sets the number of views to cycle through:

Code: [Select]
        Cockpit acockpit[] = Main3D.cur3D().cockpits;
        for(int i = 0; i < acockpit.length; i++)
            acockpit[i]._setEnableRendering(flag);

Off to investigate this!
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #8 on: November 15, 2020, 11:29:38 AM »

In Main3D.java:

Code: [Select]
    public int cockpitCurIndx()
    {
        if(cockpits == null || cockpitCur == null)
            return -1;
        for(int i = 0; i < cockpits.length; i++)
            if(cockpitCur == cockpits[i])
                return i;

        return -1;
    }


Code: [Select]
        if(cockpits != null)
        {
            for(int j = 0; j < cockpits.length; j++)
            {
                if(Actor.isValid(cockpits[j]))
                    cockpits[j].destroy();
                cockpits[j] = null;
            }

            cockpits = null;
        }
        cockpitCur = null;


Code: [Select]
    public void resetUserClear()
    {
        World.cur().resetUser();
        aircraftHotKeys.resetUser();
        if(cockpits != null)
        {
            for(int i = 0; i < cockpits.length; i++)
            {
                if(Actor.isValid(cockpits[i]))
                    cockpits[i].destroy();
                cockpits[i] = null;
            }

            cockpits = null;
        }
        cockpitCur = null;
        super.resetUserClear();
    }
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #9 on: November 15, 2020, 01:44:11 PM »

CAN DO! Just did a test.

The original code in AircraftHotKeys.java:

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())
                {
                    Main3D.cur3D().hud.bDrawDashBoard = true;
                    Main3D.cur3D().setViewInsideShow(false);
                    Main3D.cur3D().cockpitCur.setEnableRenderingBall(true);
                } else
                if(Main3D.cur3D().hud.bDrawDashBoard && Main3D.cur3D().cockpitCur.isEnableRenderingBall())
                    Main3D.cur3D().cockpitCur.setEnableRenderingBall(false);
                else
                if(Main3D.cur3D().hud.bDrawDashBoard && !Main3D.cur3D().cockpitCur.isEnableRenderingBall())
                {
                    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);
                }
            }

        }

If I chop out the middle, as follows,

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())
                {
                    Main3D.cur3D().hud.bDrawDashBoard = true;
                    Main3D.cur3D().setViewInsideShow(false);
                    Main3D.cur3D().cockpitCur.setEnableRenderingBall(true);
                } else

/* stuff cut out  */

                {
                    Main3D.cur3D().setEnableRenderingCockpit(true);
                    Main3D.cur3D().setViewInsideShow(true);
                }
            }

        }

The views are now limited to (1) the normal cockpit view and (2) the no-cockpit view with HUD instruments and reticle with acceleration vector. That is, just 2 views to toggle between instead of 6.

Now I might fiddle around some more, to see if I can get this sequence:

cockpit
HUD instruments
reticle only
empty
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #10 on: November 15, 2020, 01:52:11 PM »

One thing to check on. Will this have repercussions for track playbacks where a view is used that one no longer supports? Hmmm....

Just played back a mission (Ki-61 v B-24) and a training track (109 gunnery), where I know there are instances of the use of a reticle-only view. With the severely limited 2-view-only test code, the game simply uses the cockpit-on view when it cannot display a reticle-only view. Makes sense, and at least there's no crash.


I'll mention parenthetically that my new reticle-off-at-mission-start mod results in reticles being off in tracks where the reticle was originally on at the time of recording start. A bit of a pain, especially when one wants to use the training tracks.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6072
Re: No cockpit view mod request
« Reply #11 on: November 15, 2020, 03:05:16 PM »

OK, success. Pretty simple in the end. Here's the code for AircraftHotKeys.java to obtain the following view cycling sequence (starting from the already-on, normal cockpit view):

1) HUD instruments and reticle (newer Pacific Fighters type with acceleration vector indicator)
2) Reticle only (same as previous)
3) Empty
4) Back to cockpit view

Code: [Select]
            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())  //to toggle off interior, and show HUD and reticle
                {
                    Main3D.cur3D().hud.bDrawDashBoard = true;
                    Main3D.cur3D().setViewInsideShow(false);
                    Main3D.cur3D().cockpitCur.setEnableRenderingBall(true);
                } else
                if(Main3D.cur3D().hud.bDrawDashBoard && Main3D.cur3D().cockpitCur.isEnableRenderingBall())  //to toggle off HUD instruments, and show reticle only
                {
                    Main3D.cur3D().hud.bDrawDashBoard = false;
                } else
                if(Main3D.cur3D().isEnableRenderingCockpit() && Main3D.cur3D().cockpitCur.isEnableRenderingBall())  //to toggle off reticle, and show empty
                {
                    Main3D.cur3D().setEnableRenderingCockpit(false);
                    Main3D.cur3D().cockpitCur.setEnableRenderingBall(false);
                } else
                {
                    Main3D.cur3D().setEnableRenderingCockpit(true);  //to restore to normal cockpit view
                    Main3D.cur3D().setViewInsideShow(true);
                }
            }


Note that this now bypasses the original style no-cockpit reticle (circle with dotted cross lines). I never liked that one, although its texture can be changed to whatever one fancies. I find that the newer reticle introduced with Pacific Fighters, with the valuable addition of the acceleration vector caret, is much more useful. Especially for carrier landing practice!  ;)

I'll release this mod, based on the stock 4.12 Java. I've no idea at the moment if other game versions are compatible. But any other Java-capable modder can EASILY incorporate this into other versions as required.

Note that users of the 'Stabilizers For All Planes' mod will require to have this code added. Because that mod is based on the same AircraftHotKeys.class. I'll post a version so altered...

Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)
Pages: [1] 2   Go Up
 

Page created in 0.049 seconds with 26 queries.