WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
88 stars 19 forks source link

Installing PVRZ-based MOS and BAM #31

Closed FredrikLindgren closed 9 years ago

FredrikLindgren commented 10 years ago

Feature requested here.

Argent77 commented 10 years ago

A possible INSTALL_MOS implementation in pseudo code: Link

FredrikLindgren commented 10 years ago

Thanks!

Argent77 commented 10 years ago

I didn't consider the possibility of overwriting existing MOS v2 files. The current pseudo code implementation overwrites the target MOS file only and allocates a new block of PVRZ indices. Theoretically, by repeatedly calling INSTALL_MOS with the same parameters, the game will be flooded with the same PVRZ files over and over.

I can only think of three possible solutions. Each one has (more or less) severe drawbacks however:

Argent77 commented 9 years ago

This is a working implementation of PVRZ-based BAM/MOS install routines: pvrz_funcs_v2.tph

It includes the necessary functions and a few examples how to use them properly. I have also uploaded two mods for testing purposes (Test mod 1 and Test mod 2).

I'm not familiar with your policy how to handle unexpected situations, so I have tried to handle them as unobtrusive as possible by using LOG or WARN rather than FAIL depending on the situation.

FredrikLindgren commented 9 years ago

I'll try to look this over and integrate this no later than next weekend. I will make some minor changes. Notably, public, documented symbols will be put into the UPPERCASE_NAME_SPACE_WITH_UNDERSCORES. There may have been one or two other things, but I forget (either way, I'll be keeping you informed).

For unexpected situations, I try to use FAIL when the problem is such that the mod cannot be successfully installed without problems arising during game play. WARN should inform the user there may be a problem. He or someone knowledgeable will have to decide if it is a problem (e.g., "special whatever not possible; using default whatever instead") and LOG should be informative for those who look at debug files (which is typically the modder) but preferably not contain anything the player should be made aware of (not that PRINT is much good for that, anyway).

Argent77 commented 9 years ago

I've discovered a small bug in pvrz_funcs_v2.tph at line 387.

The line PATCH_IF (min_index = "-1" || max_index == 100000) BEGIN has to be replaced by PATCH_IF (min_index == 100000 || max_index == "-1") BEGIN.

FredrikLindgren commented 9 years ago

Included. Thanks. I only ended up changing an additional few details concerning variables (e.g., you never need to enclose integers in percentage signs when you use them as integers).