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

Fix/75 extract items csv #76

Merged
merged 19 commits into from
Oct 20, 2021
Merged

Fix/75 extract items csv #76

merged 19 commits into from
Oct 20, 2021

Conversation

demoth
Copy link
Owner

@demoth demoth commented Oct 14, 2021

Extract item data from java code into csv resource

@demoth demoth added file-formats gamemod game logic related labels Oct 14, 2021
@demoth demoth changed the title Fix/75 extract items csv (WIP) Fix/75 extract items csv Oct 14, 2021


public class GameItemList {

// RST: this was separated in the java conversion from the g_item.c
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole file will be removed when the PR is finished

@@ -380,12 +409,12 @@ private void Give_f(SubgameEntity ent, List<String> args) {

if (give_all || 0 == Lib.Q_stricmp(name, "items")) {

for (i = 1; i < game.num_items; i++) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change might warrant an explanation

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change of index happened because I removed to sacred objects in the game item list - the first null object and the last null object - see removed section in the GameItemList.java

@demoth demoth changed the title (WIP) Fix/75 extract items csv Fix/75 extract items csv Oct 14, 2021
@@ -107,7 +108,7 @@ public static void BeginIntermission(SubgameEntity targ, GameExportsImpl gameExp
if (!client.inuse)
continue;
// strip players of all keys between units
for (int n = 1; n < gameExports.items.itemlist.length; n++) {
for (int n = 0; n < gameExports.items.itemlist.length; n++) {
// null pointer exception fixed. (RST)
if (gameExports.items.itemlist[n] != null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this still be true? Since null values are removed

implementation("org.apache.commons:commons-csv:1.9.0")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first ever 3rd party library! (apart from lwjgl)

@@ -664,8 +699,8 @@ public void drop(SubgameEntity ent, gitem_t item, GameExportsImpl gameExports) {
dropped.count = client.pers.inventory[index];

if (client.pers.weapon != null
&& client.pers.weapon.tag == GameDefines.AMMO_GRENADES
&& item.tag == GameDefines.AMMO_GRENADES
&& client.pers.weapon.classname.equals("ammo_grenades")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed tags in favour of the classname

Defines.ATTN_NORM, 0);
power_armor_type = 0;
;
}
}

index = GameItems.ArmorIndex(ent, gameExports);
if (power_armor_type != 0
&& (0 == index || 0 != (gameExports.level.framenum & 8))) { // flash
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how such comment disorder is named?

public gitem_armor_t info;
public String precaches; // string of all models, sounds, and images this item will

private static final Map<String, Integer> ITEM_TYPE_MAP = Map.of(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these maps are for csv parsing

@demoth demoth merged commit 57927c5 into main Oct 20, 2021
@demoth demoth deleted the fix/75-extract-items-csv branch October 20, 2021 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file-formats gamemod game logic related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants