Author Topic: Supernova fix for multiple suns  (Read 2453 times)

0 Members and 1 Guest are viewing this topic.

Offline Shade

  • 211
Supernova fix for multiple suns
Got it working. Turned out to be a simple and easy fix, actually. Here's what to change if anyone wants to put it into CVS:

In starfield.cpp, search for "add the light source corresponding to the sun". 3 lines below that change the if condition to:
Code: [Select]
if(supernova_active() && idx==0)
Now go to the end of this function, and add this line between the second and third last closing bracket:
Code: [Select]
local_scale = 1.0f;
Finally, go to supernova.cpp and search for "only good if we have one sun", then comment out the three following lines.

All done :)

And of course, A Build to play with/test for bugs. A note: Only the first sun placed in a mission will go supernova, the rest are unaffected. So choose which sun is to blow early on and place it before the rest.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Supernova fix for multiple suns
Nicely done. How scared of the code are you still? Cause we can always use more coders. :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Shade

  • 211
Re: Supernova fix for multiple suns
Much less than I was two months ago, and it's getting better. FRED still makes me need a pants change though :lol: I'd be happy to help, but just don't expect me to do wonders... I'm just a hobbyist. In fact, when I first started looking through the code and tinkering a little I still had to look up C syntax on a regular basis. But we all have to start somewhere :)
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
-C

 

Offline Shade

  • 211
Re: Supernova fix for multiple suns
Nice, hadn't seen that. Past that stage now, but it's definitely a good starting guide :) My main online reference back when I first started playing with C/C++ was cprogramming.com, which I can recommend to anyone wanting to start coding as it has quite a good set of tutorials covering all the basics.

I eventually went out and got a few books though, I just find it nicer to be able to look in a book and if needed have it open next to the keyboard instead of having to switch windows all the time to find what I need.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Re: Supernova fix for multiple suns
Much less than I was two months ago, and it's getting better. FRED still makes me need a pants change though :lol: I'd be happy to help, but just don't expect me to do wonders... I'm just a hobbyist. In fact, when I first started looking through the code and tinkering a little I still had to look up C syntax on a regular basis. But we all have to start somewhere :)
Most here I think are hobbyists.  This is a hobby after all :)

Sounds like you have the talent for coding.  I CAN code...I have done C coding before...I do understand how it works basically...but I'm a coding idiot.  I just don't get some of what it takes to write good code and while I'm sure someone could beat me with a bat for a while and I'd get it...its just not worth it.  But for you...sounds like you've got it.  Words of encouragment!
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Shade

  • 211
Re: Supernova fix for multiple suns
Thanks :) Still plenty to learn, but best way to learn is by doing. And as I said, I'll gladly lend a hand to the SCP - Even if I can only do little stuff like this supernova fix or sexps at first, at least it can leave the more experienced coders to concentrate on more difficult problems. Interestingly, I have it exactly the same way with drawing and modeling as you do with coding... I can do it in theory, but nothing pretty ever comes out.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline Backslash

  • 29
  • Bring Our Might To Bear
Re: Supernova fix for multiple suns
You sound very similar to me, Shade... the stuff I've been doing so far looks impressive in function but is really just finding other similar code and welding it together to do what I want  ;)

Yeah, good point about taking the small things off the big coders.  Mediocre programmers unite!  From each according to his ability! Ignore me, I think I've had too much caffiene today...

Beat me to the supernova fix btw, nice work  :yes:  If nobody ended up doing it, I was going to look into it because of my plans for Capella...

(And hey, if the books you got apply to this stuff well, could you recommend me some titles?)

 

Offline Shade

  • 211
Re: Supernova fix for multiple suns
Mostly just reference stuff, didn't bother with all the 'become a master C programmer in 5 easy steps' tutorial type books, as tutorials are plentyful on the 'net. Just reference material for when I see a class or function and don't have a clue what it does, as was the case the first time I ran into an STL vector class and naively thought it had something to do with vectors... which, of course, it doesn't.

First one I got was 'The C++ programming language' by Bjarne Stoustrup, which was frankly a bad choice as it turned out to be a little over my head at the time. It's starting to prove useful now that I better understand what I'm doing though. I also got 'The C++ Standard Library' by Nicolai Josuttis, which I'd say has been rather more useful so far. So if anything, that's the one I'd recommend as while the basic C/C++ syntax isn't all that difficult to grasp, learning all the sometimes obscure built-in functions and classes is a different story.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Supernova fix for multiple suns
Well, Shade, I've been following your attempts to get the multiple-sun-supernova thing working, so I'm pretty satisfied you know how to get things done in the codebase. :) Do you want in?

I think there are only two requirements for being a good programmer:
1) Know how to code
2) Know how to solve problems

Number 2 is actually the more important one. :nod:

 

Offline Shade

  • 211
Re: Supernova fix for multiple suns
As long as you can live with "Know how to solve some problems", count me in :) Not going to try any advanced stuff until I've spent more time understanding the code, so initially I'll probably have to stick to bugfixing and maybe the odd sexp or two, and getting to know the code better while doing that.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Supernova fix for multiple suns
Good enough. :)