Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

曹操传文件格式 #2

Open
lometsj opened this issue May 17, 2022 · 4 comments
Open

曹操传文件格式 #2

lometsj opened this issue May 17, 2022 · 4 comments

Comments

@lometsj
Copy link
Owner

lometsj commented May 17, 2022

MOD制作基本工具用途及其使用方法图文实例,入门教程
http://xycq.online/forum/viewthread.php?tid=140684&extra=page%3D1

1,CCZ中文件的作用及推荐工具
Ekd5.exe---主程序---新手就用用UE,ES之类的吧
DATA.e5---里面是各类数据-----用叶落修改器
IMSG.e5----一些固定的台词,部队说明,武将列传之类的--------用叶落修改器
Hexzmap.e5--地形文件-----地形编辑器
Face.e5----头像文件----RV
Item.e5------战场上宝物图片-----RV
Itemicon.dll-----对话框中宝物图片--ES
Hm××.e5-------战斗地图------RV导入导出,地形编辑器可以导入
Pmapobj.e5----R形象-----RV
Logo.e5------一些LOGO图,如开场啦,单挑背景啦------RV
Mmap.e5-----内场景,R地图------RV、内场景编辑器查看坐标
R_**.eex----R剧本(过场)---剧本编辑器
S_**.eex----S剧本(战斗)---剧本编辑器
Smlmap.e5---战斗小地图-----RV导入导出,地形编辑器导入时自动生产
Unit_atk.e5
Unit_mov.e5
Unit_spc.e5-----这里三个是形象文件------RV,战场形象指定器
Sv**d.e5s
Sv**e.e5s
Sv**s.e5s--------这三个是存档文件-------叶落修改器

@lometsj
Copy link
Owner Author

lometsj commented May 17, 2022

下载van太守的RPGviewer,导出曹操传里面的e5数据文件的所有图片
发现序号后面总是跟着-1,写个python脚本把-1全去掉
原bmp图片都是8位不带alpha透明通道的,计划转换为带透明通道的32位bmp

@lometsj
Copy link
Owner Author

lometsj commented May 18, 2022

用pillow和numpy修改曹操传原本的图片
image
gao'ding搞定

import os
from PIL import Image
import numpy as np

im = Image.open("./anim/Mcall00_1.bmp")
im = im.convert("RGBA")
img_arr = np.array(im)
shape = img_arr.shape

height = shape[0]
width = shape[1]
# print('h ' + str(height) + ' w ' + str(width))

for h in range(height):
    for w in range(width):
        (r,g,b,alpha) = img_arr[h,w]
        if (r,g,b,alpha) == (247,0,255,255):
            img_arr[h,w] = (247,0,255,0)
im2 = Image.fromarray(np.uint8(img_arr))
# im2.show()

im2.save("test","BMP")

@lometsj
Copy link
Owner Author

lometsj commented May 18, 2022

全部搞定

from hashlib import new
import os
from PIL import Image
import numpy as np

def bmp8bit_convert(src, dst):

    im = Image.open(src)
    im = im.convert("RGBA")
    img_arr = np.array(im)
    shape = img_arr.shape

    height = shape[0]
    width = shape[1]
    # print('h ' + str(height) + ' w ' + str(width))
![image](https://user-images.githubusercontent.com/7191056/169141101-b8fa2fb9-7dd5-4388-b22d-566827cd7488.png)

    for h in range(height):
        for w in range(width):
            (r,g,b,alpha) = img_arr[h,w]
            if (r,g,b,alpha) == (247,0,255,255):
                img_arr[h,w] = (247,0,255,0)
                # print("check once")
    im2 = Image.fromarray(np.uint8(img_arr))
    # im2.show()

    im2.save(dst,"BMP")



old_path = 'C:/Users/tsj/Documents/cczmod/old_img'

path = ''

dirlist = os.walk('../cczmod/old_img')
print(dirlist)
for root, dirs, files in dirlist:
    for file in files:
        old_img = os.path.join(root,file)
        new_path = os.path.join('.\\', 'new_img',os.path.split(root)[-1], file)
        if os.access(os.path.join('.\\', 'new_img',os.path.split(root)[-1]) ,os.F_OK) == False:
            os.mkdir(os.path.join('.\\', 'new_img',os.path.split(root)[-1]))
        print('old path:'+old_img)
        print('new path:'+new_path)
        bmp8bit_convert(old_img, new_path)
# bmp8bit_convert('./test.bmp','./check.bmp')


@lometsj
Copy link
Owner Author

lometsj commented May 18, 2022

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant