Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Nanami

Crazy Code

Recommended Posts

I was working on ZooM today, going through the lap script, and started laughing because some of the code I wrote is pretty zany to look at sometimes. I really should comment some of it. Anyway, take a look at this:

 for (int a=0;a<5;a+=2)
 {
  if (where == a/2+1)
  {
   if (lap[PlayerNumber()] % 8 == a)
   {
    lap[PlayerNumber()] += 2;
    Print(s:"\cECheckpoint ",d:a/2+1,s:".");
    point[PlayerNumber()] = a+1;
    if (GameType() == 0 && save == 1)
     AutoSave();
   }
  }
Really it's not that bad. It handles the first three cases of the checkpoints. If it returns the right arg, and you're where you're supposed to be, it increases your "location" variable. But it's hard on the eyes sometimes.

I also enjoyed writing this little baby:
 for (int b=0;b<3;b+=2)
 {
  Thing_SpawnNoFog(11+b,5,0,50+b);
  Thing_SpawnNoFog(12+b,5,192-64*b,51+b);
  SetThingSpecial(50+b,80,69+b,0,0,0,0);
  Thing_SetTranslation(51+b,1);
  SetActorProperty(50+b,APROP_HEALTH,1);
  Thing_Hate(51+b,50+b,6);
 }
It took a while to get, but there's two objects facing eachother and they both shoot fireballs at eachother, so I got one script that does the same thing, just in reverse of the first one, by making it subtract 64 times a variable, which is at one point zero. =P

Well, for all of you out there that do ACS or Fragglescript or whatever, what's the craziest code you've ever programmed?

Oh and by the way, a cookie to anyone who figures out what this does. It's from the lap script I made for ZooM:
 HudmessageBold(n:0,s:": ",d:lap[PlayerNumber()]/8;
 0,11+PlayerNumber(),9,1.0,0.3+0.025*(PlayerNumber()+1),0);
It's one line of code, but broken because in Notepad and here it's too wide to fit on one line. =)

Share this post


Link to post
Nanami said:

Well, for all of you out there that do ACS or Fragglescript or whatever, what's the craziest code you've ever programmed?


That line gets the sprite data for an enemy in my game :)

EnemyDef[Enemy[i].type-1].data[EnemyDef[Enemy[i].type-1].anim[EnemySprite[i].sprite_s].resource].dat
That's the only thing I can think of right now, but my code is full of that stuff ;)

Share this post


Link to post

ok i guess this stuff isn't too weird, since it's just basic. it's code i'm using in my ti-86 game sorcery4.

lbl LOOP2
:getky->VAR5
:If VAR5!=25 and VAR5!=34 and VAR5!=24 and VAR5!=26 and VAR5!=105 and VAR5>20 
or VAR5-10==CHAR or VAR5>10 and VAR5<20 and CAM==1 or VAR5==0
:Goto LOOP2
:If VAR5==15: Goto YN
:If VAR5>10 and VAR5<20
:Goto LOOP11
:If VAR5==105: Goto LOOP4
:If VAR5==25 or VAR5==34: VAR2->VAR6
:If VAR5==25 and VAR6!=1: VAR2-1->VAR2
:If VAR5==25 and VAR6==1: 3->VAR2
:If VAR5==34 and VAR6!=3: VAR2+1->VAR2
:If VAR5==34 and VAR6==3: 1->VAR2
:If VAR6<=3: Text (8+7(VAR6-1),0,SPACE
etc etc etc

if you don't understand, don't fret, neither do i. i always hope i never have to mess with code i wrote before, because
it only makes sense to me as I'm writing it.

Share this post


Link to post

I can't tell which is funnier, boris' giant line or Sarge's "World's Largest If Statement."

Share this post


Link to post
Nanami said:

I can't tell which is funnier, boris' giant line or Sarge's "World's Largest If Statement."

let me see if i can find a longer one. i just picked that part of my program randomly.

let's see, i also have

:Lbl LOOP6: getKy->VAR6
:If VAR6!=81 and VAR6!=64 and VAR6!=74 and VAR6!=53 and VAR6!=51 and VAR6!=52 
and VAR6!=54 and VAR6!=94
:Goto LOOP6
:If xClass=="Paladin" and VAR6==81 or xClass=="Illusionist" and VAR6==64 or xClass=="Necromancer"
and VAR6==74 or xClass=="Cleric" and VAR6==53 or xClass=="Archer" and VAR6==51 or 
xClass=="Barbarian" and VAR6==52 or xClass=="Druid" and VAR6==54 or xClass=="Wizard" and VAR6==94
:Goto CHAR1B

Share this post


Link to post

boris:

dattype *GetSprite(int i) {
return &(EnemyDef[Enemy[i].type-1].data[EnemyDef[Enemy[i].type-1].anim[EnemySprite[i].sprite_s].resource].dat);
}

Share this post


Link to post

I have a feeling this thread will win the following awards:

* Award for most [code] tags ever
* Award for widest page-widening posts
* Most geeky people in one thread

Hehehe.

Share this post


Link to post
Nanami said:

I can't tell which is funnier, boris' giant line or Sarge's "World's Largest If Statement."

Unable to locate teh funney. Tho it might be because coding makes absolutely no sense to me.

Share this post


Link to post

with a variation of that code, Nanami, you could probably display another player's (or monster enemy's) health points. right?
I suppose it would require a LOS check for what enemy is truly in front of you, but I always thought it would be cool to play Skulltag (for example) and see the opposing player's health in your hud or on screen.
just a thought.

Share this post


Link to post

I imagine you could run scripts and keep track of all monster's health, and if one lowers it starts displaying that one's health.

Share this post


Link to post

The MBF (and therefore also Eternity and PrBoom) source is full of weird code. I still haven't been able to figure this particular gem of convoluted code out:

      /* killough 7/18/98: no friendly fire at corpses
       * killough 11/98: prevent too much infighting among friends
       * cph - yikes, talk about fitting everything on one line... */

      return
  !(actor->flags & MF_FRIEND) ||
  (actor->target->health > 0 &&
   (!(actor->target->flags & MF_FRIEND) ||
    (actor->target->player ?
     monster_infighting || P_Random(pr_defect) >128 :
     !(actor->target->flags & MF_JUSTHIT) && P_Random(pr_defect) >128)));
It's just totally unreadable unless you start thinking for at least an hour about it...

Share this post


Link to post

//               Friday, January 24, 2003  5:00:51 PM

// D:\doom\Captain\Captain.wad
// **************************************************************
// ACC script decompiler (c) 1995 Luc Cluitmans                 *
// DeePsea Port 11-16-2001 by Jack Vermeulen (v1.14)            *
// ZDOOM Support is not all done- but should show most scripts  *
// **************************************************************
#include "zcommon.acs"

// BEHAVIOR 3 scripts, 1 strings

// ==================================================
That's the whole thing. Yeah, I don't know either.

Share this post


Link to post

How about largest script file? My attempt to code CTF for Legacy was more than 2100 lines long and 68kb before I finally ran into a problem I couldn't work around.

Share this post


Link to post
Nanami said:

Well, for all of you out there that do ACS or Fragglescript or whatever, what's the craziest code you've ever programmed?


Either the rising lava or timer/random explosion scripts in LTSD or the act 2 boss scripts in Super Sonic DooM. (pretty complex, even by the standards of my ZDoom wads)

Share this post


Link to post

I hope Lüt will hold a seminar about the intricacy of the Millennium boss, once the TC/Megawad is released.

It's behaviour just explained in common terms is enough to make your head hurt.

Share this post


Link to post

a couple of the scripts in massm2 span multiple maps (ie what you do in one map effects what happens in the next map) and the scripts in the final map are so insanely complex and messy that I have trouble reading them myself, but that could be due to the fact that I'm a bit of a sloppy coder with acs, coupled with the fact that I totally neglected to comment the massm2 scripts which I don't usually do with acs :/ (or any language for that matter)

the scripts lump is a bit less than 11k of text, but the actual map (with scripts lump) is only 40k (53 sectors, 313 lines) so the scripts is over 1/4 the filesize heh

nothing is overly complex or hard to follow however (at least not for me, er aside from the last map).

HudmessageBold(n:0,s:": ",d:lap[PlayerNumber()]/8; 0,11+PlayerNumber(),9,1.0,0.3+0.025*(PlayerNumber()+1),0);


looks like a hudmsg broadcast to all players, uh, I assume n:0 is the name of the player who activated the special (just a guess tho), so it would say something like "Cyb: ##", 0 is a plain hudmsg (I believe), then assign the msg an id of 11 + the player number (for whatever reason, I suppose you've already got 10 hudmsgs running at this point), 9 is the color (I dunno it offhand, use the goddamn defines you jrk!), and the next four numbers deal with how long the hudmsg stays on the screen, how long the letters take to type on, how long the msg stays on the screen after it's typed and how long it takes to fade out (not in that order), though those are really useless if you're using a plain hudmsg, so perhaps I was wrong... okay glancing at zdefs.acs, 9 is white and zero is a plain hudmsg, so indeed those extra values are fairly useless :P but it would seem to print the player name and which lap they're on divided by 8 (why divided by eight, I couldn't tell you tho :P )

Share this post


Link to post

oh here's a fun script from map14 of massm2. I changed some var names and the hudmsg so it won't give away anything, but this is the script:

script 4 (void)
{
	if(bosshealth != getactorproperty(14, APROP_Health))
	{
		setmusic("D_FIGHT", 0);
		acs_execute(const:5, 0);
		if(!npcstate)
			ceiling_lowerbyvalue(const:29, 32, 96);
		ambientsound("bossvoice", 127);
		hudmessage (s: "blah blah blah";
			HUDMSG_PLAIN | HUDMSG_LOG, 1, CR_WHITE, 0.5, 0.75, 2, 0.05, 1.5);
		delay(35 * 3);
		hudmessage (s: " ";
			HUDMSG_PLAIN, 1, CR_WHITE, 0.5, 0.75, 2, 0.05, 1.5); 
		if(!actorstate)
		{
			acs_terminate(const:12, 0);
			thing_move(const:14, 31);
		}
		setlineblocking(1, OFF);
	}
	else if(!thingcount(0, 666) && npcstate == 1)
	{
		killnpc = 1;
		acs_execute(const:6, 0);
	}
	else
	{
		delay(1);
		restart;
	}
}
heh. for those curious, this all has to do with the multiple endings and the possible choices you can make spanning end of the previous map and the beginning of this map (and yes I know the hudmsg is poorly done :P )

Share this post


Link to post
Cyb said:

blah blah blah about my code blah blah blah

You're pretty full on there Cyb.

HudmessageBold(n:0
Prints a message to all players. It returns their name and splashes it up there. Like "Nanami"
,s:": ",d:lap[PlayerNumber()]/8
After their name it adds a colon and a space and displays what lap they're on. The division by eight is just how I ended up writing the lap scripting.
; 0,11+PlayerNumber(),9,
This is for the number and color. The color is white. The zero is for the text type, and 0 is plain.
1.0,0.3+0.025*(PlayerNumber()+1),0);
This is my favorite part. This tells it where to display. The 1.0 means "all the way on the right" and the second part is where to put it. 0.3 starts it at one place, with an addition .025 depending on which player you are. So player one is displayed here, and player two is displayed .025 units under that, player three .025 units under that. The spacing is great but it took forever to get. The zero at the end means "stay forever."

The final display looks something like this:
     Nanami: 1
        BBG: 1
        Cyb: 2
   Linguica: 0
And all in one line of code. Bwahahahaha.

Share this post


Link to post

This is pretty complicated. Not syntactically ugly, just tough.

bool CFactory::makeDelivery(int num, const SMapPoint& loc)
{
   double xdist, ydist;
   float distance;

   // find distance between factory and drop point using
   // distance formula -- distance = sqrt((x2-x1)^2 + (y2-y1)^2)
   xdist = loc.x - location.x;
   ydist = loc.y - location.y;

   distance = (float)sqrt(xdist*xdist + ydist*ydist);

   // return to this label whenever more deliveries can be made,
   // and the appropriate action will be taken under any
   // circumstance
delivery:
   if(num <= numWidgetsAvailable)
   {
      // we will NOT run out of widgets while processing this order,
      // but we could run out of waiting robots...
      while(num && numBotsWaiting)
      {
	 // always get first waiting robot
	 CDeliveryBot *bot = &waitingBots[0];

	 if(bot->getCapacity() >= num)
	 {
	    // one bot can carry whole load at its capacity or less	    
	    numWidgetsAvailable -= num;
	    numWidgetsDelivered += num;
	    bot->setReturnTime(num, distance, factoryClock);
	    num = 0;
	 }
	 else
	 {
	    int cap = bot->getCapacity();

	    // this bot will carry its capacity
	    num -= cap;
	    numWidgetsAvailable -= cap;
	    numWidgetsDelivered += cap;
	    bot->setReturnTime(cap, distance, factoryClock);
	 }

	 // add this bot to the delivery list, then increment the
	 // number of delivering bots
	 insertToDeliveringBots(bot);
	 numBotsDelivering++;
	 cout << "Delivery " << (CRobot&)*bot << " " << distance
	    << " units, will return at " << bot->getReturnTime()
	    << endl;

	 // shift down waitingBots to remove first from list,
	 // then decrement number of waiting bots
	 shiftDownWaitingBots();
	 numBotsWaiting--;

      } // end while

      // if num > 0 at this point, then we ran out of robots before 
      // completing the order above
      if(num > 0)
      {	 
	 // NOTE: the exact criterion for when to restart deliveries
	 // is not specified in this case, the specifications say only
	 // to "process next widget times and robot return times until 
	 // the delivery is complete."  I have chosen to not resume
	 // deliveries until at least one delivering robot has returned, 
	 // for sake of safety and simplicity.

	 // run assembly bots and delivery bots until all pending
	 // deliveries are complete
	 while(!numBotsWaiting)
	 {
	    // run assembly bots for this clock tick
	    for(int i = 0; i < numAssemblyBots; i++)
	    {
	       CAssemblyBot *abot = assemblyBots + i;
	       if(abot->getNextWidgetTime() == factoryClock)
	       {
		  numWidgetsAvailable++; // produce one widget
		  CAssemblyBot tmp = *abot; // copy to temp. location
		  shiftDownAssemblyBots(i); // remove from list
		  numAssemblyBots--;
		  
		  cout << "Assembly " << (CRobot&)tmp 
		     << " widget produced at " 
		     << tmp.getNextWidgetTime()
		     << endl;
		  
		  bool ret = addBot(tmp);   // readd the bot to the list
		  if(!ret)
		     return false; // error!
	       }
	    }
	    
	    // NOTE: if the deliveringBots list is modified WHILE
	    // this rover is moving through it, the list will be
	    // corrupted and bots may actually be duplicated.
	    // Solution? Keep track of the bots that have been
	    // moved to the waiting list via a dynamic boolean vector,
	    // and use it afterward to clean up the list.

	    bool *removed = new bool [numBotsDelivering];
	    memset((void *)removed, 0, numBotsDelivering*sizeof(bool));
	    // run delivery bots for this clock tick
	    int j;
	    for(j = 0; j < numBotsDelivering; j++)
	    {
	       CDeliveryBot *dbot = deliveringBots + j;
	       if(dbot->getReturnTime() == factoryClock)
	       {
		  removed[j] = true;

		  // put the delivery bot back into the waiting list
		  bool ret = addBot(*dbot);
		  if(!ret)
		     return false;
	       }
	    }

	    int count = numBotsDelivering;
	    for(j = 0; j < count; j++)
	    {
	       if(removed[j])
	       {
		  // remove from delivery list
		  shiftDownDeliveringBots(j);
		  numBotsDelivering--;
	       }
	    }

	    // delete the deletion vector :)
	    delete [] removed;

	    // increment the factoryClock
	    CTimer oneMin(0, 1);
	    factoryClock = factoryClock + oneMin;
	 } // end while(num)

	 // return to making deliveries
	 goto delivery;

      } // end if(num > 0)
      // order is finished
      return true;
   } // end if(num <= numWidgetsAvailable)
   else
   {
      // widgets must be produced to fill this order, so get that
      // out of the way first

      // this is similar to the code above used when the
      // waiting bots are expended
      while(num > numWidgetsAvailable) // only until order can be filled
      {
	 // run assembly bots for this clock tick
	 for(int i = 0; i < numAssemblyBots; i++)
	 {
	    CAssemblyBot *abot = assemblyBots + i;
	    if(abot->getNextWidgetTime() == factoryClock)
	    {
	       numWidgetsAvailable++;
	       CAssemblyBot tmp = *abot;
	       shiftDownAssemblyBots(i);
	       numAssemblyBots--;
	       
	       cout << "Assembly " << (CRobot&)tmp 
		  << " widget produced at " 
		  << tmp.getNextWidgetTime()
		  << endl;
	       
	       bool ret = addBot(tmp);   // readd the bot to the list
	       if(!ret)
		  return false; // error!
	    }
	 }

	 // run delivery bots for this clock tick

	 // see note above about this deletion vector

	 bool *removed = new bool [numBotsDelivering];
	 memset((void *)removed, 0, numBotsDelivering*sizeof(bool));
	 
	 int j;
	 for(j = 0; j < numBotsDelivering; j++)
	 {
	    CDeliveryBot *dbot = deliveringBots + j;
	    if(dbot->getReturnTime() == factoryClock)
	    {
	       removed[j] = true;
	       
	       // put the delivery bot back into the waiting list     
	       bool ret = addBot(*dbot);
	       if(!ret)
		  return false;
	    }
	 }
	 
	 int count = numBotsDelivering;
	 for(j = 0; j < count; j++)
	 {
	    if(removed[j])
	    {
	       shiftDownDeliveringBots(j);
	       numBotsDelivering--;
	    }
	 }
	 
	 delete [] removed;

	 // increment the factoryClock
	 CTimer oneMin(0, 1);
	 factoryClock = factoryClock + oneMin;
      } // end while

      // Normally I would NEVER do this, but if I didn't, I'd be
      // duplicating the entire code that's in the if above, so
      // I feel it is justified
      goto delivery;
   } // end else
}

Share this post


Link to post
Quasar said:

This is pretty complicated. Not syntactically ugly, just tough.
<insert stuff about deliveries and robots here>

Heh wtf

Share this post


Link to post

Heh, this isn't a script dor doom, but it's some of the work im doing with c++:

//Mine Field Game - version 1.3

#include <iostream>
#include <exception>
#include <string>
#include <vector>
#include <cstdlib>
#include <ctime>
#include "MenuUtility.h"

using namespace std;
using namespace menuNamespace;

class StepOnMine{};
class FailedDisarm{};

class MineField
{
     vector<bool> minefield;
     //stores where the player has been
     vector<bool> beenThere; 
     int location; //current location of player
public:
     MineField()  //4X4 minefield
     {
          srand(time(0));
          location = 0;
          for (int c = 0; c <16; c++)
          {
               minefield.push_back(false);
               beenThere.push_back(false);
          }
          for (int i = 0; i <10; i++) //place 10 random mines
               minefield[rand()%15+1] = true;
          beenThere[0] = true;
     }

     bool IsAMine(int location)
     {
          return minefield[location];
     }

     string draw()
     {
          string s;
          for (int i = 0; i <4; i++)
          {     
               for (int c=0; c<4; c++)
               {
                    if (location == i*4+c)
                         s+='P';
                    else {
                         if (beenThere[i*4+c])
                              s+= "X";
                         else s+= " ";
                    }
                    s+="|";
               }
               s+= '\n';
          }
          return s;
     }

     bool moreMines()
     {
          for (int i=0; i<16; i++)
               if (beenThere[i]) return true;
          return false;
     }

     int Directions()
     {
          string options[4];
          options[0] = "North";
          options[1] = "East";
          options[2] = "South";
          options[3] = "West";
          return menu(options, 4);
     }

     int& place() {return location;}

     void goThere(int place) {beenThere[place] = true;}
};

void Detonate() 
{
     cout << "You detonated the mine. Ka-boom!!!\n";
}

void disarm()
{
     int temp = rand()%2+1;
     if (temp-1)
          throw FailedDisarm();
}

int main (void)
{
     set_terminate(Detonate);
     MineField m; //create the minefield

     string input;
     cout << "Welcome to the MineField!!\n"
          << "You are part of the elite Soviet mine team "
          <<"XJ77,\n sent to clear a deadly minefield full"
          <<" of remote heat-sensing claymore mines.\n"
          << "Most of your team will not survive.\n"
          << "Only the best of you will see then end of "
          << " the day.\n Do you have what it takes?\n";
     cin >> input;
     if(input == "no" || input == "No")
          goto TOO_BAD;
     cout << "You are in the NorthWest corner.\n";
PLAY:     
     try
     {
          int goTo;
          while(m.moreMines()){
               cout << endl << m.draw();
               
               cout << "Your position is marked with a P.\n"
                    << "Which direction would you like to go?"
                    <<endl;
               

               bool proper = false;
               do {
                    goTo = m.Directions();
                    if (goTo == 1 && m.place() >3)
                         proper = true;
                    if (goTo == 2 && (m.place()-3)%4 != 0)
                         proper = true;
                    if (goTo == 3 && m.place() <12)
                         proper = true;
                    if (goTo == 4 && m.place()%4 != 0)
                         proper = true;
                    if (!proper)
                         cout<<"\nYou cannot go that way.\n";
               }while (!proper);

               if (goTo == 1)
                    m.place() -= 4;
               if (goTo == 2)
                    m.place()++;
               if (goTo == 3)
                    m.place() += 4;
               if (goTo == 4)
                    m.place()--;

               m.goThere(m.place());
               
               if (m.IsAMine(m.place()))
                    throw StepOnMine();
          }
     }
     catch(StepOnMine)
     {
          int input;
          do {
          cout << "\nYou have encountered a mine.\n"
               << "What would you like to do?\n"\
               << "[1]Attempt to Disarm it.\n"
               << "[2]Run Away.\n";
          cin >> input;
          }while(input <1 && input >2);
          if (input == 1)
          {
               try { disarm(); }
               catch(FailedDisarm) {terminate();}
               cout << "You have disarmed the mine!!!\n";
               goto PLAY;
          }
          cout << "You have failed the XJ77 team.\n";
          goto TOO_BAD;

     }
     
     return 0;
TOO_BAD: cout << "\nMaybe next year kid.\n";
     return 0;
}

it's a mine field game, on a tic tac toe board in a way.

Share this post


Link to post

ah that's right I forgot about the screen position thingies in hudmsg, retarded brainfart on my part considering I've been using them the last four+ months or so...

anyways, if we're gonna start posting not acs, I may as well post my wacky fun function that converts doom format graphics to bmp. I need to rewrite it a bit so it doesn't do so many disk reads, and I'm sure some parts aren't as efficient as they could be, but I can't be arsed to do that right now :P

void doomtobmp(int index, ifstream& wain, string filename)
{
	gfxheader gfxhead;
	wain.seekg(dir[index].lump_start);

	wain.read(reinterpret_cast(&gfxhead.width), 2);
	wain.read(reinterpret_cast(&gfxhead.height), 2);
	
	wain.read(reinterpret_cast(&gfxhead.l_set), 2);
	wain.read(reinterpret_cast(&gfxhead.t_set), 2);

	//read in the column ptrs
	vector col_ptrs;
	for(int x = 0; x < gfxhead.width; x++)
	{
		long tmp;
		wain.read(reinterpret_cast(&tmp), 4);
		col_ptrs.push_back(tmp);
		//cout << col_ptrs[x] << " ";
	}
	//cout << col_ptrs.size() << endl;

	vector img_data;

	for(int z = 0; z < col_ptrs.size(); z++)
	{
		short pix2draw = gfxhead.height, prevpostend = 0;
		unsigned char bytedat, pdown;
		wain.read(reinterpret_cast(&bytedat), 1);
		while(bytedat != (unsigned char)255)
		{
			filltrans(img_data, bytedat - prevpostend);
			pix2draw -= (bytedat - prevpostend);
			prevpostend = bytedat;
			wain.read(reinterpret_cast(&bytedat), 1);
			pdown = bytedat;
			prevpostend += pdown;
			for(int q = 0; q < pdown + 2; q++)
			{
				wain.read(reinterpret_cast(&bytedat), 1);
				if(q != 0 && q != pdown + 1)
				{
					img_data.push_back(bytedat);
					pix2draw--;
				}
			}
			wain.read(reinterpret_cast(&bytedat), 1);
		}
		filltrans(img_data, pix2draw);
	}

	ofstream bmpout(filename.c_str(), ios::binary);
	bmpdataout(bmpout, gfxhead.width, gfxhead.height, 256, img_data.size());

	vector pad_data;
	if(gfxhead.width % 4 != 0)
	{
		for(int s = 4 - (gfxhead.width % 4); s > 0; s--)
			pad_data.push_back((char)0);
	}

	
	//pixel data - stored from top down vert in doom, bottom up horiz in bmps...doh
	for(int y = 1; y <= gfxhead.height; y++)
	{
		for(int p = 1; p <= gfxhead.width; p++)
			bmpout.write(reinterpret_cast(&img_data[(gfxhead.height * p) - y]), 1);

		//pad the bmp rows (if nexessary)
		for(int r = 0; r < pad_data.size(); r++)
			bmpout.write(reinterpret_cast(&pad_data), 1);
	}
}
yay, this thread is the nerdiest ever!

Share this post


Link to post

*chuckles heartily*

Then again, nerding is what we do. We might as well gloat about how good we are at it.

Share this post


Link to post

for (i = 0, seg1 = segs + firstLine + (numLines - 1), seg2 = segs + firstLine; i < numLines; i++, seg1--, seg2++)
{
   verts[(poly1->index * 3) + (i * 3) + 0] = -seg1->v2->x / MAP_SCALE;
   verts[(poly1->index * 3) + (i * 3) + 1] = sector->floorplane.ZatPoint(seg1->v2) / MAP_SCALE;
   verts[(poly1->index * 3) + (i * 3) + 2] = seg1->v2->y / MAP_SCALE;
   texCoords[(poly1->index * 2) + (i * 2) + 0] = -verts[(poly1->index * 3) + (i * 3) + 0] / 64.f * MAP_COEFF;
   texCoords[(poly1->index * 2) + (i * 2) + 1] = -verts[(poly1->index * 3) + (i * 3) + 2] / 64.f * MAP_COEFF;

   verts[(poly2->index * 3) + (i * 3) + 0] = -seg2->v2->x / MAP_SCALE;
   verts[(poly2->index * 3) + (i * 3) + 1] = sector->ceilingplane.ZatPoint(seg2->v2) / MAP_SCALE;
   verts[(poly2->index * 3) + (i * 3) + 2] = seg2->v2->y / MAP_SCALE;
   texCoords[(poly2->index * 2) + (i * 2) + 0] = -verts[(poly2->index * 3) + (i * 3) + 0] / 64.f * MAP_COEFF;
   texCoords[(poly2->index * 2) + (i * 2) + 1] = -verts[(poly2->index * 3) + (i * 3) + 2] / 64.f * MAP_COEFF;

   GL_RecalcSeg(seg1);
}
Nothing too wild and crazy. Just part of the function that recalculates the geometry for a given subsector.

Share this post


Link to post

I remember an old mistake wher I accidently was using the new Thing_SPawnFacing special in ZDoom... Basically i had tagged all my ettins (this was a ZDoom specific Hexen level) the smae as my spawnpoints, so whenever my ettins died there'd be another for each dead body in addition to the ones at the map points... Whoops!

script 1 (void) {
if(thingcount(T_ETTIN,4)<3 {
thing_spawnfacing(4,T_ETTIN,Spawn_NoFog,4);
}
delay(const:5);
restart;
}

See the problem? That little logic bug had even the CLERIC overwhelmed with ettins!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×