lol wtf TETRIS!!!

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Fri Aug 07, 2009 8:39 am

  • I got tetris to work. while ingame do, impulse 100, to pull it up, and again to exit. known bugs:
    menu font fucked up a little bit, defaultnexuiz.cfg not synced with included source package in 2.5.1.
    http://www.fileden.com/files/2009/8/4/2 ... tetris.pk3

    controls are: left, down, right for movement, jump and attack (primary) are rotate.

    The scoring is:

    1 line: 10 points.
    2 lines: 40 points
    3 lines: 90 points.
    A tetris: 160 points.
    Any single piece placed on the level: 1 point

    Every 20 completed lines (check your line count on the right) you gain a level.
    Each level increases the speed at which the tetrads fall, making it more
    difficult. The high score is saved between games.

    If you should fail, the game will print Game Over. To return to Nexuiz press
    impulse 100 again. To start a new game of tetris, pres the fire button.

    Image
    Image
    Image
    Image
    Image
    Image
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Fri Aug 07, 2009 11:26 am

Fri Aug 07, 2009 1:18 pm

  • Except it's not exactly easy to merge this, because it's not a diff.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Fri Aug 07, 2009 4:11 pm

  • yea, as i said earlier i don't have an svn atm.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Fri Aug 07, 2009 4:47 pm

  • Well, you didn't even provide sources with tetris integrated. The qc files you provided do not call anything from g_tetris.qc...

    So we really need to know more about what you changed, apart from adding g_tetris.qc back.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Fri Aug 07, 2009 5:02 pm

Fri Aug 07, 2009 5:59 pm

  • I think divverent was hoping for some patched files so he could create a diff / integrate it into svn.



    this would be an awesome easter egg.
    User avatar
    [-z-]
    Site Admin and Nexuiz Ninja
     
    Posts: 1794
    Joined: Mon Nov 13, 2006 12:20 am
    Location: Florida

Fri Aug 07, 2009 6:14 pm

  • it can replace g_tetris.qc, just fix the progs.src and rename the file. lol it would.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Fri Aug 07, 2009 6:17 pm

Fri Aug 07, 2009 6:36 pm

  • Hah, this would be pretty fun if it could be played while spectating :) but I'm guessing it's server side. Fun stuff anyway.
    <Ozomahtli> what?
    nifrek
    Alien
     
    Posts: 208
    Joined: Fri Sep 22, 2006 6:43 am

Fri Aug 07, 2009 6:40 pm

  • you can play it in spec, it doesnt pause the game, just makes you play tetris (and get killed for not paying attention to the battle)
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Fri Aug 07, 2009 6:46 pm

  • You still must have modified something, if impulse 100 is working for you. The original g_tetris.qc uses impulse 200.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Fri Aug 07, 2009 6:51 pm

  • When I use your g_tetris.qc, I don't get any sound either.

    Please supply your exact sources you used for making your progs.dat, so it can be incorporated into svn.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Fri Aug 07, 2009 7:14 pm

  • Progs.src:
    Code: Select all
    ../../progs.dat // output filename

    ../common/util-pre.qh
    sys.qh
    pre-builtins.qh
    builtins.qh
    extensions.qh
    post-builtins.qh
    constants.qh
    ../common/constants.qh
    ../common/util.qh
    ../common/items.qh

    defs.qh      // Should rename this, it has fields and globals

    //// tZork Turrets ////
    tturrets/include/turrets_early.qh

    campaign.qh
    ../common/campaign_common.qh
    ../common/mapinfo.qh
    ../common/util.qc

    csqcprojectile.qh
    csqceffects.qc

    portals.qh

    g_hook.qh

    scores.qh

    ipban.qh

    race.qh

    keyhunt.qh

    antilag.qh

    vote.qh

    scores_rules.qc

    miscfunctions.qc

    waypointsprites.qc


    // general bot utility functions and management
    bots.qc

    // LordHavoc's bots
    havocbot.qc
    havocbot_roles.qc

    g_subs.qc
    tetris.qc


    runematch.qc
    arena.qc

    g_violence.qc
    g_damage.qc

    teamplay.qc

    cl_physics.qc

    // tZork's libs
    verbstack.qc
    movelib.qc
    steerlib.qc
    pathlib.qc

    g_world.qc
    g_casings.qc

    t_jumppads.qc
    t_teleporters.qc

    sv_main.qc
    sv_stats.qc

    g_triggers.qc
    g_models.qc

    cl_weaponsystem.qc
    w_common.qc

    w_laser.qc
    w_shotgun.qc
    w_uzi.qc
    w_grenadelauncher.qc
    w_electro.qc
    w_crylink.qc
    w_nex.qc
    w_minstanex.qc
    w_hagar.qc
    w_rocketlauncher.qc
    w_porto.qc
    w_hook.qc
    w_hlac.qc
    w_seeker.qc
    w_campingrifle.qc

    t_items.qc
    cl_weapons.qc
    //g_tetris.qc
    cl_impulse.qc

    ent_cs.qc

    cl_player.qc
    cl_client.qc
    t_plats.qc
    antilag.qc

    ctf.qc
    domination.qc
    mode_onslaught.qc
    g_hook.qc

    t_swamp.qc

    clientcommands.qc

    vote.qc

    campaign.qc
    ../common/campaign_file.qc
    ../common/campaign_setup.qc

    ../common/gamecommand.qc
    gamecommand.qc

    keyhunt.qc

    assault.qc

    ipban.qc

    ../common/mapinfo.qc




    t_quake3.qc
    t_halflife.qc
    t_quake.qc

    race.qc


    //// tZork Turrets ////
    tturrets/include/turrets.qh

    scores.qc

    portals.qc

    target_spawn.qc
    func_breakable.qc

    ../common/items.qc

    monsters/defs.qc
    monsters/fight.qc
    monsters/ai.qc
    monsters/m_monsters.qc

    csqcprojectile.qc


    Tetris.qc:
    Code: Select all
    .vector tet_org;
    .float tetris_on;
    .float tet_time;
    .float tet_autodown;
    .float tet_old_keys;
    .vector piece_pos;
    .float piece_type;
    .float next_piece;
    .float tet_score;
    .float tet_lines;
    float tet_high_score;
    float TET_LINES    = 20;
    float TET_WIDTH    = 10;
    float TET_BORDER    = 132;
    float TET_BLOCKS    = 132;
    float TET_SPACE    = 32;
    float TETKEY_UP    = 1;
    float TETKEY_DOWN    = 2;
    float TETKEY_LEFT    = 4;
    float TETKEY_RIGHT    = 8;
    float TETKEY_ROTLEFT    = 16;
    float TETKEY_ROTRIGHT    = 32;
    float KEYS_IMMEDIATE    = 60;
    float PIECES    = 7;
    .float line1;
    .float line2;
    .float line3;
    .float line4;
    .float line5;
    .float line6;
    .float line7;
    .float line8;
    .float line9;
    .float line10;
    .float line11;
    .float line12;
    .float line13;
    .float line14;
    .float line15;
    .float line16;
    .float line17;
    .float line18;
    .float line19;
    .float line20;
    float SVC_CENTERPRINT    = 26;

    void (string snd) tetsnd =
    {
       stuffcmd (self, "play ");
       stuffcmd (self, snd);
       stuffcmd (self, "\n");
    };

    float () Tetris_Level =
    {
       return ((floor ((self.tet_lines / TET_LINES)) + TETKEY_UP));
    };

    void (float ln, float vl) SetLine =
    {
       if ((ln == TETKEY_UP))
       {
          self.line1 = vl;
       }
       else
       {
          if ((ln == TETKEY_DOWN))
          {
             self.line2 = vl;
          }
          else
          {
             if ((ln == AS_MELEE))
             {
                self.line3 = vl;
             }
             else
             {
                if ((ln == TETKEY_LEFT))
                {
                   self.line4 = vl;
                }
                else
                {
                   if ((ln == TE_LIGHTNING1))
                   {
                      self.line5 = vl;
                   }
                   else
                   {
                      if ((ln == TE_LIGHTNING2))
                      {
                         self.line6 = vl;
                      }
                      else
                      {
                         if ((ln == PIECES))
                         {
                            self.line7 = vl;
                         }
                         else
                         {
                            if ((ln == TETKEY_RIGHT))
                            {
                               self.line8 = vl;
                            }
                            else
                            {
                               if ((ln == TE_LIGHTNING3))
                               {
                                  self.line9 = vl;
                               }
                               else
                               {
                                  if ((ln == TET_WIDTH))
                                  {
                                     self.line10 = vl;
                                  }
                                  else
                                  {
                                     if ((ln == TE_TELEPORT))
                                     {
                                        self.line11 = vl;
                                     }
                                     else
                                     {
                                        if ((ln == 12))
                                        {
                                           self.line12 = vl;
                                        }
                                        else
                                        {
                                           if ((ln == 13))
                                           {
                                              self.line13 = vl;
                                           }
                                           else
                                           {
                                              if ((ln == 14))
                                              {
                                                 self.line14 = vl;
                                              }
                                              else
                                              {
                                                 if ((ln == 15))
                                                 {
                                                    self.line15 = vl;
                                                 }
                                                 else
                                                 {
                                                    if ((ln == TETKEY_ROTLEFT))
                                                    {
                                                       self.line16 = vl;
                                                    }
                                                    else
                                                    {
                                                       if ((ln == 17))
                                                       {
                                                          self.line17 = vl;
                                                       }
                                                       else
                                                       {
                                                          if ((ln == 18))
                                                          {
                                                             self.line18 = vl;
                                                          }
                                                          else
                                                          {
                                                             if ((ln == 19))
                                                             {
                                                                self.line19 = vl;
                                                             }
                                                             else
                                                             {
                                                                if ((ln == TET_LINES))
                                                                {
                                                                   self.line20 = vl;
                                                                }
                                                             }
                                                          }
                                                       }
                                                    }
                                                 }
                                              }
                                           }
                                        }
                                     }
                                  }
                               }
                            }
                         }
                      }
                   }
                }
             }
          }
       }
    };

    float (float ln) GetLine =
    {
       if ((ln == TETKEY_UP))
       {
          return (self.line1);
       }
       else
       {
          if ((ln == TETKEY_DOWN))
          {
             return (self.line2);
          }
          else
          {
             if ((ln == AS_MELEE))
             {
                return (self.line3);
             }
             else
             {
                if ((ln == TETKEY_LEFT))
                {
                   return (self.line4);
                }
                else
                {
                   if ((ln == TE_LIGHTNING1))
                   {
                      return (self.line5);
                   }
                   else
                   {
                      if ((ln == TE_LIGHTNING2))
                      {
                         return (self.line6);
                      }
                      else
                      {
                         if ((ln == PIECES))
                         {
                            return (self.line7);
                         }
                         else
                         {
                            if ((ln == TETKEY_RIGHT))
                            {
                               return (self.line8);
                            }
                            else
                            {
                               if ((ln == TE_LIGHTNING3))
                               {
                                  return (self.line9);
                               }
                               else
                               {
                                  if ((ln == TET_WIDTH))
                                  {
                                     return (self.line10);
                                  }
                                  else
                                  {
                                     if ((ln == TE_TELEPORT))
                                     {
                                        return (self.line11);
                                     }
                                     else
                                     {
                                        if ((ln == 12))
                                        {
                                           return (self.line12);
                                        }
                                        else
                                        {
                                           if ((ln == 13))
                                           {
                                              return (self.line13);
                                           }
                                           else
                                           {
                                              if ((ln == 14))
                                              {
                                                 return (self.line14);
                                              }
                                              else
                                              {
                                                 if ((ln == 15))
                                                 {
                                                    return (self.line15);
                                                 }
                                                 else
                                                 {
                                                    if ((ln == TETKEY_ROTLEFT))
                                                    {
                                                       return (self.line16);
                                                    }
                                                    else
                                                    {
                                                       if ((ln == 17))
                                                       {
                                                          return (self.line17);
                                                       }
                                                       else
                                                       {
                                                          if ((ln == 18))
                                                          {
                                                             return (self.line18);
                                                          }
                                                          else
                                                          {
                                                             if ((ln == 19))
                                                             {
                                                                return (self.line19);
                                                             }
                                                             else
                                                             {
                                                                if ((ln == TET_LINES))
                                                                {
                                                                   return (self.line20);
                                                                }
                                                                else
                                                                {
                                                                   return (MSG_BROADCAST);
                                                                }
                                                             }
                                                          }
                                                       }
                                                    }
                                                 }
                                              }
                                           }
                                        }
                                     }
                                  }
                               }
                            }
                         }
                      }
                   }
                }
             }
          }
       }
    };

    float (float x, float dat) GetXBlock =
    {
       if ((x == TETKEY_UP))
       {
          return ((dat & AS_MELEE));
       }
       else
       {
          if ((x == TETKEY_DOWN))
          {
             return (((dat & 12) / TETKEY_LEFT));
          }
          else
          {
             if ((x == AS_MELEE))
             {
                return (((dat & 48) / TETKEY_ROTLEFT));
             }
             else
             {
                if ((x == TETKEY_LEFT))
                {
                   return (((dat & 192) / IT_LIGHTNING));
                }
                else
                {
                   if ((x == TE_LIGHTNING1))
                   {
                      return (((dat & 768) / IT_SHELLS));
                   }
                   else
                   {
                      if ((x == TE_LIGHTNING2))
                      {
                         return (((dat & 3072) / IT_ROCKETS));
                      }
                      else
                      {
                         if ((x == PIECES))
                         {
                            return (((dat & 12288) / IT_AXE));
                         }
                         else
                         {
                            if ((x == TETKEY_RIGHT))
                            {
                               return (((dat & 49152) / IT_ARMOR2));
                            }
                            else
                            {
                               if ((x == TE_LIGHTNING3))
                               {
                                  return (((dat & 196608) / IT_SUPERHEALTH));
                               }
                               else
                               {
                                  if ((x == TET_WIDTH))
                                  {
                                     return (((dat & 786432) / IT_KEY2));
                                  }
                                  else
                                  {
                                     return (MSG_BROADCAST);
                                  }
                               }
                            }
                         }
                      }
                   }
                }
             }
          }
       }
    };

    float (float x, float dat, float new) SetXBlock =
    {
       if ((x == TETKEY_UP))
       {
          return (((dat - (dat & AS_MELEE)) | new));
       }
       else
       {
          if ((x == TETKEY_DOWN))
          {
             return (((dat - (dat & 12)) | (new * TETKEY_LEFT)));
          }
          else
          {
             if ((x == AS_MELEE))
             {
                return (((dat - (dat & 48)) | (new * TETKEY_ROTLEFT)));
             }
             else
             {
                if ((x == TETKEY_LEFT))
                {
                   return (((dat - (dat & 192)) | (new * IT_LIGHTNING)));
                }
                else
                {
                   if ((x == TE_LIGHTNING1))
                   {
                      return (((dat - (dat & 768)) | (new * IT_SHELLS)));
                   }
                   else
                   {
                      if ((x == TE_LIGHTNING2))
                      {
                         return (((dat - (dat & 3072)) | (new * IT_ROCKETS)));
                      }
                      else
                      {
                         if ((x == PIECES))
                         {
                            return (((dat - (dat & 12288)) | (new * IT_AXE)));
                         }
                         else
                         {
                            if ((x == TETKEY_RIGHT))
                            {
                               return (((dat - (dat & 49152)) | (new * IT_ARMOR2)));
                            }
                            else
                            {
                               if ((x == TE_LIGHTNING3))
                               {
                                  return (((dat - (dat & 196608)) | (new * IT_SUPERHEALTH)));
                               }
                               else
                               {
                                  if ((x == TET_WIDTH))
                                  {
                                     return (((dat - (dat & 786432)) | (new * IT_KEY2)));
                                  }
                                  else
                                  {
                                     return (dat);
                                  }
                               }
                            }
                         }
                      }
                   }
                }
             }
          }
       }
    };

    vector (float x, float y) GetSquare =
    {
       return (GetXBlock (x, GetLine (y)));
    };

    void (float x, float y, float val) SetSquare =
    {
       local float dat;

       dat = GetLine (y);
       dat = SetXBlock (x, dat, (val & AS_MELEE));
       SetLine (y, dat);
    };

    vector (float pc) PieceShape =
    {
       if ((pc == TETKEY_UP))
       {
          return ('5 5 2');
       }
       else
       {
          if ((pc == TETKEY_DOWN))
          {
             return ('85 0 4');
          }
          else
          {
             if ((pc == AS_MELEE))
             {
                return ('21 1 3');
             }
             else
             {
                if ((pc == TETKEY_LEFT))
                {
                   return ('1 21 3');
                }
                else
                {
                   if ((pc == TE_LIGHTNING1))
                   {
                      return ('5 20 3');
                   }
                   else
                   {
                      if ((pc == TE_LIGHTNING2))
                      {
                         return ('20 5 3');
                      }
                      else
                      {
                         if ((pc == PIECES))
                         {
                            return ('4 21 3');
                         }
                         else
                         {
                            return (VEC_ORIGIN);
                         }
                      }
                   }
                }
             }
          }
       }
    };

    float (float x, float y, float rot, float pc) PieceMetric =
    {
       local float t;
       local vector piece_dat;
       local float wid;

       piece_dat = PieceShape (pc);
       wid = (piece_dat_z + TETKEY_UP);
       if ((rot == TETKEY_UP))
       {
          t = y;
          y = x;
          x = (wid - t);
       }
       else
       {
          if ((rot == TETKEY_DOWN))
          {
             x = (wid - x);
             y = (AS_MELEE - y);
          }
          else
          {
             if ((rot == AS_MELEE))
             {
                t = y;
                y = (wid - x);
                x = t;
             }
          }
       }
       if (((((x < TETKEY_UP) || (y < TETKEY_UP)) || (x > TETKEY_LEFT)) || (y > TETKEY_LEFT)))
       {
          return (MSG_BROADCAST);
       }
       if ((y == TETKEY_UP))
       {
          return (GetXBlock (x, piece_dat));
       }
       else
       {
          if ((y == TETKEY_DOWN))
          {
             return (GetXBlock (x, piece_dat_y));
          }
          else
          {
             return (MSG_BROADCAST);
          }
       }
    };

    void (float c1, float c2, float c3, float c4, float c5, float c6) p6 =
    {
       WriteChar (MSG_ONE, c1);
       WriteChar (MSG_ONE, c2);
       WriteChar (MSG_ONE, c3);
       WriteChar (MSG_ONE, c4);
       WriteChar (MSG_ONE, c5);
       WriteChar (MSG_ONE, c6);
    };

    float (float num, float dig) pnum =
    {
       local float f;
       local float i;

       if ((num < MSG_BROADCAST))
       {
          WriteChar (MSG_ONE, 45);
          num = (MSG_BROADCAST - num);
       }
       f = floor ((num / TET_WIDTH));
       num = (num - (f * TET_WIDTH));
       if (f)
       {
          dig = pnum (f, (dig + TETKEY_UP));
       }
       else
       {
          i = MSG_BROADCAST;
          while ((i < (TE_LIGHTNING1 - dig)))
          {
             WriteChar (MSG_ONE, TET_SPACE);
             i = (i + TETKEY_UP);
          }
       }
       WriteChar (MSG_ONE, (48 + num));
       return (dig);
    };

    void (float ln) DrawLine =
    {
       local float x;
       local float d;

       WriteChar (MSG_ONE, TET_BORDER);
       x = TETKEY_UP;
       while ((x <= TET_WIDTH))
       {
          d = GetSquare (x, ln);
          if (d)
          {
             WriteChar (MSG_ONE, (TET_BLOCKS + d));
          }
          else
          {
             WriteChar (MSG_ONE, TET_SPACE);
          }
          x = (x + TETKEY_UP);
       }
       WriteChar (MSG_ONE, TET_BORDER);
    };

    void (float pc, float ln) DrawPiece =
    {
       local float x;
       local float d;
       local float piece_ln;
       local float color;
       local vector piece_dat;

       color = (pc & AS_MELEE);
       if ((color == MSG_BROADCAST))
       {
          color = TETKEY_UP;
       }
       WriteChar (MSG_ONE, TET_SPACE);
       piece_dat = PieceShape (pc);
       if ((ln == TETKEY_UP))
       {
          piece_ln = piece_dat_x;
       }
       else
       {
          piece_ln = piece_dat_y;
       }
       x = TETKEY_UP;
       while ((x <= TETKEY_LEFT))
       {
          d = (GetXBlock (x, piece_ln) * color);
          if (d)
          {
             WriteChar (MSG_ONE, (TET_BLOCKS + d));
          }
          else
          {
             WriteChar (MSG_ONE, TET_SPACE);
          }
          x = (x + TETKEY_UP);
       }
       WriteChar (MSG_ONE, TET_SPACE);
    };

    void () Draw_Tetris =
    {
       local float i;

       msg_entity = self;
       WriteChar (MSG_ONE, SVC_CENTERPRINT);
       i = TETKEY_UP;
       while ((i <= (TET_WIDTH + TETKEY_DOWN)))
       {
          WriteChar (MSG_ONE, TET_BORDER);
          i = (i + TETKEY_UP);
       }
       p6 (TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT);
       WriteChar (MSG_ONE, TET_WIDTH);
       i = TETKEY_UP;
       while ((i <= TET_LINES))
       {
          if (((self.tetris_on == TETKEY_DOWN) && (i == TE_TELEPORT)))
          {
             p6 (TET_BORDER, 71, 65, 77, 69, TETKEY_ROTRIGHT);
             p6 (79, 86, 69, 82, TETKEY_ROTRIGHT, TET_BORDER);
          }
          else
          {
             DrawLine (i);
          }
          if ((i == TETKEY_UP))
          {
             p6 (TETKEY_ROTRIGHT, 78, 69, 88, 84, TETKEY_ROTRIGHT);
          }
          else
          {
             if ((i == AS_MELEE))
             {
                DrawPiece (self.next_piece, TETKEY_UP);
             }
             else
             {
                if ((i == TETKEY_LEFT))
                {
                   DrawPiece (self.next_piece, TETKEY_DOWN);
                }
                else
                {
                   if ((i == TE_LIGHTNING2))
                   {
                      p6 (TETKEY_ROTRIGHT, 76, 73, 78, 69, 83);
                   }
                   else
                   {
                      if ((i == PIECES))
                      {
                         pnum (self.tet_lines, MSG_BROADCAST);
                      }
                      else
                      {
                         if ((i == TE_LIGHTNING3))
                         {
                            p6 (TETKEY_ROTRIGHT, 83, 67, 79, 82, 69);
                         }
                         else
                         {
                            if ((i == TET_WIDTH))
                            {
                               pnum (self.tet_score, MSG_BROADCAST);
                            }
                            else
                            {
                               if ((i == 12))
                               {
                                  p6 (TETKEY_ROTRIGHT, 72, 73, 71, 72, TETKEY_ROTRIGHT);
                               }
                               else
                               {
                                  if ((i == 13))
                                  {
                                     p6 (TETKEY_ROTRIGHT, 83, 67, 79, 82, 69);
                                  }
                                  else
                                  {
                                     if ((i == 14))
                                     {
                                        pnum (tet_high_score, MSG_BROADCAST);
                                     }
                                     else
                                     {
                                        if ((i == TETKEY_ROTLEFT))
                                        {
                                           p6 (TETKEY_ROTRIGHT, 76, 69, 86, 69, 76);
                                        }
                                        else
                                        {
                                           if ((i == 17))
                                           {
                                              pnum (Tetris_Level (), MSG_BROADCAST);
                                           }
                                           else
                                           {
                                              p6 (TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT);
                                           }
                                        }
                                     }
                                  }
                               }
                            }
                         }
                      }
                   }
                }
             }
          }
          WriteChar (MSG_ONE, TET_WIDTH);
          i = (i + TETKEY_UP);
       }
       i = TETKEY_UP;
       while ((i <= (TET_WIDTH + TETKEY_DOWN)))
       {
          WriteChar (MSG_ONE, TET_BORDER);
          i = (i + TETKEY_UP);
       }
       p6 (TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT, TETKEY_ROTRIGHT);
       WriteChar (MSG_ONE, TET_WIDTH);
       WriteChar (MSG_ONE, MSG_BROADCAST);
    };

    void () ResetTetris =
    {
       local float i;

       i = TETKEY_UP;
       while ((i <= TET_LINES))
       {
          SetLine (i, MSG_BROADCAST);
          i = (i + TETKEY_UP);
       }
       self.piece_pos = VEC_ORIGIN;
       self.piece_type = MSG_BROADCAST;
       self.tet_score = MSG_BROADCAST;
       self.tet_lines = MSG_BROADCAST;
       self.next_piece = MSG_BROADCAST;
    };

    void () Tet_GameExit =
    {
       centerprint (self, " ");
       self.tetris_on = MSG_BROADCAST;
       ResetTetris ();
       self.movetype = MOVETYPE_WALK;
    };

    float () RandomPiece =
    {
       return ((floor ((random () * PIECES)) + TETKEY_UP));
    };

    void (float n) TetAddScore =
    {
       self.tet_score = (self.tet_score + (n * Tetris_Level ()));
       if ((self.tet_score > tet_high_score))
       {
          tet_high_score = self.tet_score;
       }
    };

    float (float piece, float orgx, float orgy, float rot) CheckMetrics =
    {
       local float x;
       local float y;

       orgx = (orgx - TETKEY_UP);
       orgy = (orgy - TETKEY_UP);
       y = TETKEY_UP;
       while ((y < TE_LIGHTNING1))
       {
          x = TETKEY_UP;
          while ((x < TE_LIGHTNING1))
          {
             if (PieceMetric (x, y, rot, piece))
             {
                if (GetSquare ((x + orgx), (y + orgy)))
                {
                   return (FALSE);
                }
                if ((((((x + orgx) < TETKEY_UP) || ((x + orgx) > TET_WIDTH)) || ((y + orgy) < TETKEY_UP)) || ((y + orgy) > TET_LINES)))
                {
                   return (FALSE);
                }
             }
             x = (x + TETKEY_UP);
          }
          y = (y + TETKEY_UP);
       }
       return (TRUE);
    };

    void (float piece, float orgx, float orgy, float rot) ClearPiece =
    {
       local float x;
       local float y;

       orgx = (orgx - TETKEY_UP);
       orgy = (orgy - TETKEY_UP);
       y = TETKEY_UP;
       while ((y < TE_LIGHTNING1))
       {
          x = TETKEY_UP;
          while ((x < TE_LIGHTNING1))
          {
             if (PieceMetric (x, y, rot, piece))
             {
                SetSquare ((x + orgx), (y + orgy), MSG_BROADCAST);
             }
             x = (x + TETKEY_UP);
          }
          y = (y + TETKEY_UP);
       }
    };

    void (float piece, float orgx, float orgy, float rot) CementPiece =
    {
       local float color;
       local float x;
       local float y;

       orgx = (orgx - TETKEY_UP);
       orgy = (orgy - TETKEY_UP);
       color = (piece & AS_MELEE);
       if ((color == MSG_BROADCAST))
       {
          color = TETKEY_UP;
       }
       y = TETKEY_UP;
       while ((y < TE_LIGHTNING1))
       {
          x = TETKEY_UP;
          while ((x < TE_LIGHTNING1))
          {
             if (PieceMetric (x, y, rot, piece))
             {
                SetSquare ((x + orgx), (y + orgy), color);
             }
             x = (x + TETKEY_UP);
          }
          y = (y + TETKEY_UP);
       }
    };
    float LINE_LOW    = 349525;
    float LINE_HIGH    = 699050;

    void () CompletedLines =
    {
       local float y;
       local float cleared;
       local float ln;

       cleared = MSG_BROADCAST;
       y = TET_LINES;
       while ((y >= TETKEY_UP))
       {
          ln = GetLine (y);
          if ((((ln & LINE_LOW) | ((ln & LINE_HIGH) / TETKEY_DOWN)) == LINE_LOW))
          {
             cleared = (cleared + TETKEY_UP);
          }
          else
          {
             y = (y - TETKEY_UP);
          }
          ln = GetLine ((y - cleared));
          SetLine (y, ln);
       }
       if ((cleared == TETKEY_LEFT))
       {
          tetsnd ("tetris");
       }
       else
       {
          if (cleared)
          {
             tetsnd ("tetline");
          }
          else
          {
             tetsnd ("tetland");
          }
       }
       self.tet_lines = (self.tet_lines + cleared);
       TetAddScore (((cleared * cleared) * TET_WIDTH));
    };

    void (float keys) HandleGame =
    {
       local vector check_pos;
       local vector piece_data;
       local float brand_new;
       local float nudge;
       local float i;

       brand_new = MSG_BROADCAST;
       nudge = MSG_BROADCAST;
       if (((self.tet_time > time) && !(keys & KEYS_IMMEDIATE)))
       {
          return;
       }
       self.tet_time = (time + 0.1);
       if ((self.piece_type == MSG_BROADCAST))
       {
          self.piece_pos = '5 1 0';
          if (self.next_piece)
          {
             self.piece_type = self.next_piece;
          }
          else
          {
             self.piece_type = RandomPiece ();
          }
          self.next_piece = RandomPiece ();
          keys = MSG_BROADCAST;
          self.tet_autodown = (time + TETKEY_UP);
          brand_new = TETKEY_UP;
       }
       else
       {
          ClearPiece (self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z);
       }
       check_pos = self.piece_pos;
       if ((keys & TETKEY_RIGHT))
       {
          check_pos_x = (check_pos_x + TETKEY_UP);
          tetsnd ("tetmove");
       }
       else
       {
          if ((keys & TETKEY_LEFT))
          {
             check_pos_x = (check_pos_x - TETKEY_UP);
             tetsnd ("tetmove");
          }
          else
          {
             if ((keys & TETKEY_ROTRIGHT))
             {
                check_pos_z = (check_pos_z + TETKEY_UP);
                piece_data = PieceShape (self.piece_type);
                nudge = (piece_data_z - TETKEY_DOWN);
                tetsnd ("tetrot");
             }
             else
             {
                if ((keys & TETKEY_ROTLEFT))
                {
                   check_pos_z = (check_pos_z - TETKEY_UP);
                   piece_data = PieceShape (self.piece_type);
                   nudge = (piece_data_z - TETKEY_DOWN);
                   tetsnd ("tetrot");
                }
             }
          }
       }
       if ((check_pos_z > AS_MELEE))
       {
          check_pos_z = MSG_BROADCAST;
       }
       else
       {
          if ((check_pos_z < MSG_BROADCAST))
          {
             check_pos_z = AS_MELEE;
          }
       }
       if (CheckMetrics (self.piece_type, check_pos, check_pos_y, check_pos_z))
       {
          self.piece_pos = check_pos;
       }
       else
       {
          if (brand_new)
          {
             self.tetris_on = TETKEY_DOWN;
             return;
          }
          else
          {
             if (nudge)
             {
                i = nudge;
                while ((i >= (MSG_BROADCAST - nudge)))
                {
                   if (CheckMetrics (self.piece_type, (check_pos_x + i), check_pos_y, check_pos_z))
                   {
                      self.piece_pos = (check_pos + ('1 0 0' * i));
                   }
                   else
                   {
                      i = (i - TETKEY_UP);
                   }
                }
             }
          }
       }
       check_pos = self.piece_pos;
       if ((keys & TETKEY_DOWN))
       {
          check_pos_y = (check_pos_y + TETKEY_UP);
       }
       else
       {
          if ((self.tet_autodown < time))
          {
             check_pos_y = (check_pos_y + TETKEY_UP);
             self.tet_autodown = (time + (TETKEY_UP / Tetris_Level ()));
          }
       }
       if (CheckMetrics (self.piece_type, check_pos, check_pos_y, check_pos_z))
       {
          self.piece_pos = check_pos;
       }
       else
       {
          CementPiece (self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z);
          TetAddScore (TETKEY_UP);
          CompletedLines ();
          self.piece_type = MSG_BROADCAST;
          return;
       }
       CementPiece (self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z);
    };

    void () TetrisImpulses =
    {
       if ((self.impulse == 100))
       {
          self.tetris_on = TETKEY_UP;
          ResetTetris ();
          self.tet_org = self.origin;
          self.movetype = MOVETYPE_NOCLIP;
          stuffcmd (self, "cl_bob 0\ncl_rollangle 0\n");
          tetsnd ("musicb");
       }
    };

    float () TetrisPreFrame =
    {
       if (!self.tetris_on)
       {
          return (MSG_BROADCAST);
       }
       self.tet_org = self.origin;
       if ((self.tet_time > time))
       {
          return (TETKEY_UP);
       }
       Draw_Tetris ();
       return (TETKEY_UP);
    };

    float (float v) frik_anglemod =
    {
       return ((v - (floor ((v / 360)) * 360)));
    };

    float (float y1, float y2) angcomp =
    {
       local float answer;

       y1 = frik_anglemod (y1);
       y2 = frik_anglemod (y2);
       answer = (y1 - y2);
       if ((answer > 180))
       {
          answer = (answer - 360);
       }
       else
       {
          if ((answer < -180))
          {
             answer = (answer + 360);
          }
       }
       return (answer);
    };

    float () TetrisPostFrame =
    {
       local vector mov;
       local float keys;
       local float norm;

       keys = MSG_BROADCAST;
       if (!self.tetris_on)
       {
          return (MSG_BROADCAST);
       }
       if ((self.origin != self.tet_org))
       {
          mov = vectoangles ((self.origin - self.tet_org));
          self.origin = self.tet_org;
          norm = angcomp (self.v_angle_y, mov_y);
          if (((norm > -80) && (norm < 80)))
          {
             keys = (keys | TETKEY_UP);
          }
          if (((norm > TET_WIDTH) && (norm < 170)))
          {
             keys = (keys | TETKEY_RIGHT);
          }
          if (((norm > 100) || (norm < -100)))
          {
             keys = (keys | TETKEY_DOWN);
          }
          if (((norm > -170) && (norm < -10)))
          {
             keys = (keys | TETKEY_LEFT);
          }
       }
       if (self.button0)
       {
          keys = (keys | TETKEY_ROTRIGHT);
       }
       if (self.button2)
       {
          keys = (keys | TETKEY_ROTLEFT);
       }
       if ((self.impulse == 100))
       {
          Tet_GameExit ();
          self.impulse = MSG_BROADCAST;
          return (MSG_BROADCAST);
       }
       if ((self.tetris_on == TETKEY_UP))
       {
          HandleGame ((keys - ((keys & self.tet_old_keys) & KEYS_IMMEDIATE)));
       }
       else
       {
          if (((keys & TETKEY_ROTRIGHT) && !self.tet_old_keys))
          {
             ResetTetris ();
             self.tetris_on = TETKEY_UP;
          }
       }
       self.tet_old_keys = keys;
       return (TETKEY_UP);
    };
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Fri Aug 07, 2009 8:17 pm

  • Mizu Kitsune wrote:Progs.src:
    Code: Select all
    loads..

    *plops up*
    Hi! So I heard you where looking for a place to paste your code? You want help with that?
    Here yo go! (don't forget to tick the keep forever and ever thingy)
    [Want to develop? Look HERE]. Image Image Gif sauce.
    paperclips
    Alien trapper
     
    Posts: 346
    Joined: Mon Jan 12, 2009 10:27 am
    Location: internets

Sat Aug 08, 2009 4:32 pm

  • AS_MELEE is not defined. How did you make this g_tetris.qc? It is not derived from the old one.

    - self.tetris_on = 1;
    + self.tetris_on = TETKEY_UP;

    Changes like this crack me up. Why did you change this constant to the name of the UP key?

    - if (self.piece_type == 0)
    + if ((self.piece_type == MSG_BROADCAST))

    Either this is intentional obfuscation, or you have used a decompiler for this (meaning possibly a copyright violation). In both cases, it's not going to get into svn.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sat Aug 08, 2009 5:22 pm

  • in coding there is too ways of coding, the pretty way, which is easier to read at the cost of cpu, and the better way, which is harder to read but less cpu. your g_tetris was the pretty way and mine is the better way. i made my changes after never getting g_tetris to work, with harder to read code that did work.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Sat Aug 08, 2009 5:46 pm

Sat Aug 08, 2009 5:58 pm

  • How do you explain the use of constant names that are defined in Quake 1 but not in Nexuiz, like IT_AXE?

    How do you explain this declaration:

    float (float piece, float orgx, float orgy, float rot) CheckMetrics =

    this declaration:

    local vector check_pos;

    and then this function call?

    if (CheckMetrics (self.piece_type, check_pos, check_pos_y, check_pos_z))

    Yay, you're passing a vector into a float parameter. THIS DOES NOT EVEN COMPILE. So, your "source code" is a lie.

    Now go read the GPL. There's a section that basically reads "if you release binary, you must also release source of that very binary on request".

    You released your compiled progs.dat. I hereby demand by the GPL the EXACT and FULL source you used for compiling. It must, when running fteqcc on it, yield EXACTLY THE SAME progs.dat as you put in your zip. If not, Alientrap, as well as FrikaC (the author of this Tetris code), as well as Id Software (now owned by ZeniMax Media) may sue you for copyright violation. Given the number of people and companies who MIGHT sue you, you really should provide full and complete source code NOW, as there is no guarantee that you WILL not be sued.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sat Aug 08, 2009 7:09 pm

  • Also, look how all functions are named the same, and do almost the same, but look different.

    What you posted here is clearly DECOMPILED code from the same source. I'll ask FrikaC about this.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sat Aug 08, 2009 7:36 pm

  • it's a shame his mods were never finished. I found a directory lastnight that had some unfinished addons for his unfinished mods. sadly i still play Q1 and 2, buts its also sad that the computer i surf the net and do everything but play games on is win95/unix and uses serialport mouse and din5 keyboard.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Sat Aug 08, 2009 8:30 pm

Sat Aug 08, 2009 8:44 pm

  • lol 6 years of programming will do that to ya.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Sat Aug 08, 2009 8:47 pm

  • I think the QC decompiler was written in less than 6 years.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sat Aug 08, 2009 9:28 pm

  • most likely. you can decompile progs.dat by hand with edit.com or cmd.exe > edit
    thats how i edit and make my files, and my internet is through a telnet prompt.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Sun Aug 09, 2009 1:04 am

  • Mizu Kitsune wrote:lol 6 years of programming will do that to ya.


    hahahah

    six years of programming could had taught you some else if awesomeness :D
    User avatar
    mand1nga
    Alien trapper
     
    Posts: 321
    Joined: Mon May 12, 2008 12:19 am

Sun Aug 09, 2009 10:42 am

  • But "else if" is so slow. Code is faster with

    Code: Select all
    if(...)
    {
      // ...
    }
    else
    {
      if(...)
      {
        ...
      }
    }


    I mean, don't you see it generates entirely different machine code from the following lame ass-code?

    Code: Select all
    if(...)
    {
      // ...
    }
    else if(...)
    {
      ...
    }
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Sun Aug 09, 2009 8:00 pm

Mon Aug 10, 2009 7:39 am

  • yes
    User avatar
    Mr. Bougo
    Keyboard killer
     
    Posts: 760
    Joined: Mon Sep 10, 2007 3:29 pm

Mon Aug 10, 2009 9:49 am

  • no))
    User avatar
    FruitieX
    Keyboard killer
     
    Posts: 588
    Joined: Mon Nov 13, 2006 4:47 pm
    Location: Finland

Next


Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest