示例#1
0
文件: Form1.cs 项目: 2Tie/Elfs2World
        void showMapDeets()
        {
            selx = -1;
            sely = -1;

            dState = DEETS.MAP;
            byte dummy = maps[curMap].header.conByte;

            for (int i = 0; i < maps[curMap].header.connections.Count(); i++)
            {
                if ((dummy & 0x08) == 0x08)
                {
                    detailsLabel.Text += "North connection: \n";
                    dummy              = (byte)(dummy - 8);
                }
                else if ((dummy & 0x04) == 0x04)
                {
                    detailsLabel.Text += "South connection: \n";
                    dummy              = (byte)(dummy - 4);
                }
                else if ((dummy & 0x02) == 0x02)
                {
                    detailsLabel.Text += "West connection: \n";
                    dummy              = (byte)(dummy - 2);
                }
                else if ((dummy & 0x01) == 0x01)
                {
                    detailsLabel.Text += "East connection: \n";
                    dummy              = (byte)(dummy - 1);
                }
                detailsLabel.Text += "Group: " + maps[curMap].header.connections[i].connGroup.ToString() + " Map: " + maps[curMap].header.connections[i].connID.ToString() + "\n";
            }
            //list the pointers?

            detailsLabel.Text += "\nWidth: " + maps[curMap].header.width.ToString() + "\nHeight: " + maps[curMap].header.height.ToString();

            detailsLabel.Text += "\nHas scripts? " + maps[curMap].hasScripts.ToString();

            detailsLabel.Text += "\nNumber of signs: " + maps[curMap].objData.signNum.ToString();

            detailsLabel.Text += "\nNumber of NPCs: " + maps[curMap].objData.NPCnum.ToString();

            detailsLabel.Text += "\nMap Type?: " + maps[curMap].header.maptype.ToString();
        }
示例#2
0
文件: Form1.cs 项目: 2Tie/Elfs2World
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (!loaded)
            {
                return;
            }

            //translate click into tile coords
            selx = (int)Math.Floor((float)e.X / 16);
            sely = (int)Math.Floor((float)e.Y / 16);
            detailsLabel.Text = "";

            if (viewTiles)
            {
                //check the tile clicked on
                detailsLabel.Text = selx.ToString() + " " + sely.ToString();
                if (sely > 3 && selx < 20)
                {
                    int sx = selx;
                    int sy = sely - 4;
                    int bx = sx / 2; //tx = selx % 2
                    int by = sy / 2; //ty = sely % 2?
                    detailsLabel.Text += "\n" + bx.ToString() + " " + by.ToString();
                    detailsLabel.Text += "\nColl ID: " + tilesets[curTiles].header.collision[(by * 10 + bx) * 4 + (sely % 2) * 2 + selx % 2].ToString();
                }
            }
            else
            {
                bool selected = false;

                //find if any NPCs were clicked on
                for (int i = 0; i < maps[curMap].objData.NPCnum; i++)
                {
                    if (selx + 4 == maps[curMap].objData.NPCs[i].xpos && sely + 4 == maps[curMap].objData.NPCs[i].ypos)
                    {
                        //clicked on an NPC
                        selected = true;

                        /*if (maps[curMap].objData.NPCs[i].trainer)
                         * {
                         *  if (maps[curMap].objData.NPCs[i].NPCID > 200)//trainer
                         *  {
                         *      getTeam(maps[curMap].objData.NPCs[i].NPCID, maps[curMap].objData.NPCs[i].levelroster);
                         *      detailsLabel.Text = trainerNames[maps[curMap].objData.NPCs[i].NPCID - 201] + "\nClass Roster #" + maps[curMap].objData.NPCs[i].levelroster.ToString() + "\n";
                         *      for (int j = 0; j < curTeam.levels.Count(); j++)
                         *          detailsLabel.Text += "LV: " + curTeam.levels[j].ToString() + " " + pokeNames[curTeam.species[j] - 1] + "\n";
                         *  }
                         *  else //pokemon
                         *  {
                         *      detailsLabel.Text = pokeNames[maps[curMap].objData.NPCs[i].NPCID - 1] + " LV: " + maps[curMap].objData.NPCs[i].levelroster.ToString();
                         *  }
                         * }
                         * else //generic npc*/
                        {
                            detailsLabel.Text  = maps[curMap].objData.NPCs[i].mov1.ToString();
                            detailsLabel.Text += "\n" + maps[curMap].objData.NPCs[i].u2.ToString();
                            //detailsLabel.Text += "\nBank: " + maps[curMap].header.hBank.ToString();
                            detailsLabel.Text += "\nAbsolute pointer to NPC:\n" + ((maps[curMap].header.hBank - 1) * 0x4000 + maps[curMap].header.pMapObject + maps[curMap].objData.warpNum * 7 + maps[curMap].objData.signNum * 4 + i * 13 + 5).ToString();
                        }
                        break;
                    }
                }
                if (!selected)
                {
                    for (int i = 0; i < maps[curMap].objData.signNum; i++)
                    {
                        if (selx == maps[curMap].objData.signs[i].xpos && sely == maps[curMap].objData.signs[i].ypos)
                        {
                            //clicked on a sign
                            selected          = true;
                            detailsLabel.Text = "Text ID: " + maps[curMap].objData.signs[i].textID.ToString();
                            break;
                        }
                    }
                }
                if (!selected)
                {
                    for (int i = 0; i < maps[curMap].objData.warpNum; i++)
                    {
                        if (selx == maps[curMap].objData.warps[i].xpos && sely == maps[curMap].objData.warps[i].ypos)
                        {
                            //clicked on a warp
                            selected = true;
                            dState   = DEETS.WARP;
                            if (e.Button == MouseButtons.Left)//display
                            {
                                detailsLabel.Text = "Destination group: " + maps[curMap].objData.warps[i].destGroup.ToString() + "\nDestination map: " + maps[curMap].objData.warps[i].destMap.ToString() + "\nDestination ID: " + maps[curMap].objData.warps[i].destID.ToString();
                                if (maps[curMap].objData.warps[i].destID == 0xFF && prevMap != -1)
                                {
                                    detailsLabel.Text += " (" + prevMap.ToString() + ")";
                                }
                                break;
                            }
                            if (e.Button == MouseButtons.Right)//follow
                            {
                                int dm = groupStarts[maps[curMap].objData.warps[i].destGroup - 1] + maps[curMap].objData.warps[i].destMap - 1;
                                if (dm == 0xFF && prevMap != -1)
                                {
                                    dm = prevMap;
                                }
                                if (dm != 0xFF)
                                {
                                    if (maps[dm].header.pMapData != 0 && maps[dm].header.hBank != 1 && maps[dm].header.tsID < maxtiles)
                                    {
                                        //highlight where you came from
                                        selx = maps[dm].objData.warps[maps[curMap].objData.warps[i].destID - 1].xpos;
                                        sely = maps[dm].objData.warps[maps[curMap].objData.warps[i].destID - 1].ypos;
                                        detailsLabel.Text = "";
                                        //go there
                                        if (curMap < 37)
                                        {
                                            prevMap = curMap;
                                        }
                                        curMap = dm;
                                        resetPanel();
                                    }
                                }
                                break;
                            }
                        }
                    }
                }
                if (!selected)//clicked on nothing, show map data again
                {
                    showMapDeets();
                }

                redrawMap();
            }
        }
示例#3
0
文件: Form1.cs 项目: 2Tie/Elfs2World
 void resetPanel()
 {
     detailsLabel.Text = "";
     dState            = DEETS.NULL;
 }