V-MapLoad.asm
资源名称:VeMU.rar [点击查看]
上传用户:santakups8
上传日期:2021-03-23
资源大小:544k
文件大小:8k
源码类别:
模拟服务器
开发平台:
Asm
- ;EasyCodeName=Module1,1
- ;-----------------------------------------------------------------------------------
- ; VeMU
- ; Its a package that allows the user to set his own server of the game
- ; "MuOnline", this is not an emulator since i am not "emulating"
- ; what the actual games does, i am "creating" a method for set a Server
- ; of this Game.
- ;
- ; Copyright (C) 2010 Felipe Ya馿z
- ;
- ; This program is free software: you can redistribute it and/or modify
- ; it under the terms of the GNU General Public License as published by
- ; the Free Software Foundation, either version 3 of the License, or
- ; (at your option) any later version.
- ;
- ; This program is distributed in the hope that it will be useful,
- ; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ; GNU General Public License for more details.
- ;
- ; You should have received a copy of the GNU General Public License
- ; along with this program. If not, see http://www.gnu.org/licenses/.
- ;-----------------------------------------------------------------------------------
- ;-----------------------------------------------------------------------------------
- ; -----------------
- ; Coded /
- ; By /
- ; -={FeN$x)=-
- ; / Felipe Y.
- ; /
- ; -----------------
- ; Programming Lang: ASM
- ; Country: Chile
- ; My respect for all those who lost their lifes
- ; In the earthquake of my country...
- ; Let god take their spirits home...
- ;-----------------------------------------------------------------------------------
- ;////////////////////////////////////////////////////////////////////////////////////
- ; VeMU Project
- ; Map Load !
- ;////////////////////////////////////////////////////////////////////////////////////
- .const
- .data?
- .Data
- ;////////////////////////////////////////////////
- ;Aligned strings to 26 bytes dont edit the ",0"
- ;////////////////////////////////////////////////
- MapNames DB "./Data/Maps/terrain1.att", 0, 0
- DB "./Data/Maps/terrain2.att", 0, 0
- DB "./Data/Maps/terrain3.att", 0, 0
- DB "./Data/Maps/terrain4.att", 0, 0
- DB "./Data/Maps/terrain5.att", 0, 0
- DB "./Data/Maps/terrain6.att", 0, 0
- DB "./Data/Maps/terrain7.att", 0, 0
- DB "./Data/Maps/terrain8.att", 0, 0
- DB "./Data/Maps/terrain9.att", 0, 0
- DB "./Data/Maps/terrain10.att", 0
- DB "./Data/Maps/terrain11.att", 0
- DB "./Data/Maps/terrain12.att", 0 ;Loaded 8 times (BC for normal levels)
- DB "./Data/Maps/terrain19.att", 0 ;Loaded 7 times i dont know what is
- DB "./Data/Maps/terrain25.att", 0
- DB "./Data/Maps/terrain31.att", 0
- DB "./Data/Maps/terrain32.att", 0
- DB "./Data/Maps/terrain33.att", 0
- DB "./Data/Maps/terrain34.att", 0
- DB "./Data/Maps/terrain35.att", 0
- DB "./Data/Maps/terrain36.att", 0
- DB "./Data/Maps/terrain37.att", 0
- DB "./Data/Maps/terrain38.att", 0
- DB "./Data/Maps/terrain39.att", 0
- DB "./Data/Maps/terrain40.att", 0
- DB "./Data/Maps/terrain41.att", 0
- DB "./Data/Maps/terrain42.att", 0
- DB "./Data/Maps/terrain43.att", 0
- DB "./Data/Maps/terrain46.att", 0 ;Load 8 times (BC floors for master level i think)
- DB "./Data/Maps/terrain52.att", 0 ;Elbeland
- DB "./Data/Maps/terrain57.att", 0
- .Code
- ;////////////////////////////////////////////////////////////
- ;Main procedure for loading maps that will make a loop
- ;between the maps list (MapNames space) and load them.
- ;Also the inputed maps like Terrain12, 19, etc
- ;Got RealoadTime variable depending how many floors
- ;they have.
- ;////////////////////////////////////////////////////////////
- V_CMap_LoadAll Proc
- Local MapCounter:DWord
- Local MapStringCounter:Dword
- Local Reloadtimes:DWord
- Local StringPos:Dword
- Mov MapCounter, 0
- Mov MapStringCounter, 0
- .Repeat
- lea ecx, MapNames
- mov eax, ALIGN_MAP_STRINGS ;Aligment bytes for MapStrings
- Mov Edx, MapStringCounter
- IMul Edx, Eax ;MapNumber * Aling String
- add edx, ecx
- mov StringPos, edx
- invoke szCmp, $CTA0("./Data/Maps/terrain12.att"), edx
- .if (eax != 0)
- Mov Reloadtimes, 8 ;Load 8 floors
- jmp ReadMap
- .endif
- mov edx, StringPos
- invoke szCmp, $CTA0("./Data/Maps/terrain19.att"), edx
- .if (eax != 0)
- Mov Reloadtimes, 7 ;Load 7 floors
- jmp ReadMap
- .endif
- mov edx, StringPos
- invoke szCmp, $CTA0("./Data/Maps/terrain25.att"), edx
- .if (eax != 0)
- Mov Reloadtimes, 6 ;Load 6 floors
- jmp ReadMap
- .endif
- mov edx, StringPos
- invoke szCmp, $CTA0("./Data/Maps/terrain46.att"), edx
- .if (eax != 0)
- Mov Reloadtimes, 8 ;Load 8 floors
- jmp ReadMap
- .endif
- mov edx, StringPos
- invoke szCmp, $CTA0("./Data/Maps/terrain57.att"), edx
- .if (eax != 0)
- Mov Reloadtimes, 3 ;Load 3 floors
- jmp ReadMap
- .else
- Mov Reloadtimes, 0
- .endif
- ReadMap:
- .Repeat
- mov edx, StringPos
- pObj MapCounter, SizeOf MapClass, pMapObjSpace
- mov ecx, eax
- Invoke V_CMap_LoadTerrain, edx ;Load the terrain
- mov edx, StringPos
- .if (eax == 1) && (Reloadtimes != 0)
- RGB 255, 64, 64
- mov edx, StringPos
- Invoke vprint, $CTA0("CMapLoad:] MAP {%s} Floor {%d} Sucessfully loaded"), Eax, 2, edx, Reloadtimes
- sub Reloadtimes, 1
- .elseif (eax == 1) && (Reloadtimes == 0)
- RGB 255, 64, 64
- mov edx, StringPos
- Invoke vprint, $CTA0("CMapLoad:] MAP {%s} Successfully loaded"), Eax, 1, edx
- .else
- .endif
- add MapCounter, 1
- .Until (Reloadtimes == 0)
- add MapStringCounter, 1
- .Until (MapCounter == MAPLIMIT)
- Ret
- V_CMap_LoadAll EndP
- ;////////////////////////////////////////////////////////////
- ;Procedure that will read into the inputed
- ;Terrain name and take the information into
- ;PATHDIMENSION struct.
- ;////////////////////////////////////////////////////////////
- V_CMap_LoadTerrain Proc szMapName:DWord
- Local MyStruct:DWord
- Local Header:DWord
- Local hHandle:HANDLE
- Mov MyStruct, Ecx
- Assume Ecx:Ptr MapClass
- Mov hHandle, fopen(szMapName)
- Mov Ecx, MyStruct
- Mov Eax, fread(hHandle, Addr [Ecx].gWidth, 1) ;EAX = Bytes readed but i dont care to check them
- Mov Ecx, MyStruct
- Mov Eax, fread(hHandle, addr [Ecx].gHeight, 1) ;EAX = Bytes readed but i dont care to check them
- Mov Ecx, MyStruct
- .If ([Ecx].gWidth > 255) || ([ecx].gHeight > 255) ;If Width or Height exceeded
- RGB 255, 64, 64
- Mov Edx, Eax
- Invoke vprint, $CTA0("CMapLoad:] MAP {%s} INVALID_WIDTH or INVALID_HEIGHT"), Edx, 1, szMapName
- xor eax, eax
- Jmp EndProcedure
- .EndIf
- .If ([Ecx].pMapAttr != 0)
- Invoke HeapFree, V_ProcessHeapHandle, HEAP_NO_SERIALIZE, addr [Ecx].pMapAttr
- .EndIf
- fastalloc MAPWIDTH * MAPHEIGHT, 1 ;allocate space for Map Attribute
- Mov Ecx, MyStruct
- Mov [Ecx].pMapAttr, Eax ;Save the pointer of allocated space
- Mov Eax, fread(hHandle, [Ecx].pMapAttr, 100h) ;EAX = Bytes readed but i dont care to check them
- fclose (hHandle)
- Mov Ecx, MyStruct
- ;-----------------------------------------------------
- ;Set path dimensions !
- ;-----------------------------------------------------
- Mov Eax, [Ecx].pPath ;pointer to PATHDIMENSION struct
- Assume Eax:Ptr PATHDIMENSION
- Mov [Eax].vWidth, MAPWIDTH ;Set the max cords
- Mov [Eax].vHeight, MAPHEIGHT ;Set the max cords
- Push Eax ; save eax
- fastalloc MAPWIDTH * MAPHEIGHT, 1 ;allocate space for HitMap buffer
- Mov Edx, Eax
- Pop Eax ; return eax
- Mov [Eax].pHitMap, Edx ;Save the pointer to allocated data
- EndProcedure:
- mov eax, 1
- Assume Eax:Nothing
- Assume Ecx:Nothing
- Ret
- V_CMap_LoadTerrain EndP