:改変詳細/カスタム関係ファイルの再読込軽量化

Last-modified: 2013-01-13 (日) 02:19:37

変更履歴

2012/12/31T(人柱)版の変更内容

・カスタムNPC、カスタムアイテム、カスタムゴッドの読み込み処理を見直してショウルームのロードなどによるメモリの再配置が起こりづらくなるように
  ・カスタム系ファイルを大量に導入していて2012/12/24Tの変更で重くなってた場合は多分これで改善されるはず

変更箇所

  • 予め各カスタムファイルの最大数+αの要素を確保して必要量がその数を超えた時だけ再配置する

カスタムNPC読み込み処理の変更(160361行目付近)

	proclist(procid) = "userNpc_update" + " ct:" + ct
	getuserfiledata "npc", usernpcmax
	if ( usernpcmax >= 900 ) {
		usernpcmax = 900
	}
// MMA 20121230T START
/*
	dim userdata, 70, usernpcmax + 1
	dim userdata2, 10, usernpcmax + 1
	sdim userdatan, 40, 10, usernpcmax + 1
	sdim userdatan2, 40, 10, usernpcmax + 1
// MMA 20121222T START
//	sdim usertxt, 80 * 250, usernpcmax + 1
	sdim usertxt, 80 * 400, usernpcmax + 1
// MMA 20121222T END
	sdim userrace, 2000
	sdim userclass, 2000
	sdim untaglist
*/
	if ( ( usernpcmax + 1 ) > usernpcmaxbuffer ) {
		usernpcmaxbuffer = limitmax(usernpcmax + 1 + 40, 900 + 1)
		dim userdata, 70, usernpcmaxbuffer
		dim userdata2, 10, usernpcmaxbuffer
		sdim userdatan, 40, 10, usernpcmaxbuffer
		sdim userdatan2, 40, 10, usernpcmaxbuffer
		sdim usertxt, 80 * 400, usernpcmaxbuffer
	}
	else {
		memset userdata, 0, length(userdata) * ( usernpcmax + 1 ) * 4
		memset userdata2, 0, length(userdata2) * ( usernpcmax + 1 ) * 4
		repeat usernpcmax + 1
			usernpccnt = cnt
			repeat 10
				userdatan(cnt, usernpccnt) = ""
				userdatan2(cnt, usernpccnt) = ""
			loop
			usertxt(usernpccnt) = ""
		loop
	}
	if ( usernpcbuffer ) {
		sdim userrace, 2000
		sdim userclass, 2000
		sdim untaglist, 40 * 900
		usernpcbuffer = 1
	}
	else {
		userrace = ""
		userclass = ""
		untaglist = ""
	}
// MMA 20121230T END
	gdata(86) = 0
	buffer 5, 33 * 48, (25 + (usernpcmax / 33 + 1) * 2) * 48
	pos 0, 0
	picload exedir + "\\graphic\\character" + devfile + ".bmp", 1
	buffer 100, 16 * 80, (usernpcmax / 16 + 1) * 112
	gmode 0

カスタムアイテム読み込み処理の変更(252098行目付近)

	useritemmax = 0
	getuserfiledata "item", useritemmax
	if ( useritemmax > 900 ) {
		useritemmax = 900
	}
// MMA 20121230T START
/*
	dim useritemdata, 70, useritemmax + 1
	sdim useritemdatan, 40, 10, useritemmax + 1
	sdim useritemtxt, 80 * 50, 4, useritemmax + 1
	sdim untaglistitem
	dim useritemencprocref, 7, 10, useritemmax + 1
*/
	if ( ( useritemmax + 1 ) > useritemmaxbuffer ) {
		useritemmaxbuffer = limitmax(useritemmax + 1 + 40, 900 + 1)
		dim useritemdata, 70, useritemmaxbuffer
		sdim useritemdatan, 40, 10, useritemmaxbuffer
		sdim useritemtxt, 80 * 50, 4, useritemmaxbuffer
		dim useritemencprocref, 7, 10, useritemmaxbuffer
	}
	else {
		memset useritemdata, 0, length(useritemdata) * ( useritemmax + 1 ) * 4
		memset useritemencprocref, 0, length(useritemencprocref) * length2(useritemencprocref) * ( useritemmax + 1 ) * 4
		repeat useritemmax + 1
			useritemcnt = cnt
			repeat 10
				useritemdatan(cnt, useritemcnt) = ""
			loop
			repeat 4
				useritemtxt(cnt, useritemcnt) = ""
			loop
		loop
	}
	if ( useritembuffer ) {
		sdim untaglistitem, 40 * 900
		useritembuffer = 1
	}
	else {
		untaglistitem = ""
	}
// MMA 20121230T END
	ogdata(34) = 0
	buffer 30, 33 * 48, (useritemmax / 33 + 1) * 96
	boxf
	gmode 0

カスタムゴッド読み込み処理の変更

	usergodmax = 0
	getuserfiledata "god", usergodmax
	if ( usergodmax > 300 ) {
		usergodmax = 300
	}
// MMA 20121230T START
/*
	dim usergoddata, 60, usergodmax + 1
	sdim usergoddatan, 40, 40, usergodmax + 1
	sdim usergodtxt, 80 * 250, usergodmax + 1
	sdim untaglistgod
*/
	if ( ( usergodmax + 1 ) > usergodmaxbuffer ) {
		usergodmaxbuffer = limitmax(usergodmax + 1 + 10, 300 + 1)
		dim usergoddata, 60, usergodmaxbuffer
		sdim usergoddatan, 40, 40, usergodmaxbuffer
		sdim usergodtxt, 80 * 250, usergodmaxbuffer
	}
	else {
		memset usergoddata, 0, length(usergoddata) * ( usergodmax + 1 ) * 4
		repeat usergodmax + 1
			usergodcnt = cnt
			repeat 40
				usergoddatan(cnt, usergodmax) = ""
			loop
			usergodtxt(usergodmax) = ""
		loop
	}
	if ( usergodbuffer ) {
		sdim untaglistgod, 40 * 300
		usergodbuffer = 1
	}
	else {
		untaglistgod = ""
	}
// MMA 20121230T END
	ogdata(37) = 0
	fread = 1
	tg = 0
	repeat usergodmax